@gauravrathod674/super-customizable-chatbot

中文文档
1.18.6发布于 2026/02/04MITESM + CJS零依赖近 30 天下载 2251

一个高度自定义的React聊天器组件,支持双子座,OpenAI,Anthropic和Groq APIs.

中文使用文档
文档目录17 节
  1. QQ 演示预览
  2. * 特性
  3. * 安装
  4. AI 供应商 SDKs
  5. 使用量
  6. 示例:谷歌双子座
  7. 示例: OpenAI
  8. 示例: Athropic (克洛德语)
  9. 示例:格罗克
  10. 示例:对文本和文件上传的语音
  11. QQ 自定义指令( 系统提示)
  12. QQ 主题和自定义
  13. 示例: 打入动画自定义( C) 主题
  14. API 参考
  15. 组件道具
  16. 主题选项( E) theme 对象)
  17. 许可证

超级自定义回放聊天包

npm npm downloads License: MIT

一个高度自定义, 表演, 和智能反应聊天器组件。 丢入任何项目,以添加一个强大的对话AI接口,由 谷歌双子座,OpenAI,Anthropic(克洛德)和格罗克。 。 。 .

QQ 演示预览

此聊天机在您的 React app 中

Watch the Demo on YouTube

🔗 在YouTube上观看完整视频

此演示演示 :

  • 反应中的无缝集成
  • 清洁模式和部件视图
  • 用自定义主题打入动画
  • 使用OpenAI/Gemini/克洛德/格洛克API

* 特性

  • 🤖 多API 支持:与谷歌双子座,OpenAI,Anthropic(克洛德)和Groq直接融合.
  • 🧠 自定义指令:提供一种系统提示来定义机器人的个性a,角色和规则.
  • 🚀 模式选择: 从任何支持的提供者中选择您想要使用的精确的AI模型(例如, gemini-1.5-flash, (中文(简体) ), gpt-4o-mini, (中文(简体) ), claude-3-haiku, (中文(简体) ), llama3-8b-8192) (中文(简体) ).
  • 🎨 深度自定义: 使用一个全面 theme 对象以控制每个颜色、字体、边框和大小.
  • 🎬 打字动画:让用户以平滑,逐个字符的打字动画进行博特响应.
  • 🗣️ 语音文本( 可选) ——使用浏览器的"Web Speech API"构建语音输入,用于无手互动.
  • 📎 文件上传( 可选): 允许用户上传图像和文件,以便用相容模型进行多模式对话(Gemini, GBT-4o, Claude 3).
  • 🧩 灵活安置: 显示为经典的角部件或大型、有重点的模式.
  • 💅 标记下渲染:自动制作列表,粗体/斜体文本,页眉等.
  • 💪 受控模式( U):将其用作简单的插件和游戏组件或完全控制其状态.
  • ♿ 可访问:设计时考虑到无障碍性,包括焦点管理和ARIA属性.

* 安装

安装来自国家预防机制的软件包及其核心同行依赖.

npm install @gauravrathod674/super-customizable-chatbot @fortawesome/react-fontawesome @fortawesome/free-solid-svg-icons @fortawesome/fontawesome-svg-core framer-motion react-markdown

AI 供应商 SDKs

您还需要为您想要使用的特定AI提供者安装 SDK 。 你只需要安装你打算使用的.

# For Google Gemini
npm install @google/generative-ai

# For OpenAI
npm install openai

# For Anthropic (Claude)
npm install @anthropic-ai/sdk

# For Groq
npm install groq-sdk

使用量

导入组件及其样式表,然后用适当的 API 密钥将其制成 .

示例:谷歌双子座

import React from 'react';
import ChatBot from '@gauravrathod674/super-customizable-chatbot';
import '@gauravrathod674/super-customizable-chatbot/dist/style.css';

function App() {
  const GEMINI_API_KEY = "YOUR_GEMINI_API_KEY";

  return (
    <ChatBot
      botName="Gemini Bot"
      geminiApiKey={GEMINI_API_KEY}
      geminiModelName="gemini-1.5-flash"
      welcomeMessage="I am powered by Gemini. How can I help?"
    />
  );
}

