* feat: add support for ‘greeting’ and ‘global reply mode’ commands, improve variable naming and remove unnecessary backend output. * feat: Add support for black and white lists, global reply mode and voice role settings, private chat switch, and active greeting configuration. Refactor some variable names and comment out redundant code for better readability and reduced backend output. * feat: 为新功能完善了帮助面板 * docs: 完善了‘打招呼’的帮助说明 * Commit Type: feat, bugfix Add functionality to view plugin command table, fix bug in blacklist/whitelist, and fix bug where chat mode can still be used in private messaging when disabled. * Commit Type: feat, bugfix Add functionality to view plugin command table, fix bug in blacklist/whitelist, and fix bug where chat mode can still be used in private messaging when disabled. * refactor: Remove redundant log output. * Refactor: optimize code logic * Fix: 修复绘图指令表被抢指令的bug。 * Refactor:1. Add support for automatically translating replies to Japanese and generating voice messages in VITS voice mode (please monitor remaining quota after enabling). 2. Add translation function. 3. Add emotion configuration for Azure voice mode, allowing the robot to select appropriate emotional styles for replies. * Refactor:Handle the issue of exceeding character setting limit caused by adding emotion configuration. * Fix: fix bugs * Refactor: Added error feedback to translation service * Refactor: Added support for viewing the list of supported roles for each language mode, and fixed some bugs in the emotion switching feature of the auzre mode. * Refactor: Optimized some command feedback and added owner restriction to chat record export function. * Refactor: Optimized feedback when viewing role list to avoid excessive messages. * Refactor: Optimized feedback when configuring multi-emotion mode. * Feature: Added help instructions for translation feature. * chore: Adjust help instructions for mood settings * Fix: Fixed issue where only first line of multi-line replies were being read and Azure voice was pronouncing punctuation marks. * Fix: Fixed bug where switching to Azure voice mode prompted for missing key and restricted ability to view voice role list to only when in voice mode. * Refactor: Add image OCR function and support translation for both quoted text and image. * fix: Fix issue with error caused by non-image input. * Refactor: Optimize code to filter emojis that cannot be displayed properly in claude mode. * Refactor: Optimize some code structures. * fix: Fix the bug of returning only one result when entering multiple lines of text on Windows system. * Refactor: Optimize code logic for better user experience * Refactor: Fix the conflict issue with other plugin translation commands * Refactor: Replace Baidu Translation with Youdao Translation to eliminate configuration steps; optimize translation experience; add missing dependency prompts instead of causing program errors.Optimize the experience of switching between voice mode and setting global reply mode. * Refactor: Remove unused files and dependencies in the project. * Feature: Add Youdao translation service to provide more comprehensive translation support. * Refactor: Optimize translation experience * Refactor: Optimize translation experience * Feature: Add functionality of keyword search command * Feature: Add functionality of keyword search command. * Refactor: Remove redundant code * Add: Add feature to support randomly selecting roles for Azure voice. Refactor the code to support existing voice services for the ‘greeting’ feature. Fix the display issue of Azure voice role selection on the Guoba panel. * Refactor: Remove redundant code * Refactor: Improve the function of setting global voice roles and viewing role lists. Now you can set default roles for each voice service separately or view the supported role list. * Refactor: Remove redundant code * Feature: Add new function to support random character dialogues in all voice modes, add the ability to view the current user’s reply settings, and improve related functions in the global settings. * Refactor: Add compatibility directive for viewing reply settings feature * Feature: support adding QQ number to blacklist/whitelist * fix: 处理全局设置指令被上下班指令占用的问题 * fix: 处理全局设置指令被上下班指令占用的问题 * Refactor: Preprocess dialogue blacklist/whitelist when filling in the form in Guoba panel * Fix: Fixed the issue where black and white lists were not effective when filled in the Guoba panel, and the issue where no results were returned when viewing the voice role list without parameters in azure tts mode. * fix: 2.7 dev start * feat: 初步支持function call(WIP) * fix: syntax error * fix: syntax error * feat: 群聊上下文 * fix: 暂时阉割掉全员禁言功能 * fix: 修改禁言时间范围 * fix: 修复一些功能易用性 * fix: 只有管理员和群主才能用jinyan和kickout * fix: 加回来禁言和踢出 * fix: 修复管理员权限判断问题(可能吧) * fix: 试图优化逻辑 * fix: fuck openai documents * fix: 删掉认主不然一直禁言我烦死了 * fix: 哔哩哔哩封面损坏问题 * fix: 加个天气小工具 * fix: 天气不存在城市 * fix: website工具用浏览器 * feat: serp tool * feat: 增加一个google搜索源 * fix: 加一句描述 * feat: 增加搜索来源选项 * feat: 搜图和发图 * fix: groupId format error * Refactor: Optimized the HTML parsing rules * fix: Fixed the bug where conversations could not be properly ended in at mode, now it works normally * refactor: Added EliMovieTool and EliMusicTool. Modified some tool’s prompt to make AI make better choices. Optimized the display of chat history.Remove SendMusicTool and replace it with EliMusicTool. * chore: trivial changes. * refactor:Keep SearchMusicTool and SendMusicTool when avocado plugin is not installed, waiting for more testing~~~ * Refactor: Move the parameter processing logic of some tools into each tool internally.🥑Rename ttstool to SendAudioMessageTool, defaulting to the voice role configured by the current user, and support personalized configuration of the existing tts mode in the plugin.🥑Add SendMessageToSpecificGroupOrUserTool, which allows the robot to send messages to specific groups or friends.🥑Encapsulate the function of generating audio messages into an independent function for easy tool invocation.🥑Separate SendPictureTool and SendAvatarTool to avoid unnecessary bugs.🥑 * chore: Remove unnecessary log file🥑 * refactor: Trivial changes and fixed a bug in QueryUserinfoTool.🥑 * Refactor: Rewrite blacklist and whitelist functionality, optimize code calls Description: Rewrote the blacklist and whitelist functionality to support group, QQ number, and a combination of group and QQ number configurations. Removed the command to set the blacklist and whitelist functionality and unified it through the Guoba panel. Also optimized some code calls to EliMusicTool and EliMovieTool.🥑 --------- Co-authored-by: Sean <1519059137@qq.com> Co-authored-by: ikechan8370 <geyinchibuaa@gmail.com> Co-authored-by: ikechan8370 <geyinchi@buaa.edu.cn> |
||
|---|---|---|
| .github | ||
| apps | ||
| config | ||
| prompts | ||
| resources | ||
| server | ||
| utils | ||
| .gitignore | ||
| .npmrc | ||
| guoba.support.js | ||
| index.js | ||
| LICENSE | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| yarn.lock | ||
云崽QQ机器人的ChatGPT插件
推荐的相关文档和参考资料
本README 手册 文档1(建设中) 插件常见问题(鹤望兰版) Yunzai常见问题(LUCK小运版) 憨憨博客
特点
- 支持单人连续对话Conversation
- API模式下,使用 gpt-3.5-turbo 或 gpt-4 API,仅需OpenAI Api Key,开箱即用。注意收费
- 支持问答图片截图和聊天记录导出
- 支持AI性格调教,角色扮演强烈推荐Bing自定义模式
- 支持对接vits和Azure等回答直接转语音
- API3模式下,绕过Cloudflare防护直接访问ChatGPT的SSE API,与官方体验一致,且保留对话记录,在官网可查。免费。
- (已不再维护)提供基于浏览器的解决方案作为备选,API3不可用的情况下或担心账户安全的用户可以选择使用浏览器模式。
- 支持新必应(token负载均衡,限流降级)
- 2023-03-15 API3支持GPT-4尝鲜,需要Plus用户
- 支持ChatGLM模型。基于自建API
- 2023-04-15 支持Claude by Slack和Poe(WIP)。Claude配置参考这里
- 2023-05-12 支持星火大模型
- 2023-05-29 支持gpt-4 API.必应无需cookie即可对话(Sydney和自定义模式)
如果觉得这个插件有趣或者对你有帮助,请点一个star吧!
版本要求
Node.js >= 18 / Node.js >= 14(with node-fetch) 小白尽可能使用18版本以上的nodejs
安装与使用方法
安装
在安装之前,请先判断自己需要使用哪种模式,本插件支持官方API/第三方API/浏览器/必应四种模式。也可以选择我全都要(通过qq发送命令#chatgpt切换浏览器/API/API3/Bing实时切换)
API模式和浏览器模式如何选择?
- API模式会调用OpenAI官方提供的gpt-3.5-turbo API,ChatGPT官网同款模型,只需要提供API Key。一般情况下,该种方式响应速度更快,可配置项多,且不会像chatGPT官网一样总出现不可用的现象,但注意API调用是收费的,新用户有18美元试用金可用于支付,价格为
$0.0020/ 1K tokens。(问题和回答加起来算token)- API3模式会调用第三方提供的官网反代API,他会帮你绕过CF防护,需要提供ChatGPT的Token。效果与官网和浏览器一致,但稳定性不一定。发送#chatgpt设置token来设置token。
- (Deprecated)浏览器模式通过在本地启动Chrome等浏览器模拟用户访问ChatGPT网站,使得获得和官方以及API2模式一模一样的回复质量,同时保证安全性。缺点是本方法对环境要求较高,需要提供桌面环境和一个可用的代理(能够访问ChatGPT的IP地址),且响应速度不如API,而且高峰期容易无法使用。一般作为API3的下位替代。
- 必应(Bing)将调用微软新必应接口进行对话。需要在必应网页能够正常使用新必应且设置有效的Bing登录Cookie方可使用。强烈推荐
-
进入 Yunzai根目录
-
请将 chatgpt-plugin 放置在 Yunzai-Bot 的 plugins 目录下
推荐使用 git 进行安装,以方便后续升级。在 Yunzai-Bot 根目录夹打开终端,运行下述指令进行安装
# github源
git clone --depth=1 https://github.com/ikechan8370/chatgpt-plugin.git ./plugins/chatgpt-plugin/
# 网络不好连不上github可以使用gitee源,但更新可能不如github及时
git clone --depth=1 https://gitee.com/ikechan/chatgpt-plugin.git ./plugins/chatgpt-plugin/
# 以上二选一后执行下面步骤进入目录安装依赖
cd plugins/chatgpt-plugin
pnpm i
如果是手工下载的 zip 压缩包,请将解压后的 chatgpt-plugin 文件夹(请删除压缩自带的-master或版本号后缀)放置在 Yunzai-Bot 目录下的 plugins 文件夹内
浏览器模式仅为备选,如您需要使用浏览器模式,您还需要有桌面环境,优先级建议:API≈必应>API3>浏览器
2.20更新:必应被大削,变得蠢了,建议还是API/API3优先
4.2更新:必应站起来了,必应天下第一。建议都用必应,别用API/API3了。浏览器模式除非极其特殊的需求否则强烈建议不使用,已经不维护了。
-
修改配置 本插件配置项比较多,强烈建议使用后台面板或锅巴面板修改
复制
plugins/chatgpt-plugin/config/config.example.json并将其改名为config.json
编辑plugins/chatgpt-plugin/config/config.json文件,修改必要配置项
请勿直接修改config.example.json -
后台面板使用 初次使用请先私聊机器人
#设置管理密码进登录密码设置 私聊#chatgpt系统管理后机器人会回复系统管理页面网址,在此网址输入机器人QQ号和刚刚设置的管理密码点击登录即可进入后台管理系统 如果忘记密码,再次私聊输入#设置管理密码后可重新设置密码用户同样可私聊机器人
#设置用户密码进行账号注册和密码设置 用户设置密码后,所有聊天信息将记录在用户缓存数据下,同时用户可通过私聊机器人#chatgpt用户配置登录后台用户配置面板,查看自己的聊天数据和自定义机器人对自己的回复参数如果后台面板访问出现 time out 请检查机器人启动时是否有报错,服务器端口是否开放,可尝试ping一下服务器ip看能否直接ping通。
-
重启Yunzai-Bot 如通过后台面板或锅巴面板升级可以热加载,无需重启。
相关配置
配置文件相关
配置文件位置:plugins/chatgpt-plugin/config/config.json
部分关键配置项,其他请参照文件内注释:
| 名称 | 含义 | 解释 |
|---|---|---|
| proxy | 代理地址 | 请在此处配置你的代理,例如http://127.0.0.1:7890 |
| apiKey | openai账号的API Key | 获取地址:https://platform.openai.com/account/api-keys |
Token相关
与Token相关的设置需在qq与机器人对话设置,设置后方可使用对应的api
| 名称 | 含义 | 解释 | 设置方式 |
|---|---|---|---|
| ChatGPT AccessToken | ChatGPT登录后的Token | 具体解释见下方 | #chatgpt设置token |
| 必应token | 必应登录后的Token | 必应(Bing)将调用微软必应AI接口进行对话。不填写token对话上限为5句,填写后为20句。无论填写与否插件都会无限续杯。 | #chatgpt设置必应token/#chatgpt删除必应token/#chatgpt查看必应token |
我没有注册openai账号?如何获取
您可以按照以下方法获取openai账号
进入https://chat.openai.com/ ,选择signup注册。目前openai不对包括俄罗斯、乌克兰、伊朗、中国等国家和地区提供服务,所以自行寻找办法使用其他国家和地区的ip登录。此外,注册可能需要验证所在国家和地区的手机号码,如果没有国外手机号可以试试解码网站,收费的推荐https://sms-activate.org/
我有openai账号了,如何获取API key和Access Token?
获取API key
- 进入账户后台创建API key(Create new secret key):https://platform.openai.com/account/api-keys
获取Access Token
- 登录后访问https://chat.openai.com/api/auth/session
- 您会获得类似如下一串json字符串
{"user":{"id":"AAA","name":"BBB","email":"CCC","image":"DDD","picture":"EEE","groups":[]},"expires":"FFF","accessToken":"XXX"}- 其中的XXX即为
ChatGPT AccessToken- 如果是空的{},说明没有登录,要登录chatgpt而不是openai。
ChatGPT AccessToken 设置了有什么用?我为什么用不了API模式
- 部分API需要在和机器人的聊天里输入
#chatgpt设置token才可以使用我有新必应的测试资格了,如何获取必应Token?
2023/05/29 无需登录也可以使用了,要求不高可以不填
- JS一键获取
登录www.bing.com,刷新一下网页,按F12或直接打开开发者模式,点击Console/控制台,运行如下代码,执行后即在您的剪切板存储了必应Token
copy(document.cookie.split(";").find(cookie=>cookie.trim().startsWith("_U=")).split("=")[1]);
- 手动获取
登录www.bing.com,刷新一下网页,按F12或直接打开开发者模式,点击Application/存储,点击左侧Storage下的Cookies,展开找到https://www.bing.com 项,在右侧列表Name项下找到"_U",_U的value即为必应Token
其他问题可以参考使用的api库 https://github.com/transitive-bullshit/chatgpt-api 以及 https://github.com/waylaidwanderer/node-chatgpt-api
使用方法
根据配置文件中的toggleMode决定联通方式。
-
at模式:@机器人 发送聊内容即可
-
prefix模式:【#chat+问题】,本模式可以避免指令冲突。
发挥你的想象力吧,调教拟造出你自己的机器人风格!
文本/图片回复模式
#chatgpt文本/图片/语音模式
可以控制机器人回复的方式
对话相关
#chatgpt对话列表
#结束对话 [@某人]
#清空chat队列
#移出chat队列首位
#chatgpt开启/关闭问题确认
...
设置相关
#chatgpt切换浏览器/API/API2/API3/Bing
#chatgpt设置[必应]Token
...
获取帮助
#chatgpt帮助
#chatgpt模式帮助
发送#chatgpt帮助,有更多选项可以配置
如何更新
发送#chatgpt更新指令。如果有冲突,可以使用#chatgpt强制更新。
示例与截图
- 程序员版
- 傲娇版
TODO
- V3重构
- 插件in插件
- langchain分支完善
- 游戏机制
其他
常见问题
-
如果在linux系统上发现图片模式下emoj无法正常显示,可以搜索安装支持emoj的字体,如Ubuntu可以使用
sudo apt install fonts-noto-color-emoji -
我和机器人聊天但没有任何反应怎么办?
可能是由于Yunzai-bot异常退出等原因造成Redis 队列中有残留的等待问题。使用
#清空队列命令清除队列后再试。 -
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'xxx'.
请参照本文档前面的安装依赖部分重新依赖。随着项目更新可能引入新的依赖。
一般情况下请按照 安装 小节的内容重新安装依赖即可
最多的问题:载入插件错误:chat
问题详情:Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'showdown' imported from /app/Yunzai-Bot/plugins/chatgpt-plugin/apps/chat.js
原因:没装依赖
解决方式:请参考文档在本插件目录下用
pnpm install安装依赖,安装完就不报错了 -
反代能自己搭吗?
能。参考这里
-
vit API能本地搭建吗?
能。克隆下来安装依赖直接运行即可。
-
系统后台无法进入怎么办?
多数情况下是由于服务器未开放3321端口导致,请根据服务器系统和服务器供应商配置,开放3321端口后再试。
交流群
- QQ 559567232 [问题交流]
- QQ 126132049 [机器人试验场]
感谢
本项目使用或参考了以下开源项目
- https://github.com/transitive-bullshit/chatgpt-api
- https://github.com/waylaidwanderer/node-chatgpt-api
- https://github.com/acheong08/ChatGPT
- https://github.com/PawanOsman
本插件的辅助项目
图片以及Bing模式支持 @HalcyonAlcedo
- https://github.com/HalcyonAlcedo/ChatGPT-Plugin-PageCache
- https://github.com/HalcyonAlcedo/cache-web
语音vits模型来自于
以及ChatGPT及OpenAI
ChatGLM
赞助
如果觉得本项目好玩或者对你有帮助,愿意的话可以赞助我一口快乐水:
https://afdian.net/a/ikechan8370
贡献者
感谢以下贡献者
Star History
工具支持
JetBrains for Open Source development license




