📖 介绍
一个可以使用新版Bing进行聊天的插件 (现在又不需要代理了)
目前支持onebot v11协议加上go-cqhttp的扩展协议与nonebot-plugin-guild-patch
QQ群:366731501
给个star🌟?
5月份有大考,6月前暂停更新
如果你有更多需求,请发布issue让我知道
替代品:https://github.com/canxin121/Spark-GPT
💿 安装与更新
使用 nb-cli 安装与更新
在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装
nb plugin install nonebot-plugin-bing-chat --upgrade
使用pip安装与更新
在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令
pip install --upgrade nonebot-plugin-bing-chat
对于发送图片的支持需要执行
pip install --upgrade nonebot-plugin-bing-chat[image]
打开 nonebot2 项目根目录下的 `pyproject.toml` 文件, 在 `[tool.nonebot]` 部分追加写入
plugins = ["nonebot_plugin_bing_chat"]
⚙️ 配置
在 nonebot2 项目的./data/BingChat/cookies
文件夹中添加cookies.json
(必须)
- 在浏览器安装 `cookie-editor` 的插件
- [Chrome/Edge](https://chrome.google.com/webstore/detail/cookie-editor/hlkenndednhfkekhgcdicdfddnkalmdm)(需要魔法)
- [Firefox](https://addons.mozilla.org/en-US/firefox/addon/cookie-editor/)
- 使用Edge浏览器打开[`www.bing.com/chat`](https://www.bing.com/chat)(需要魔法)
- 打开 `cookie-editor` 插件
- 点击右下角的 `Export` 按钮(这会把cookie保存到你的剪切板上)
- 把你复制道德内容放到 `cookies.json` 文件里
- (可选)你可以创建多个以`.json`结尾的cookies文件
在 nonebot2 项目的.env
文件中添加下表中的配置(可选项)
在.env书写配置时,字符转要使用**双引号**,而**不是**单引号
命令配置
| 配置项 | 类型 | 默认值 | 说明 |
|:----:|:----:|:----:|:----:|
| command_start | list[str] | ["/"] | 命令前缀 |
| bingchat_command_chat | str/list[str] | ["chat"] | 对话命令 |
| bingchat_command_new_chat | str/list[str] | ["chat-new", "刷新对话"] | 新建对话命令 |
| bingchat_command_history_chat | str/list[str] | ["chat-history"] | 返回历史对话命令 |
| bingchat_block | bool | False | 是否block |
| bingchat_priority | int | 1 | 指令的优先级 |
| bingchat_to_me | bool | False | 所有命令是否需要@bot |
| bingchat_share_chat | bool | False | 他人是否可以用过回复bot而进行对话 |
输出配置
| 配置项 | 类型 | 默认值 | 说明 |
|:----:|:----:|:----:|:----:|
| bingchat_display_is_waiting | bool | True | 是否显示“正在请求” |
| bingchat_display_in_forward | bool | False | 是否以合并转发的消息形式发送消息 |
| bingchat_display_content_types | str/list[str] | ["text.num-max-conversation&answer&suggested-question"] | 输出的内容包括什么 |
进行配置
| 配置项 | 类型 | 默认值 | 说明 |
|:----:|:----:|:----:|:----:|
| bingchat_log | bool | True | 是否记录日志 |
| bingchat_proxy | str | None | 代理地址 |
| bingchat_conversation_style | "creative" / "balanced" / "precise" | "balanced" | 对话样式 |
| bingchat_auto_switch_cookies | bool | False | 账号上限后是否自动切换cookies |
| bingchat_auto_refresh_conversation | bool | True | 聊天上限后是否自动建立新的对话 |
屏蔽群聊配置
| 配置项 | 类型 | 默认值 | 说明 |
|:----:|:----:|:----:|:----:|
| bingchat_group_filter_mode | "whitelist"/"blacklist" | "blacklist" | 对群聊屏蔽的模式 |
| bingchat_group_filter_blacklist | list[int] | [] | QQ群黑名单列表 |
| bingchat_group_filter_whitelist | list[int] | [] | QQ群白名单列表 |
| bingchat_guild_filter_blacklist | list[dict] | [] | QQ频道黑名单列表 |
| bingchat_guild_filter_whitelist | list[dict] | [] | QQ频道白名单列表 |
频道的配置格式:`{"guild_id": "123456789", "channel_id": "123456789"}`
源码内容可以在[./nonebot_plugin_bing_chat/common/dataModel.py](https://github.com/Harry-Jing/nonebot-plugin-bing-chat/blob/main/nonebot_plugin_bing_chat/common/dataModel.py)查看
举例配置与效果
> 还没写,可以来QQ群来问我
🎉 使用
指令表
以下为指令可以在配置文件中更改 |
指令 |
权限 |
需要@ |
范围 |
说明 |
chat |
所有人 |
否 |
私聊/群聊 |
与Bing进行对话 |
chat-new |
所有人 |
否 |
私聊/群聊 |
新建一个对话 |
chat-history |
所有人 |
否 |
私聊/群聊 |
返回历史对话 |
你可以回复bot的消息从而直接继续对话,而不用输入对话指令
🌸 致谢
Contributor