示例: OpenAI

import React from 'react';
import ChatBot from '@gauravrathod674/super-customizable-chatbot';
import '@gauravrathod674/super-customizable-chatbot/dist/style.css';

function App() {
  const OPENAI_API_KEY = "YOUR_OPENAI_API_KEY";

  return (
    <ChatBot
      botName="OpenAI Bot"
      openaiApiKey={OPENAI_API_KEY}
      openaiModelName="gpt-4o-mini"
      welcomeMessage="I am powered by OpenAI. How can I help?"
    />
  );
}

示例: Athropic (克洛德语)

import React from 'react';
import ChatBot from '@gauravrathod674/super-customizable-chatbot';
import '@gauravrathod674/super-customizable-chatbot/dist/style.css';

function App() {
  const ANTHROPIC_API_KEY = "YOUR_ANTHROPIC_API_KEY";

  return (
    <ChatBot
      botName="Claude Bot"
      anthropicApiKey={ANTHROPIC_API_KEY}
      anthropicModelName="claude-3-haiku-20240307"
      welcomeMessage="I am powered by Claude. How can I help?"
    />
  );
}

示例:格罗克

import React from 'react';
import ChatBot from '@gauravrathod674/super-customizable-chatbot';
import '@gauravrathod674/super-customizable-chatbot/dist/style.css';

function App() {
  const GROQ_API_KEY = "YOUR_GROQ_API_KEY";

  return (
    <ChatBot
      botName="Groq Bot"
      grokApiKey={GROQ_API_KEY}
      grokModelName="llama3-8b-8192"
      welcomeMessage="I am powered by Groq. I am very fast. How can I help?"
    />
  );
}

示例:对文本和文件上传的语音

import React from 'react';
import ChatBot from '@gauravrathod674/super-customizable-chatbot';
import '@gauravrathod674/super-customizable-chatbot/dist/style.css';

function App() {
  const GEMINI_API_KEY = "YOUR_GEMINI_API_KEY";

  return (
    <ChatBot
      botName="Gemini Bot"
      geminiApiKey={GEMINI_API_KEY}
      geminiModelName="gemini-1.5-flash"
      enableMicrophone="enabled"
      enableFileUpload={true}
      fileUploadAccept="image/*,.pdf,.doc,.docx" 
      welcomeMessage="I am powered by Gemini. How can I help?"
    />
  );
}

QQ 自定义指令( 系统提示)

为大赦国际界定一人或一套规则,使用: customInstruction 道具 (英语). 聊天人会在整个谈话中遵守这个指示.

<ChatBot
  botName="Pirate Bot"
  openaiApiKey="YOUR_OPENAI_API_KEY"
  customInstruction="You are a helpful assistant who speaks like a pirate. Keep your answers brief and witty."
  welcomeMessage="Ahoy there, matey! What be yer question?"
/>

QQ 主题和自定义

该组件的最大力量是它的自定义性. 您可以通过通过 : theme 对象.

示例: 打入动画自定义( C) 主题

这个例子创造了一个大型的,以为中心,背景模糊的聊天员,独特的色彩方案,以及新的打字动画.

import React from 'react';
import ChatBot from '@gauravrathod674/super-customizable-chatbot';
import '@gauravrathod674/super-customizable-chatbot/dist/style.css';

function ChatPage() {
  const corporateTheme = {
    header: { backgroundColor: '#1e3a8a' },
    messages: {
      userBackgroundColor: '#2563eb',
      botBackgroundColor: '#eef2ff',
      botTextColor: '#1e3a8a',
      animation: 'typing', // <-- Enable the typing animation
    },
    window: {
      placement: 'center',
      backdrop: true,
      backdropBlur: '3px',
    },
    input: { focusRingColor: '#2563eb' },
    launcher: { backgroundColor: '#1e3a8a' },
  };

  return (
    <ChatBot
      botName="CorpBot"
      openaiApiKey="YOUR_OPENAI_API_KEY"
      theme={corporateTheme}
    />
  );
}

API 参考

可通过两种主要途径: props 对行为和a theme 显示对象.

组件道具

这些道具控制了聊天器的功能,身份,和AI的集成.

Prop类型默认说明
geminiApiKeystringundefined您的谷歌双子座 API 密钥 .
openaiApiKeystringundefined您的 OpenAI API 密钥 .
anthropicApiKeystringundefined您的 Anthropic (Claude) API 密钥 .
grokApiKeystringundefined你的Groq API钥匙.
geminiModelNamestring'gemini-1.5-flash'要使用的双子座模型.
openaiModelNamestring'gpt-4o-mini'要使用的OpenAI模型.
anthropicModelNamestring'claude-3-haiku-20240307'要使用的Anthropic模型.
grokModelNamestring'llama3-8b-8192'要使用的格罗克模型.
customInstructionstring''一个系统提示来定义机器人的个性或行为.
enableMicrophonestringundefined任何启用 Speech-to-Text 麦克风的真伪字符串 。 不需要实际全权证书.
enableFileUploadbooleanfalse启用文件附件按钮.
fileUploadAcceptstring*用于上传对话框(例如, "image/*, .pdf") (中文(简体) ).
onFileUpload(file: File) => void() => {}** 回击当用户选择文件时点火.
botNamestring'ChatBot'标题中显示的名称 .
welcomeMessagestring'Hello! How can I help?'机器人显示的初始消息 .
placeholderTextstring'Type a message...'输入字段中的占位符文本.
botAvatarReact.ReactNode<DefaultBotIcon />机器人外观的图标或图像 URL .
userAvatarReact.ReactNode<DefaultUserIcon />用户外观的图标或图像 URL .
isOpenbooleanfalse控制聊天窗口是否初始打开 .
disabledbooleanfalse禁用输入字段并发送按钮.
onSend(message: string) => void() => {}用户发送消息时回电 .
themeobject{}自定义 UI 的主题对象 。 见下表.
messagesArray<{id, text, sender}>undefined高级 : 受控信件对象数组 .
isTypingbooleanfalse高级 : 手动控制了机器人的打字指示器.

主题选项( E)theme 对象)

传出 a theme 对象为自定义聊天人的外观。 不提供的任何财产都将回落到其默认值.

启动按钮

路径类型默认说明
launcher.backgroundColorstring'#4f46e5'发射器按钮的背景颜色 .
launcher.iconColorstring'#ffffff'发射器内部图标的颜色.
launcher.sizestring'3.5rem'发射装置按钮的宽度和高度.

聊天窗口

路径类型默认说明
window.placementstring'bottom-right'显示屏幕位置 。 选项 : 'bottom-right', (中文(简体) ), 'bottom-left', (中文(简体) ), 'center'。 。 。 .
window.widthstring'22rem'聊天窗口的宽度 。 (违约情况) '80vw' 如果放置是 'center') (中文(简体) ).
window.heightstring'30rem'聊天窗口的高度。 (违约情况) '80vh' 如果放置是 'center') (中文(简体) ).
window.backgroundColorstring'#ffffff'主聊天窗口的背景颜色 .
window.borderColorstring'#e5e7eb'主聊天窗口的边框颜色 .
window.borderRadiusstring'0.75rem'主聊天窗口的边框半径 .
window.backdropbooleanfalse显示模糊的背景( 仅用于 'center' . 安置问题).
window.backdropColorstring'rgba(0,0,0,0.4)'颜色覆盖背景 .
window.backdropBlurstring'4px'CSS 模糊背景值 .
window.scrollbarThumbColorstring'#a1a1aa'信件列表滚动条缩略图的颜色 .
window.scrollbarTrackColorstring'#f1f5f9'信件列表滚动栏音轨的颜色 .

页眉

路径类型默认说明
header.backgroundColorstring'#4f46e5'页眉的背景颜色 .
header.textColorstring'#ffffff'头部为机器人名的文字颜色.
header.fontFamilystring'inherit'标题文本的字体家族 .
header.fontWeightstring'600'头文本的字体重量 .

信件

路径类型默认说明
messages.userBackgroundColorstring'#4f46e5'用户信息泡的背景颜色 .
messages.userTextColorstring'#ffffff'用户信件的文本颜色 .
messages.botBackgroundColorstring'#f3f4f6'机器人信息泡的背景颜色 .
messages.botTextColorstring'#1f2937'机器人消息的文本颜色 .
messages.fontFamilystring'inherit'所有信件文本的字体家族 .
messages.fontSizestring'0.9rem'所有信件文本的字体大小 .
messages.showAvatarsbooleantrue是否在信件旁边显示相机 .
messages.bubbleShapestring'rounded'发相相相相相相相相. 选项 : 'rounded', (中文(简体) ), 'square'。 。 。 .
messages.bubblePointerbooleantrue在信息泡上显示一个小指针.
messages.animationstring'fade-in'瓶子反应动画. 选项 : 'fade-in', (中文(简体) ), 'typing', (中文(简体) ), 'slide-up', (中文(简体) ), 'zoom-in', (中文(简体) ), 'flip', (中文(简体) ), 'none'。 。 。 .

标记下自定义( M)messages.markdownStyles(中文(简体) )

路径类型默认说明
markdownStyles.boldColorstringinherit颜色 **bold** 语句.
markdownStyles.italicColorstringinherit颜色 *italic* 语句.
markdownStyles.linkColorstring'#3b82f6'颜色 [links](...)。 。 。 .
markdownStyles.codeColorstringinherit文字颜色 inline code。 。 。 .
markdownStyles.codeBackgroundColorstringrgba(0,0,0,0.1)背景颜色 inline code。 。 。 .

输入区域

路径类型默认说明
input.backgroundColorstring'#ffffff'输入页脚区域的背景颜色.
input.textColorstring'#1f2937'用户输入的文本颜色 .
input.placeholderTextColorstring'#9ca3af'占位符文本的颜色 .
input.borderColorstring'#e5e7eb'文本输入字段的边框颜色 .
input.focusRingColorstring'#4f46e5'选择输入时焦点环的颜色.

许可证

这个项目根据麻省理工学院的许可证获得许可.

版本与发布记录

@gauravrathod674/super-customizable-chatbot 共发布 551 个版本,首次发布于 2025/07/26;过去 12 个月发布了 238 个版本。

版本发布日期距今
1.18.6latest2026/02/049 个月前
1.18.52026/02/039 个月前
1.18.42026/02/039 个月前
1.18.32026/02/039 个月前
1.18.22026/02/029 个月前
1.18.12026/02/029 个月前

关于 @gauravrathod674/super-customizable-chatbot 的常见问题

@gauravrathod674/super-customizable-chatbot 是什么?

一个高度自定义的React聊天器组件,支持双子座,OpenAI,Anthropic和Groq APIs.

如何安装 @gauravrathod674/super-customizable-chatbot?

在项目目录运行 npm install @gauravrathod674/super-customizable-chatbot,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@fortawesome/fontawesome-svg-core(>=6.0.0)、@fortawesome/free-solid-svg-icons(>=6.0.0)、@fortawesome/react-fontawesome(>=0.2.0)、framer-motion(>=11.0.0)、react(>=18.2.0)、react-dom(>=18.2.0)、react-markdown(>=9.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@gauravrathod674/super-customizable-chatbot 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/gauravrathod674__super-customizable-chatbot 是否存在。

@gauravrathod674/super-customizable-chatbot 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@gauravrathod674/super-customizable-chatbot 可以商用吗?

@gauravrathod674/super-customizable-chatbot 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@gauravrathod674/super-customizable-chatbot 的下载量有多少?

根据 npm 官方下载统计,@gauravrathod674/super-customizable-chatbot 在 2026/10/16 – 2026/11/14 这 30 天内被下载 2,251 次,日均约 75 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@gauravrathod674/super-customizable-chatbot 还在维护吗?

最新版本 1.18.6 发布于 2026/02/04(9 个月前);至今共发布 551 个版本,其中过去 12 个月发布了 238 个;首次发布于 2025/07/26。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。