RockChinQ / QChatGPT

😎高稳定性、🧩支持扩展、🦄多模态的 ChatGPT QQ / QQ频道 / One Bot 机器人🤖 | 支持 OpenAI GPT、GPT 4o、Claude、Gemini Pro、DeepSeek、Moonshot(Kimi)、gpt4free、One API、Ollama 的 QQ / QQ频道 / OneBot 机器人 / Agent 平台
https://q.rkcn.top
GNU Affero General Public License v3.0
4.21k stars 328 forks source link

[Bug]: 无法连接go-cqhttp #460

Closed lhr96 closed 1 year ago

lhr96 commented 1 year ago

部署方式

手动部署

登录框架

go-cqhttp

系统环境

Ubuntu 20.04.5 LTS

Python环境

Python 3.8.10

异常情况

按照流程走,go-cqhttp正常启动,程序却无法连接go-cqhttp,已经关闭防火墙,查看端口go-cqhttp正常运行。 3 4 error1 error2

报错信息

[2023-05-06 20:05:19.915] configuration.py (308) - [DEBUG] : For variant 'global', will try loading '/etc/xdg/pip/pip.conf' [2023-05-06 20:05:19.915] configuration.py (308) - [DEBUG] : For variant 'global', will try loading '/etc/pip.conf' [2023-05-06 20:05:19.915] configuration.py (308) - [DEBUG] : For variant 'user', will try loading '/root/.pip/pip.conf' [2023-05-06 20:05:19.915] configuration.py (308) - [DEBUG] : For variant 'user', will try loading '/root/.config/pip/pip.conf' [2023-05-06 20:05:19.916] configuration.py (308) - [DEBUG] : For variant 'site', will try loading '/usr/pip.conf' [2023-05-06 20:05:19.942] versioncontrol.py (222) - [DEBUG] : Registered VCS backend: bzr [2023-05-06 20:05:19.943] versioncontrol.py (222) - [DEBUG] : Registered VCS backend: git [2023-05-06 20:05:19.944] versioncontrol.py (222) - [DEBUG] : Registered VCS backend: hg [2023-05-06 20:05:19.944] versioncontrol.py (222) - [DEBUG] : Registered VCS backend: svn [2023-05-06 20:05:19.989] backend.py (193) - [INFO] : Loading KWallet [2023-05-06 20:05:19.997] backend.py (193) - [INFO] : Loading SecretService [2023-05-06 20:05:19.999] backend.py (193) - [INFO] : Loading Windows [2023-05-06 20:05:20.000] backend.py (193) - [INFO] : Loading chainer [2023-05-06 20:05:20.001] backend.py (193) - [INFO] : Loading macOS [2023-05-06 20:05:20.152] configuration.py (308) - [DEBUG] : For variant 'global', will try loading '/etc/xdg/pip/pip.conf' [2023-05-06 20:05:20.153] configuration.py (308) - [DEBUG] : For variant 'global', will try loading '/etc/pip.conf' [2023-05-06 20:05:20.153] configuration.py (308) - [DEBUG] : For variant 'user', will try loading '/root/.pip/pip.conf' [2023-05-06 20:05:20.154] configuration.py (308) - [DEBUG] : For variant 'user', will try loading '/root/.config/pip/pip.conf' [2023-05-06 20:05:20.154] configuration.py (308) - [DEBUG] : For variant 'site', will try loading '/usr/pip.conf' Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple Requirement already up-to-date: openai in /usr/local/lib/python3.8/dist-packages (0.27.6) Requirement already up-to-date: Pillow in /usr/local/lib/python3.8/dist-packages (9.5.0) Requirement already up-to-date: nakuru-project-idk in /usr/local/lib/python3.8/dist-packages (0.0.2) Requirement already satisfied, skipping upgrade: tqdm in /usr/local/lib/python3.8/dist-packages (from openai) (4.65.0) Requirement already satisfied, skipping upgrade: requests>=2.20 in /usr/local/lib/python3.8/dist-packages (from openai) (2.28.2) Requirement already satisfied, skipping upgrade: aiohttp in /usr/local/lib/python3.8/dist-packages (from openai) (3.8.4) Requirement already satisfied, skipping upgrade: logbook in /usr/local/lib/python3.8/dist-packages (from nakuru-project-idk) (1.5.3) Requirement already satisfied, skipping upgrade: async-lru in /usr/local/lib/python3.8/dist-packages (from nakuru-project-idk) (2.0.2) Requirement already satisfied, skipping upgrade: pydantic in /usr/local/lib/python3.8/dist-packages (from nakuru-project-idk) (1.10.7) Requirement already satisfied, skipping upgrade: certifi>=2017.4.17 in /usr/lib/python3/dist-packages (from requests>=2.20->openai) (2019.11.28) Requirement already satisfied, skipping upgrade: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.8/dist-packages (from requests>=2.20->openai) (1.26.15) Requirement already satisfied, skipping upgrade: idna<4,>=2.5 in /usr/lib/python3/dist-packages (from requests>=2.20->openai) (2.8) Requirement already satisfied, skipping upgrade: charset-normalizer<4,>=2 in /usr/local/lib/python3.8/dist-packages (from requests>=2.20->openai) (3.1.0) Requirement already satisfied, skipping upgrade: multidict<7.0,>=4.5 in /usr/local/lib/python3.8/dist-packages (from aiohttp->openai) (6.0.4) Requirement already satisfied, skipping upgrade: yarl<2.0,>=1.0 in /usr/local/lib/python3.8/dist-packages (from aiohttp->openai) (1.9.2) Requirement already satisfied, skipping upgrade: frozenlist>=1.1.1 in /usr/local/lib/python3.8/dist-packages (from aiohttp->openai) (1.3.3) Requirement already satisfied, skipping upgrade: attrs>=17.3.0 in /usr/lib/python3/dist-packages (from aiohttp->openai) (19.3.0) Requirement already satisfied, skipping upgrade: async-timeout<5.0,>=4.0.0a3 in /usr/local/lib/python3.8/dist-packages (from aiohttp->openai) (4.0.2) Requirement already satisfied, skipping upgrade: aiosignal>=1.1.2 in /usr/local/lib/python3.8/dist-packages (from aiohttp->openai) (1.3.1) Requirement already satisfied, skipping upgrade: typing-extensions>=4.0.0 in /usr/local/lib/python3.8/dist-packages (from async-lru->nakuru-project-idk) (4.5.0) [2023-05-06 20:05:35.765] main.py (274) - [INFO] : host: localhost, port: 6700, http_port: 5700 [2023-05-06 20:05:35.766] main.py (275) - [CRITICAL] : 程序启动完成,如长时间未显示 "Protocol: connected" ,并且不回复消息,请检查config.py中的nakuru_config是否正确

RockChinQ commented 1 year ago

不清楚,但项目要求Python高于3.9

lhr96 commented 1 year ago

试过了 arm的机器用mirai还是gocqhttp都连不上 amd的机器就ok了

ShuJun-Junical commented 1 year ago

相同的问题,Python 版本 3.11.3,系统环境 macOS 13.3.1(a), Apple Silicon M1 Pro

同样是 go-cqhttp 运行正常,但程序不显示 Protocol: connected 且不回复消息

已经检查过了确认 go-cqhttp 运行正常且端口配置两边对应(http: 60101, ws: 60102),使用 lsof 检查过两个端口都有 go-cqhttp 的正常监听

所以 arm 架构的设备就是不行嘛

完整日志如下 ``` [2023-05-17 20:44:54.373] main.py (73) - [INFO] : 检查config模块完整性. [2023-05-17 20:44:54.374] main.py (101) - [INFO] : 检查tips模块完整性. 正在更新依赖库,请等待... 这个操作不是必须的,如果不想更新,请在config.py中将upgrade_dependencies设置为False WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip. Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue. To avoid this problem you can invoke Python with '-m pip' instead of running pip directly. [2023-05-17 20:44:54.528] _log.py (23) - [VERBOSE] : For variant 'global', will try loading '/Library/Application Support/pip/pip.conf' [2023-05-17 20:44:54.528] _log.py (23) - [VERBOSE] : For variant 'user', will try loading '/Users/junical/.pip/pip.conf' [2023-05-17 20:44:54.529] _log.py (23) - [VERBOSE] : For variant 'user', will try loading '/Users/junical/.config/pip/pip.conf' [2023-05-17 20:44:54.529] _log.py (23) - [VERBOSE] : For variant 'site', will try loading '/Users/junical/miniconda3/envs/HYChat/pip.conf' [2023-05-17 20:44:54.543] versioncontrol.py (225) - [DEBUG] : Registered VCS backend: bzr [2023-05-17 20:44:54.543] versioncontrol.py (225) - [DEBUG] : Registered VCS backend: git [2023-05-17 20:44:54.544] versioncontrol.py (225) - [DEBUG] : Registered VCS backend: hg [2023-05-17 20:44:54.544] versioncontrol.py (225) - [DEBUG] : Registered VCS backend: svn [2023-05-17 20:44:54.591] _log.py (23) - [VERBOSE] : For variant 'global', will try loading '/Library/Application Support/pip/pip.conf' [2023-05-17 20:44:54.591] _log.py (23) - [VERBOSE] : For variant 'user', will try loading '/Users/junical/.pip/pip.conf' [2023-05-17 20:44:54.592] _log.py (23) - [VERBOSE] : For variant 'user', will try loading '/Users/junical/.config/pip/pip.conf' [2023-05-17 20:44:54.592] _log.py (23) - [VERBOSE] : For variant 'site', will try loading '/Users/junical/miniconda3/envs/HYChat/pip.conf' Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple Requirement already satisfied: openai in /Users/junical/miniconda3/envs/HYChat/lib/python3.11/site-packages (0.27.6) Requirement already satisfied: Pillow in /Users/junical/miniconda3/envs/HYChat/lib/python3.11/site-packages (9.5.0) Requirement already satisfied: nakuru-project-idk in /Users/junical/miniconda3/envs/HYChat/lib/python3.11/site-packages (0.0.2.1) Requirement already satisfied: requests>=2.20 in /Users/junical/miniconda3/envs/HYChat/lib/python3.11/site-packages (from openai) (2.30.0) Requirement already satisfied: tqdm in /Users/junical/miniconda3/envs/HYChat/lib/python3.11/site-packages (from openai) (4.65.0) Requirement already satisfied: aiohttp in /Users/junical/miniconda3/envs/HYChat/lib/python3.11/site-packages (from openai) (3.8.4) Requirement already satisfied: async-lru in /Users/junical/miniconda3/envs/HYChat/lib/python3.11/site-packages (from nakuru-project-idk) (2.0.2) Requirement already satisfied: logbook in /Users/junical/miniconda3/envs/HYChat/lib/python3.11/site-packages (from nakuru-project-idk) (1.5.3) Requirement already satisfied: pydantic in /Users/junical/miniconda3/envs/HYChat/lib/python3.11/site-packages (from nakuru-project-idk) (1.10.7) Requirement already satisfied: charset-normalizer<4,>=2 in /Users/junical/miniconda3/envs/HYChat/lib/python3.11/site-packages (from requests>=2.20->openai) (3.1.0) Requirement already satisfied: idna<4,>=2.5 in /Users/junical/miniconda3/envs/HYChat/lib/python3.11/site-packages (from requests>=2.20->openai) (3.4) Requirement already satisfied: urllib3<3,>=1.21.1 in /Users/junical/miniconda3/envs/HYChat/lib/python3.11/site-packages (from requests>=2.20->openai) (2.0.2) Requirement already satisfied: certifi>=2017.4.17 in /Users/junical/miniconda3/envs/HYChat/lib/python3.11/site-packages (from requests>=2.20->openai) (2023.5.7) Requirement already satisfied: attrs>=17.3.0 in /Users/junical/miniconda3/envs/HYChat/lib/python3.11/site-packages (from aiohttp->openai) (23.1.0) Requirement already satisfied: multidict<7.0,>=4.5 in /Users/junical/miniconda3/envs/HYChat/lib/python3.11/site-packages (from aiohttp->openai) (6.0.4) Requirement already satisfied: async-timeout<5.0,>=4.0.0a3 in /Users/junical/miniconda3/envs/HYChat/lib/python3.11/site-packages (from aiohttp->openai) (4.0.2) Requirement already satisfied: yarl<2.0,>=1.0 in /Users/junical/miniconda3/envs/HYChat/lib/python3.11/site-packages (from aiohttp->openai) (1.9.2) Requirement already satisfied: frozenlist>=1.1.1 in /Users/junical/miniconda3/envs/HYChat/lib/python3.11/site-packages (from aiohttp->openai) (1.3.3) Requirement already satisfied: aiosignal>=1.1.2 in /Users/junical/miniconda3/envs/HYChat/lib/python3.11/site-packages (from aiohttp->openai) (1.3.1) Requirement already satisfied: typing-extensions>=4.0.0 in /Users/junical/miniconda3/envs/HYChat/lib/python3.11/site-packages (from async-lru->nakuru-project-idk) (4.5.0) [2023-05-17 20:44:56.200] dprompt.py (32) - [DEBUG] : prompts: {'default': [{'role': 'user', 'content': '如果我之后想获取帮助,请你说“输入!help获取帮助”'}, {'role': 'assistant', 'content': "ok, I'll follow your commands."}], 'default.json': [{'role': 'system', 'content': 'You are a helpful assistant. 如果我需要帮助,你要说“输入!help获得帮助”'}, {'role': 'assistant', 'content': '好的,我是一个能干的AI助手。 如果你需要帮助,我会说“输入!help获得帮助”'}]} [2023-05-17 20:44:56.200] aamgr.py (301) - [DEBUG] : walk: pkg.qqbot.cmds, path: ['/Users/junical/Code/HYChat/QChatGPT/pkg/qqbot/cmds'] [2023-05-17 20:44:56.201] aamgr.py (301) - [DEBUG] : walk: pkg.qqbot.cmds.funcs, path: ['/Users/junical/Code/HYChat/QChatGPT/pkg/qqbot/cmds/funcs'] [2023-05-17 20:44:56.201] aamgr.py (195) - [DEBUG] : cls: , name: draw, parent: None [2023-05-17 20:44:56.202] aamgr.py (301) - [DEBUG] : walk: pkg.qqbot.cmds.plugin, path: ['/Users/junical/Code/HYChat/QChatGPT/pkg/qqbot/cmds/plugin'] [2023-05-17 20:44:56.202] aamgr.py (195) - [DEBUG] : cls: , name: plugin, parent: None [2023-05-17 20:44:56.202] aamgr.py (195) - [DEBUG] : cls: , name: get, parent: [2023-05-17 20:44:56.202] aamgr.py (195) - [DEBUG] : cls: , name: update, parent: [2023-05-17 20:44:56.202] aamgr.py (195) - [DEBUG] : cls: , name: del, parent: [2023-05-17 20:44:56.202] aamgr.py (195) - [DEBUG] : cls: , name: off, parent: [2023-05-17 20:44:56.202] aamgr.py (195) - [DEBUG] : cls: , name: on, parent: [2023-05-17 20:44:56.203] aamgr.py (301) - [DEBUG] : walk: pkg.qqbot.cmds.session, path: ['/Users/junical/Code/HYChat/QChatGPT/pkg/qqbot/cmds/session'] [2023-05-17 20:44:56.203] aamgr.py (195) - [DEBUG] : cls: , name: default, parent: None [2023-05-17 20:44:56.203] aamgr.py (195) - [DEBUG] : cls: , name: set, parent: [2023-05-17 20:44:56.203] aamgr.py (195) - [DEBUG] : cls: , name: del, parent: None [2023-05-17 20:44:56.203] aamgr.py (195) - [DEBUG] : cls: , name: all, parent: [2023-05-17 20:44:56.204] aamgr.py (195) - [DEBUG] : cls: , name: delhst, parent: None [2023-05-17 20:44:56.204] aamgr.py (195) - [DEBUG] : cls: , name: all, parent: [2023-05-17 20:44:56.204] aamgr.py (195) - [DEBUG] : cls: , name: last, parent: None [2023-05-17 20:44:56.204] aamgr.py (195) - [DEBUG] : cls: , name: list, parent: None [2023-05-17 20:44:56.204] aamgr.py (195) - [DEBUG] : cls: , name: next, parent: None [2023-05-17 20:44:56.204] aamgr.py (195) - [DEBUG] : cls: , name: prompt, parent: None [2023-05-17 20:44:56.205] aamgr.py (195) - [DEBUG] : cls: , name: resend, parent: None [2023-05-17 20:44:56.205] aamgr.py (195) - [DEBUG] : cls: , name: reset, parent: None [2023-05-17 20:44:56.205] aamgr.py (301) - [DEBUG] : walk: pkg.qqbot.cmds.system, path: ['/Users/junical/Code/HYChat/QChatGPT/pkg/qqbot/cmds/system'] [2023-05-17 20:44:56.206] aamgr.py (195) - [DEBUG] : cls: , name: cfg, parent: None [2023-05-17 20:44:56.206] aamgr.py (195) - [DEBUG] : cls: , name: cmd, parent: None [2023-05-17 20:44:56.206] aamgr.py (195) - [DEBUG] : cls: , name: help, parent: None [2023-05-17 20:44:56.206] aamgr.py (195) - [DEBUG] : cls: , name: reload, parent: None [2023-05-17 20:44:56.206] aamgr.py (195) - [DEBUG] : cls: , name: update, parent: None [2023-05-17 20:44:56.207] aamgr.py (195) - [DEBUG] : cls: , name: usage, parent: None [2023-05-17 20:44:56.207] aamgr.py (195) - [DEBUG] : cls: , name: version, parent: None [2023-05-17 20:44:56.207] aamgr.py (316) - [DEBUG] : {'draw': {'description': '使用DALL·E生成图片', 'usage': '!draw <图片提示语>', 'aliases': [], 'privilege': 1, 'parent': None, 'cls': , 'sub': []}, 'plugin': {'description': '插件管理', 'usage': '!plugin\n!plugin get <插件仓库地址>\n!plugin update\n!plugin del <插件名>\n!plugin on <插件名>\n!plugin off <插件名>', 'aliases': [], 'privilege': 2, 'parent': None, 'cls': , 'sub': ['get', 'update', 'del', 'off', 'on']}, 'plugin.get': {'description': '安装插件', 'usage': '!plugin get <插件仓库地址>', 'aliases': [], 'privilege': 2, 'parent': 'plugin', 'cls': , 'sub': []}, 'plugin.update': {'description': '更新所有插件', 'usage': '!plugin update', 'aliases': [], 'privilege': 2, 'parent': 'plugin', 'cls': , 'sub': []}, 'plugin.del': {'description': '删除插件', 'usage': '!plugin del <插件名>', 'aliases': [], 'privilege': 2, 'parent': 'plugin', 'cls': , 'sub': []}, 'plugin.off': {'description': '禁用指定插件', 'usage': '!plugin off <插件名>', 'aliases': [], 'privilege': 2, 'parent': 'plugin', 'cls': , 'sub': []}, 'plugin.on': {'description': '启用指定插件', 'usage': '!plugin on <插件名>', 'aliases': [], 'privilege': 2, 'parent': 'plugin', 'cls': , 'sub': []}, 'default': {'description': '操作情景预设', 'usage': '!default\n!default set [指定情景预设为默认]', 'aliases': [], 'privilege': 1, 'parent': None, 'cls': , 'sub': ['set']}, 'default.set': {'description': '设置默认情景预设', 'usage': '!default set <情景预设名称>', 'aliases': [], 'privilege': 2, 'parent': 'default', 'cls': , 'sub': []}, 'del': {'description': '删除当前会话的历史记录', 'usage': '!del <序号>\n!del all', 'aliases': [], 'privilege': 1, 'parent': None, 'cls': , 'sub': ['all']}, 'del.all': {'description': '删除当前会话的全部历史记录', 'usage': '!del all', 'aliases': [], 'privilege': 1, 'parent': 'del', 'cls': , 'sub': []}, 'delhst': {'description': '删除指定会话的所有历史记录', 'usage': '!delhst <会话名称>\n!delhst all', 'aliases': [], 'privilege': 2, 'parent': None, 'cls': , 'sub': ['all']}, 'delhst.all': {'description': '删除所有会话的全部历史记录', 'usage': '!delhst all', 'aliases': [], 'privilege': 2, 'parent': 'delhst', 'cls': , 'sub': []}, 'last': {'description': '切换前一次对话', 'usage': '!last', 'aliases': [], 'privilege': 1, 'parent': None, 'cls': , 'sub': []}, 'list': {'description': '列出当前会话的所有历史记录', 'usage': '!list\n!list [页数]', 'aliases': [], 'privilege': 1, 'parent': None, 'cls': , 'sub': []}, 'next': {'description': '切换后一次对话', 'usage': '!next', 'aliases': [], 'privilege': 1, 'parent': None, 'cls': , 'sub': []}, 'prompt': {'description': '获取当前会话的前文', 'usage': '!prompt', 'aliases': [], 'privilege': 1, 'parent': None, 'cls': , 'sub': []}, 'resend': {'description': '重新获取上一次问题的回复', 'usage': '!resend', 'aliases': [], 'privilege': 1, 'parent': None, 'cls': , 'sub': []}, 'reset': {'description': '重置当前会话', 'usage': '!reset', 'aliases': [], 'privilege': 1, 'parent': None, 'cls': , 'sub': []}, 'cfg': {'description': '配置项管理', 'usage': '!cfg <配置项> [配置值]\n!cfg all', 'aliases': [], 'privilege': 2, 'parent': None, 'cls': , 'sub': []}, 'cmd': {'description': '显示指令列表', 'usage': '!cmd\n!cmd <指令名称>', 'aliases': [], 'privilege': 1, 'parent': None, 'cls': , 'sub': []}, 'help': {'description': '显示自定义的帮助信息', 'usage': '!help', 'aliases': [], 'privilege': 1, 'parent': None, 'cls': , 'sub': []}, 'reload': {'description': '执行热重载', 'usage': '!reload', 'aliases': [], 'privilege': 2, 'parent': None, 'cls': , 'sub': []}, 'update': {'description': '更新程序', 'usage': '!update', 'aliases': [], 'privilege': 2, 'parent': None, 'cls': , 'sub': []}, 'usage': {'description': '获取使用情况', 'usage': '!usage', 'aliases': [], 'privilege': 1, 'parent': None, 'cls': , 'sub': []}, 'version': {'description': '查看版本信息', 'usage': '!version', 'aliases': [], 'privilege': 1, 'parent': None, 'cls': , 'sub': []}} [2023-05-17 20:44:56.209] manager.py (38) - [DEBUG] : SQL: ("\n create table if not exists `sessions` (\n `id` INTEGER PRIMARY KEY AUTOINCREMENT,\n `name` varchar(255) not null,\n `type` varchar(255) not null,\n `number` bigint not null,\n `create_timestamp` bigint not null,\n `last_interact_timestamp` bigint not null,\n `status` varchar(255) not null default 'on_going',\n `default_prompt` text not null default '',\n `prompt` text not null,\n `token_counts` text not null default '[]'\n )\n ",) [2023-05-17 20:44:56.217] manager.py (38) - [DEBUG] : SQL: ("PRAGMA table_info('sessions')",) [2023-05-17 20:44:56.217] manager.py (38) - [DEBUG] : SQL: ('\n create table if not exists `account_fee`(\n `id` INTEGER PRIMARY KEY AUTOINCREMENT,\n `key_md5` varchar(255) not null,\n `timestamp` bigint not null,\n `fee` DECIMAL(12,6) not null\n )\n ',) [2023-05-17 20:44:56.217] manager.py (38) - [DEBUG] : SQL: ('\n create table if not exists `account_usage`(\n `id` INTEGER PRIMARY KEY AUTOINCREMENT,\n `json` text not null\n )\n ',) Database initialized. [2023-05-17 20:44:56.217] keymgr.py (61) - [INFO] : 使用api-key:default [2023-05-17 20:44:56.217] manager.py (38) - [DEBUG] : SQL: ('\n select `json` from `account_usage` order by id desc limit 1\n ',) [2023-05-17 20:44:56.218] manager.py (30) - [INFO] : 文字总使用量:0 [2023-05-17 20:44:56.218] manager.py (38) - [DEBUG] : SQL: ('\n select `name`, `type`, `number`, `create_timestamp`, `last_interact_timestamp`, `prompt`, `status`, `default_prompt`, `token_counts`\n from `sessions` where `last_interact_timestamp` > 1684326296\n ',) [2023-05-17 20:44:56.218] manager.py (118) - [INFO] : Use adapter:nakuru [2023-05-17 20:44:56.258] connectionpool.py (244) - [DEBUG] : Starting new HTTP connection (1): localhost:60101 [2023-05-17 20:44:56.259] connectionpool.py (546) - [DEBUG] : http://localhost:60101 "GET /get_login_info HTTP/1.1" 200 118 [2023-05-17 20:45:00.011] ratelimit.py (55) - [DEBUG] : 清空当前分钟的对话次数 [2023-05-17 20:45:08.264] main.py (274) - [INFO] : host: localhost, port: 60102, http_port: 60101 [2023-05-17 20:45:08.265] main.py (275) - [CRITICAL] : 程序启动完成,如长时间未显示 "Protocol: connected" ,并且不回复消息,请检查config.py中的nakuru_config是否正确 [2023-05-17 20:46:00.016] ratelimit.py (55) - [DEBUG] : 清空当前分钟的对话次数 [2023-05-17 20:47:00.022] ratelimit.py (55) - [DEBUG] : 清空当前分钟的对话次数 ```
RockChinQ commented 1 year ago

相同的问题,Python 版本 3.11.3,系统环境 macOS 13.3.1(a), Apple Silicon M1 Pro

同样是 go-cqhttp 运行正常,但程序不显示 Protocol: connected 且不回复消息

我必须使用非 arm 架构的设备来运行这个程序嘛

完整日志如下 ``` [2023-05-17 20:44:54.373] main.py (73) - [INFO] : 检查config模块完整性. [2023-05-17 20:44:54.374] main.py (101) - [INFO] : 检查tips模块完整性. 正在更新依赖库,请等待... 这个操作不是必须的,如果不想更新,请在config.py中将upgrade_dependencies设置为False WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip. Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue. To avoid this problem you can invoke Python with '-m pip' instead of running pip directly. [2023-05-17 20:44:54.528] _log.py (23) - [VERBOSE] : For variant 'global', will try loading '/Library/Application Support/pip/pip.conf' [2023-05-17 20:44:54.528] _log.py (23) - [VERBOSE] : For variant 'user', will try loading '/Users/junical/.pip/pip.conf' [2023-05-17 20:44:54.529] _log.py (23) - [VERBOSE] : For variant 'user', will try loading '/Users/junical/.config/pip/pip.conf' [2023-05-17 20:44:54.529] _log.py (23) - [VERBOSE] : For variant 'site', will try loading '/Users/junical/miniconda3/envs/HYChat/pip.conf' [2023-05-17 20:44:54.543] versioncontrol.py (225) - [DEBUG] : Registered VCS backend: bzr [2023-05-17 20:44:54.543] versioncontrol.py (225) - [DEBUG] : Registered VCS backend: git [2023-05-17 20:44:54.544] versioncontrol.py (225) - [DEBUG] : Registered VCS backend: hg [2023-05-17 20:44:54.544] versioncontrol.py (225) - [DEBUG] : Registered VCS backend: svn [2023-05-17 20:44:54.591] _log.py (23) - [VERBOSE] : For variant 'global', will try loading '/Library/Application Support/pip/pip.conf' [2023-05-17 20:44:54.591] _log.py (23) - [VERBOSE] : For variant 'user', will try loading '/Users/junical/.pip/pip.conf' [2023-05-17 20:44:54.592] _log.py (23) - [VERBOSE] : For variant 'user', will try loading '/Users/junical/.config/pip/pip.conf' [2023-05-17 20:44:54.592] _log.py (23) - [VERBOSE] : For variant 'site', will try loading '/Users/junical/miniconda3/envs/HYChat/pip.conf' Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple Requirement already satisfied: openai in /Users/junical/miniconda3/envs/HYChat/lib/python3.11/site-packages (0.27.6) Requirement already satisfied: Pillow in /Users/junical/miniconda3/envs/HYChat/lib/python3.11/site-packages (9.5.0) Requirement already satisfied: nakuru-project-idk in /Users/junical/miniconda3/envs/HYChat/lib/python3.11/site-packages (0.0.2.1) Requirement already satisfied: requests>=2.20 in /Users/junical/miniconda3/envs/HYChat/lib/python3.11/site-packages (from openai) (2.30.0) Requirement already satisfied: tqdm in /Users/junical/miniconda3/envs/HYChat/lib/python3.11/site-packages (from openai) (4.65.0) Requirement already satisfied: aiohttp in /Users/junical/miniconda3/envs/HYChat/lib/python3.11/site-packages (from openai) (3.8.4) Requirement already satisfied: async-lru in /Users/junical/miniconda3/envs/HYChat/lib/python3.11/site-packages (from nakuru-project-idk) (2.0.2) Requirement already satisfied: logbook in /Users/junical/miniconda3/envs/HYChat/lib/python3.11/site-packages (from nakuru-project-idk) (1.5.3) Requirement already satisfied: pydantic in /Users/junical/miniconda3/envs/HYChat/lib/python3.11/site-packages (from nakuru-project-idk) (1.10.7) Requirement already satisfied: charset-normalizer<4,>=2 in /Users/junical/miniconda3/envs/HYChat/lib/python3.11/site-packages (from requests>=2.20->openai) (3.1.0) Requirement already satisfied: idna<4,>=2.5 in /Users/junical/miniconda3/envs/HYChat/lib/python3.11/site-packages (from requests>=2.20->openai) (3.4) Requirement already satisfied: urllib3<3,>=1.21.1 in /Users/junical/miniconda3/envs/HYChat/lib/python3.11/site-packages (from requests>=2.20->openai) (2.0.2) Requirement already satisfied: certifi>=2017.4.17 in /Users/junical/miniconda3/envs/HYChat/lib/python3.11/site-packages (from requests>=2.20->openai) (2023.5.7) Requirement already satisfied: attrs>=17.3.0 in /Users/junical/miniconda3/envs/HYChat/lib/python3.11/site-packages (from aiohttp->openai) (23.1.0) Requirement already satisfied: multidict<7.0,>=4.5 in /Users/junical/miniconda3/envs/HYChat/lib/python3.11/site-packages (from aiohttp->openai) (6.0.4) Requirement already satisfied: async-timeout<5.0,>=4.0.0a3 in /Users/junical/miniconda3/envs/HYChat/lib/python3.11/site-packages (from aiohttp->openai) (4.0.2) Requirement already satisfied: yarl<2.0,>=1.0 in /Users/junical/miniconda3/envs/HYChat/lib/python3.11/site-packages (from aiohttp->openai) (1.9.2) Requirement already satisfied: frozenlist>=1.1.1 in /Users/junical/miniconda3/envs/HYChat/lib/python3.11/site-packages (from aiohttp->openai) (1.3.3) Requirement already satisfied: aiosignal>=1.1.2 in /Users/junical/miniconda3/envs/HYChat/lib/python3.11/site-packages (from aiohttp->openai) (1.3.1) Requirement already satisfied: typing-extensions>=4.0.0 in /Users/junical/miniconda3/envs/HYChat/lib/python3.11/site-packages (from async-lru->nakuru-project-idk) (4.5.0) [2023-05-17 20:44:56.200] dprompt.py (32) - [DEBUG] : prompts: {'default': [{'role': 'user', 'content': '如果我之后想获取帮助,请你说“输入!help获取帮助”'}, {'role': 'assistant', 'content': "ok, I'll follow your commands."}], 'default.json': [{'role': 'system', 'content': 'You are a helpful assistant. 如果我需要帮助,你要说“输入!help获得帮助”'}, {'role': 'assistant', 'content': '好的,我是一个能干的AI助手。 如果你需要帮助,我会说“输入!help获得帮助”'}]} [2023-05-17 20:44:56.200] aamgr.py (301) - [DEBUG] : walk: pkg.qqbot.cmds, path: ['/Users/junical/Code/HYChat/QChatGPT/pkg/qqbot/cmds'] [2023-05-17 20:44:56.201] aamgr.py (301) - [DEBUG] : walk: pkg.qqbot.cmds.funcs, path: ['/Users/junical/Code/HYChat/QChatGPT/pkg/qqbot/cmds/funcs'] [2023-05-17 20:44:56.201] aamgr.py (195) - [DEBUG] : cls: , name: draw, parent: None [2023-05-17 20:44:56.202] aamgr.py (301) - [DEBUG] : walk: pkg.qqbot.cmds.plugin, path: ['/Users/junical/Code/HYChat/QChatGPT/pkg/qqbot/cmds/plugin'] [2023-05-17 20:44:56.202] aamgr.py (195) - [DEBUG] : cls: , name: plugin, parent: None [2023-05-17 20:44:56.202] aamgr.py (195) - [DEBUG] : cls: , name: get, parent: [2023-05-17 20:44:56.202] aamgr.py (195) - [DEBUG] : cls: , name: update, parent: [2023-05-17 20:44:56.202] aamgr.py (195) - [DEBUG] : cls: , name: del, parent: [2023-05-17 20:44:56.202] aamgr.py (195) - [DEBUG] : cls: , name: off, parent: [2023-05-17 20:44:56.202] aamgr.py (195) - [DEBUG] : cls: , name: on, parent: [2023-05-17 20:44:56.203] aamgr.py (301) - [DEBUG] : walk: pkg.qqbot.cmds.session, path: ['/Users/junical/Code/HYChat/QChatGPT/pkg/qqbot/cmds/session'] [2023-05-17 20:44:56.203] aamgr.py (195) - [DEBUG] : cls: , name: default, parent: None [2023-05-17 20:44:56.203] aamgr.py (195) - [DEBUG] : cls: , name: set, parent: [2023-05-17 20:44:56.203] aamgr.py (195) - [DEBUG] : cls: , name: del, parent: None [2023-05-17 20:44:56.203] aamgr.py (195) - [DEBUG] : cls: , name: all, parent: [2023-05-17 20:44:56.204] aamgr.py (195) - [DEBUG] : cls: , name: delhst, parent: None [2023-05-17 20:44:56.204] aamgr.py (195) - [DEBUG] : cls: , name: all, parent: [2023-05-17 20:44:56.204] aamgr.py (195) - [DEBUG] : cls: , name: last, parent: None [2023-05-17 20:44:56.204] aamgr.py (195) - [DEBUG] : cls: , name: list, parent: None [2023-05-17 20:44:56.204] aamgr.py (195) - [DEBUG] : cls: , name: next, parent: None [2023-05-17 20:44:56.204] aamgr.py (195) - [DEBUG] : cls: , name: prompt, parent: None [2023-05-17 20:44:56.205] aamgr.py (195) - [DEBUG] : cls: , name: resend, parent: None [2023-05-17 20:44:56.205] aamgr.py (195) - [DEBUG] : cls: , name: reset, parent: None [2023-05-17 20:44:56.205] aamgr.py (301) - [DEBUG] : walk: pkg.qqbot.cmds.system, path: ['/Users/junical/Code/HYChat/QChatGPT/pkg/qqbot/cmds/system'] [2023-05-17 20:44:56.206] aamgr.py (195) - [DEBUG] : cls: , name: cfg, parent: None [2023-05-17 20:44:56.206] aamgr.py (195) - [DEBUG] : cls: , name: cmd, parent: None [2023-05-17 20:44:56.206] aamgr.py (195) - [DEBUG] : cls: , name: help, parent: None [2023-05-17 20:44:56.206] aamgr.py (195) - [DEBUG] : cls: , name: reload, parent: None [2023-05-17 20:44:56.206] aamgr.py (195) - [DEBUG] : cls: , name: update, parent: None [2023-05-17 20:44:56.207] aamgr.py (195) - [DEBUG] : cls: , name: usage, parent: None [2023-05-17 20:44:56.207] aamgr.py (195) - [DEBUG] : cls: , name: version, parent: None [2023-05-17 20:44:56.207] aamgr.py (316) - [DEBUG] : {'draw': {'description': '使用DALL·E生成图片', 'usage': '!draw <图片提示语>', 'aliases': [], 'privilege': 1, 'parent': None, 'cls': , 'sub': []}, 'plugin': {'description': '插件管理', 'usage': '!plugin\n!plugin get <插件仓库地址>\n!plugin update\n!plugin del <插件名>\n!plugin on <插件名>\n!plugin off <插件名>', 'aliases': [], 'privilege': 2, 'parent': None, 'cls': , 'sub': ['get', 'update', 'del', 'off', 'on']}, 'plugin.get': {'description': '安装插件', 'usage': '!plugin get <插件仓库地址>', 'aliases': [], 'privilege': 2, 'parent': 'plugin', 'cls': , 'sub': []}, 'plugin.update': {'description': '更新所有插件', 'usage': '!plugin update', 'aliases': [], 'privilege': 2, 'parent': 'plugin', 'cls': , 'sub': []}, 'plugin.del': {'description': '删除插件', 'usage': '!plugin del <插件名>', 'aliases': [], 'privilege': 2, 'parent': 'plugin', 'cls': , 'sub': []}, 'plugin.off': {'description': '禁用指定插件', 'usage': '!plugin off <插件名>', 'aliases': [], 'privilege': 2, 'parent': 'plugin', 'cls': , 'sub': []}, 'plugin.on': {'description': '启用指定插件', 'usage': '!plugin on <插件名>', 'aliases': [], 'privilege': 2, 'parent': 'plugin', 'cls': , 'sub': []}, 'default': {'description': '操作情景预设', 'usage': '!default\n!default set [指定情景预设为默认]', 'aliases': [], 'privilege': 1, 'parent': None, 'cls': , 'sub': ['set']}, 'default.set': {'description': '设置默认情景预设', 'usage': '!default set <情景预设名称>', 'aliases': [], 'privilege': 2, 'parent': 'default', 'cls': , 'sub': []}, 'del': {'description': '删除当前会话的历史记录', 'usage': '!del <序号>\n!del all', 'aliases': [], 'privilege': 1, 'parent': None, 'cls': , 'sub': ['all']}, 'del.all': {'description': '删除当前会话的全部历史记录', 'usage': '!del all', 'aliases': [], 'privilege': 1, 'parent': 'del', 'cls': , 'sub': []}, 'delhst': {'description': '删除指定会话的所有历史记录', 'usage': '!delhst <会话名称>\n!delhst all', 'aliases': [], 'privilege': 2, 'parent': None, 'cls': , 'sub': ['all']}, 'delhst.all': {'description': '删除所有会话的全部历史记录', 'usage': '!delhst all', 'aliases': [], 'privilege': 2, 'parent': 'delhst', 'cls': , 'sub': []}, 'last': {'description': '切换前一次对话', 'usage': '!last', 'aliases': [], 'privilege': 1, 'parent': None, 'cls': , 'sub': []}, 'list': {'description': '列出当前会话的所有历史记录', 'usage': '!list\n!list [页数]', 'aliases': [], 'privilege': 1, 'parent': None, 'cls': , 'sub': []}, 'next': {'description': '切换后一次对话', 'usage': '!next', 'aliases': [], 'privilege': 1, 'parent': None, 'cls': , 'sub': []}, 'prompt': {'description': '获取当前会话的前文', 'usage': '!prompt', 'aliases': [], 'privilege': 1, 'parent': None, 'cls': , 'sub': []}, 'resend': {'description': '重新获取上一次问题的回复', 'usage': '!resend', 'aliases': [], 'privilege': 1, 'parent': None, 'cls': , 'sub': []}, 'reset': {'description': '重置当前会话', 'usage': '!reset', 'aliases': [], 'privilege': 1, 'parent': None, 'cls': , 'sub': []}, 'cfg': {'description': '配置项管理', 'usage': '!cfg <配置项> [配置值]\n!cfg all', 'aliases': [], 'privilege': 2, 'parent': None, 'cls': , 'sub': []}, 'cmd': {'description': '显示指令列表', 'usage': '!cmd\n!cmd <指令名称>', 'aliases': [], 'privilege': 1, 'parent': None, 'cls': , 'sub': []}, 'help': {'description': '显示自定义的帮助信息', 'usage': '!help', 'aliases': [], 'privilege': 1, 'parent': None, 'cls': , 'sub': []}, 'reload': {'description': '执行热重载', 'usage': '!reload', 'aliases': [], 'privilege': 2, 'parent': None, 'cls': , 'sub': []}, 'update': {'description': '更新程序', 'usage': '!update', 'aliases': [], 'privilege': 2, 'parent': None, 'cls': , 'sub': []}, 'usage': {'description': '获取使用情况', 'usage': '!usage', 'aliases': [], 'privilege': 1, 'parent': None, 'cls': , 'sub': []}, 'version': {'description': '查看版本信息', 'usage': '!version', 'aliases': [], 'privilege': 1, 'parent': None, 'cls': , 'sub': []}} [2023-05-17 20:44:56.209] manager.py (38) - [DEBUG] : SQL: ("\n create table if not exists `sessions` (\n `id` INTEGER PRIMARY KEY AUTOINCREMENT,\n `name` varchar(255) not null,\n `type` varchar(255) not null,\n `number` bigint not null,\n `create_timestamp` bigint not null,\n `last_interact_timestamp` bigint not null,\n `status` varchar(255) not null default 'on_going',\n `default_prompt` text not null default '',\n `prompt` text not null,\n `token_counts` text not null default '[]'\n )\n ",) [2023-05-17 20:44:56.217] manager.py (38) - [DEBUG] : SQL: ("PRAGMA table_info('sessions')",) [2023-05-17 20:44:56.217] manager.py (38) - [DEBUG] : SQL: ('\n create table if not exists `account_fee`(\n `id` INTEGER PRIMARY KEY AUTOINCREMENT,\n `key_md5` varchar(255) not null,\n `timestamp` bigint not null,\n `fee` DECIMAL(12,6) not null\n )\n ',) [2023-05-17 20:44:56.217] manager.py (38) - [DEBUG] : SQL: ('\n create table if not exists `account_usage`(\n `id` INTEGER PRIMARY KEY AUTOINCREMENT,\n `json` text not null\n )\n ',) Database initialized. [2023-05-17 20:44:56.217] keymgr.py (61) - [INFO] : 使用api-key:default [2023-05-17 20:44:56.217] manager.py (38) - [DEBUG] : SQL: ('\n select `json` from `account_usage` order by id desc limit 1\n ',) [2023-05-17 20:44:56.218] manager.py (30) - [INFO] : 文字总使用量:0 [2023-05-17 20:44:56.218] manager.py (38) - [DEBUG] : SQL: ('\n select `name`, `type`, `number`, `create_timestamp`, `last_interact_timestamp`, `prompt`, `status`, `default_prompt`, `token_counts`\n from `sessions` where `last_interact_timestamp` > 1684326296\n ',) [2023-05-17 20:44:56.218] manager.py (118) - [INFO] : Use adapter:nakuru [2023-05-17 20:44:56.258] connectionpool.py (244) - [DEBUG] : Starting new HTTP connection (1): localhost:60101 [2023-05-17 20:44:56.259] connectionpool.py (546) - [DEBUG] : http://localhost:60101 "GET /get_login_info HTTP/1.1" 200 118 [2023-05-17 20:45:00.011] ratelimit.py (55) - [DEBUG] : 清空当前分钟的对话次数 [2023-05-17 20:45:08.264] main.py (274) - [INFO] : host: localhost, port: 60102, http_port: 60101 [2023-05-17 20:45:08.265] main.py (275) - [CRITICAL] : 程序启动完成,如长时间未显示 "Protocol: connected" ,并且不回复消息,请检查config.py中的nakuru_config是否正确 [2023-05-17 20:46:00.016] ratelimit.py (55) - [DEBUG] : 清空当前分钟的对话次数 [2023-05-17 20:47:00.022] ratelimit.py (55) - [DEBUG] : 清空当前分钟的对话次数 ```

贴上你gocq的配置文件以及主程序的config.py

ShuJun-Junical commented 1 year ago

相关配置如下,麻烦您看一下 @RockChinQ

go-cqhttp 配置 ``` yaml # go-cqhttp 默认配置文件 account: # 账号相关 uin: 1 # QQ账号 password: '' # 密码为空时使用扫码登录 encrypt: false # 是否开启密码加密 status: 0 # 在线状态 请参考 https://docs.go-cqhttp.org/guide/config.html#在线状态 relogin: # 重连设置 delay: 3 # 首次重连延迟, 单位秒 interval: 3 # 重连间隔 max-times: 0 # 最大重连次数, 0为无限制 # 是否使用服务器下发的新地址进行重连 # 注意, 此设置可能导致在海外服务器上连接情况更差 use-sso-address: true # 是否允许发送临时会话消息 allow-temp-session: false heartbeat: # 心跳频率, 单位秒 # -1 为关闭心跳 interval: 5 message: # 上报数据类型 # 可选: string,array post-format: string # 是否忽略无效的CQ码, 如果为假将原样发送 ignore-invalid-cqcode: false # 是否强制分片发送消息 # 分片发送将会带来更快的速度 # 但是兼容性会有些问题 force-fragment: false # 是否将url分片发送 fix-url: false # 下载图片等请求网络代理 proxy-rewrite: '' # 是否上报自身消息 report-self-message: false # 移除服务端的Reply附带的At remove-reply-at: false # 为Reply附加更多信息 extra-reply-data: false # 跳过 Mime 扫描, 忽略错误数据 skip-mime-scan: false # 是否自动转换 WebP 图片 convert-webp-image: false output: # 日志等级 trace,debug,info,warn,error log-level: warn # 日志时效 单位天. 超过这个时间之前的日志将会被自动删除. 设置为 0 表示永久保留. log-aging: 15 # 是否在每次启动时强制创建全新的文件储存日志. 为 false 的情况下将会在上次启动时创建的日志文件续写 log-force-new: true # 是否启用日志颜色 log-colorful: true # 是否启用 DEBUG debug: false # 开启调试模式 # 默认中间件锚点 default-middlewares: &default # 访问密钥, 强烈推荐在公网的服务器设置 access-token: '' # 事件过滤器文件目录 filter: '' # API限速设置 # 该设置为全局生效 # 原 cqhttp 虽然启用了 rate_limit 后缀, 但是基本没插件适配 # 目前该限速设置为令牌桶算法, 请参考: # https://baike.baidu.com/item/%E4%BB%A4%E7%89%8C%E6%A1%B6%E7%AE%97%E6%B3%95/6597000?fr=aladdin rate-limit: enabled: false # 是否启用限速 frequency: 1 # 令牌回复频率, 单位秒 bucket: 1 # 令牌桶大小 database: # 数据库相关设置 leveldb: # 是否启用内置leveldb数据库 # 启用将会增加10-20MB的内存占用和一定的磁盘空间 # 关闭将无法使用 撤回 回复 get_msg 等上下文相关功能 enable: true sqlite3: # 是否启用内置sqlite3数据库 # 启用将会增加一定的内存占用和一定的磁盘空间 # 关闭将无法使用 撤回 回复 get_msg 等上下文相关功能 enable: false cachettl: 3600000000000 # 1h # 连接服务列表 servers: # 添加方式,同一连接方式可添加多个,具体配置说明请查看文档 #- http: # http 通信 #- ws: # 正向 Websocket #- ws-reverse: # 反向 Websocket #- pprof: #性能分析服务器 - http: # HTTP 通信设置 address: 127.0.0.1:60101 # HTTP监听地址 version: 12 # OneBot协议版本, 支持 11/12(此处 11 和 12 我都试过,都不能用) timeout: 5 # 反向 HTTP 超时时间, 单位秒,<5 时将被忽略 long-polling: # 长轮询拓展 enabled: false # 是否开启 max-queue-size: 2000 # 消息队列大小,0 表示不限制队列大小,谨慎使用 middlewares: <<: *default # 引用默认中间件 post: # 反向HTTP POST地址列表 #- url: '' # 地址 # secret: '' # 密钥 # max-retries: 3 # 最大重试,0 时禁用 # retries-interval: 1500 # 重试时间,单位毫秒,0 时立即 #- url: http://127.0.0.1:5701/ # 地址 # secret: '' # 密钥 # max-retries: 10 # 最大重试,0 时禁用 # retries-interval: 1000 # 重试时间,单位毫秒,0 时立即 # 正向WS设置 - ws: # 正向WS服务器监听地址 address: 127.0.0.1:60102 middlewares: <<: *default # 引用默认中间件 ```
config.py 配置 ``` python # 配置文件: 注释里标[必需]的参数必须修改, 其他参数根据需要修改, 但请勿删除 import logging # 消息处理协议适配器 # 目前支持以下适配器: # - "yirimirai": mirai的通信框架,YiriMirai框架适配器, 请同时填写下方mirai_http_api_config # - "nakuru": go-cqhttp通信框架,请同时填写下方nakuru_config msg_source_adapter = "nakuru" # [必需(与nakuru二选一,取决于msg_source_adapter)] Mirai的配置 # 请到配置mirai的步骤中的教程查看每个字段的信息 # adapter: 选择适配器,目前支持HTTPAdapter和WebSocketAdapter # host: 运行mirai的主机地址 # port: 运行mirai的主机端口 # verifyKey: mirai-api-http的verifyKey # qq: 机器人的QQ号 # # 注意: QQ机器人配置不支持热重载及热更新 mirai_http_api_config = { "adapter": "WebSocketAdapter", "host": "localhost", "port": 8080, "verifyKey": "yirimirai", "qq": 1234567890 } # [必需(与mirai二选一,取决于msg_source_adapter)] # 使用nakuru-project框架连接go-cqhttp的配置 nakuru_config = { "host": "localhost", # go-cqhttp的地址 "port": 60102, # go-cqhttp的正向websocket端口 "http_port": 60101, # go-cqhttp的正向http端口 "token": "" # 若在go-cqhttp的config.yml设置了access_token, 则填写此处 } # [必需] OpenAI的配置 # api_key: OpenAI的API Key # http_proxy: 请求OpenAI时使用的代理,None为不使用,https和socks5暂不能使用 # 若只有一个api-key,请直接修改以下内容中的"openai_api_key"为你的api-key # # 如准备了多个api-key,可以以字典的形式填写,程序会自动选择可用的api-key # 例如 # openai_config = { # "api_key": { # "default": "sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", # "key1": "sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", # "key2": "sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", # }, # "http_proxy": "http://127.0.0.1:12345" # } # # 现已支持反向代理,可以添加reverse_proxy字段以使用反向代理 # 使用反向代理可以在国内使用OpenAI的API,反向代理的配置请参考 # https://github.com/Ice-Hazymoon/openai-scf-proxy # # 反向代理填写示例: # openai_config = { # "api_key": { # "default": "sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", # "key1": "sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", # "key2": "sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", # }, # "reverse_proxy": "http://example.com:12345/v1" # } openai_config = { "api_key": { "default": "openai_api_key" }, "http_proxy": None, "reverse_proxy": None } # [必需] 管理员QQ号,用于接收报错等通知及执行管理员级别指令 # 支持多个管理员,可以使用list形式设置,例如: # admin_qq = [12345678, 87654321] admin_qq = [2634221203] # 情景预设(机器人人格) # 每个会话的预设信息,影响所有会话,无视指令重置 # 可以通过这个字段指定某些情况的回复,可直接用自然语言描述指令 # 例如: # default_prompt = "如果我之后想获取帮助,请你说“输入!help获取帮助”" # 这样用户在不知所措的时候机器人就会提示其输入!help获取帮助 # 可参考 https://github.com/PlexPt/awesome-chatgpt-prompts-zh # # 如果需要多个情景预设,并在运行期间方便切换,请使用字典的形式填写,例如 # default_prompt = { # "default": "如果我之后想获取帮助,请你说“输入!help获取帮助”", # "linux-terminal": "我想让你充当 Linux 终端。我将输入命令,您将回复终端应显示的内容。", # "en-dict": "我想让你充当英英词典,对于给出的英文单词,你要给出其中文意思以及英文解释,并且给出一个例句,此外不要有其他反馈。", # } # # 在使用期间即可通过指令: # !reset [名称] # 来使用指定的情景预设重置会话 # 例如: # !reset linux-terminal # 若不指定名称,则使用默认情景预设 # # 也可以使用指令: # !default <名称> # 将指定的情景预设设置为默认情景预设 # 例如: # !default linux-terminal # 之后的会话重置时若不指定名称,则使用linux-terminal情景预设 # # 还可以加载文件中的预设文字,使用方法请查看:https://github.com/RockChinQ/QChatGPT/wiki/%E5%8A%9F%E8%83%BD%E4%BD%BF%E7%94%A8#%E9%A2%84%E8%AE%BE%E6%96%87%E5%AD%97 default_prompt = { "default": "如果我之后想获取帮助,请你说“输入!help获取帮助”", } # 情景预设格式 # 参考值:默认方式:normal | 完整情景:full_scenario # 默认方式 的格式为上述default_prompt中的内容,或prompts目录下的文件名 # 完整情景方式 的格式为JSON,在scenario目录下的JSON文件中列出对话的每个回合,编写方法见scenario/default-template.json # 编写方法请查看:https://github.com/RockChinQ/QChatGPT/wiki/%E5%8A%9F%E8%83%BD%E4%BD%BF%E7%94%A8#%E9%A2%84%E8%AE%BE%E6%96%87%E5%AD%97full_scenario%E6%A8%A1%E5%BC%8F preset_mode = "normal" # 群内响应规则 # 符合此消息的群内消息即使不包含at机器人也会响应 # 支持消息前缀匹配及正则表达式匹配 # 支持设置是否响应at消息、随机响应概率 # 注意:由消息前缀(prefix)匹配的消息中将会删除此前缀,正则表达式(regexp)匹配的消息不会删除匹配的部分 # 前缀匹配优先级高于正则表达式匹配 # 正则表达式简明教程:https://www.runoob.com/regexp/regexp-tutorial.html # # 支持针对不同群设置不同的响应规则,例如: # response_rules = { # "default": { # "at": True, # "prefix": ["/ai", "!ai", "!ai", "ai"], # "regexp": [], # "random_rate": 0.0, # }, # "12345678": { # "at": False, # "prefix": ["/ai", "!ai", "!ai", "ai"], # "regexp": [], # "random_rate": 0.0, # }, # } # # 以上设置将会在群号为12345678的群中关闭at响应 # 未单独设置的群将使用default规则 response_rules = { "default": { "at": True, # 是否响应at机器人的消息 "prefix": ["/ai", "!ai", "!ai", "ai"], "regexp": [], # "为什么.*", "怎么?样.*", "怎么.*", "如何.*", "[Hh]ow to.*", "[Ww]hy not.*", "[Ww]hat is.*", ".*怎么办", ".*咋办" "random_rate": 0.0, # 随机响应概率,0.0-1.0,0.0为不随机响应,1.0为响应所有消息, 仅在前几项判断不通过时生效 }, } # 消息忽略规则 # 适用于私聊及群聊 # 符合此规则的消息将不会被响应 # 支持消息前缀匹配及正则表达式匹配 # 此设置优先级高于response_rules # 用以过滤mirai等其他层级的指令 # @see https://github.com/RockChinQ/QChatGPT/issues/165 ignore_rules = { "prefix": ["/"], "regexp": [] } # 是否检查收到的消息中是否包含敏感词 # 若收到的消息无法通过下方指定的敏感词检查策略,则发送提示信息 income_msg_check = False # 敏感词过滤开关,以同样数量的*代替敏感词回复 # 请在sensitive.json中添加敏感词 sensitive_word_filter = True # 是否启用百度云内容安全审核 # 注册方式查看 https://cloud.baidu.com/doc/ANTIPORN/s/Wkhu9d5iy baidu_check = False # 百度云API_KEY 24位英文数字字符串 baidu_api_key = "" # 百度云SECRET_KEY 32位的英文数字字符串 baidu_secret_key = "" # 不合规消息自定义返回 inappropriate_message_tips = "[百度云]请珍惜机器人,当前返回内容不合规" # 启动时是否发送赞赏码 # 仅当使用量已经超过2048字时发送 encourage_sponsor_at_start = False # 每次向OpenAI接口发送对话记录上下文的字符数 # 最大不超过(4096 - max_tokens)个字符,max_tokens为下方completion_api_params中的max_tokens # 注意:较大的prompt_submit_length会导致OpenAI账户额度消耗更快 prompt_submit_length = 2048 # OpenAI补全API的参数 # 请在下方填写模型,程序自动选择接口 # 现已支持的模型有: # # 'gpt-4' # 'gpt-4-0314' # 'gpt-4-32k' # 'gpt-4-32k-0314' # 'gpt-3.5-turbo' # 'gpt-3.5-turbo-0301' # 'text-davinci-003' # 'text-davinci-002' # 'code-davinci-002' # 'code-cushman-001' # 'text-curie-001' # 'text-babbage-001' # 'text-ada-001' # # 具体请查看OpenAI的文档: https://beta.openai.com/docs/api-reference/completions/create # 请将内容修改到config.py中,请勿修改config-template.py completion_api_params = { "model": "gpt-3.5-turbo", "temperature": 0.9, # 数值越低得到的回答越理性,取值范围[0, 1] "top_p": 1, # 生成的文本的文本与要求的符合度, 取值范围[0, 1] "frequency_penalty": 0.2, "presence_penalty": 1.0, } # OpenAI的Image API的参数 # 具体请查看OpenAI的文档: https://beta.openai.com/docs/api-reference/images/create image_api_params = { "size": "256x256", # 图片尺寸,支持256x256, 512x512, 1024x1024 } # 群内回复消息时是否引用原消息 quote_origin = True # 回复绘图时是否包含图片描述 include_image_description = True # 消息处理的超时时间,单位为秒 process_message_timeout = 30 # 回复消息时是否显示[GPT]前缀 show_prefix = False # 应用长消息处理策略的阈值 # 当回复消息长度超过此值时,将使用长消息处理策略 blob_message_threshold = 256 # 长消息处理策略 # - "image": 将长消息转换为图片发送 # - "forward": 将长消息转换为转发消息组件发送 blob_message_strategy = "forward" # 允许等待 # 同一会话内,是否等待上一条消息处理完成后再处理下一条消息 # 若设置为False,若上一条未处理完时收到了新消息,将会丢弃新消息 # 丢弃消息时的提示信息可以在tips.py中修改 wait_last_done = True # 文字转图片时使用的字体文件路径 # 当策略为"image"时生效 # 若在Windows系统下,程序会自动使用Windows自带的微软雅黑字体 # 若未填写或不存在且不是Windows,将禁用文字转图片功能,改为使用转发消息组件 font_path = "" # 消息处理超时重试次数 retry_times = 3 # 消息处理出错时是否向用户隐藏错误详细信息 # 设置为True时,仅向管理员发送错误详细信息 # 设置为False时,向用户及管理员发送错误详细信息 hide_exce_info_to_user = True # 线程池相关配置 # 该参数决定机器人可以同时处理几个人的消息,超出线程池数量的请求会被阻塞,不会被丢弃 # 如果你不清楚该参数的意义,请不要更改 # 程序运行本身线程池,无代码层面修改请勿更改 sys_pool_num = 8 # 执行管理员请求和指令的线程池并行线程数量,一般和管理员数量相等 admin_pool_num = 4 # 执行用户请求和指令的线程池并行线程数量 # 如需要更高的并发,可以增大该值 user_pool_num = 8 # 每个会话的过期时间,单位为秒 # 默认值20分钟 session_expire_time = 1200 # 会话限速 # 单会话内每分钟可进行的对话次数 # 若不需要限速,可以设置为一个很大的值 # 默认值60次,基本上不会触发限速 # # 若要设置针对某特定群的限速,请使用如下格式: # { # "group_<群号>": 60, # "default": 60, # } # 若要设置针对某特定用户私聊的限速,请使用如下格式: # { # "person_<用户QQ>": 60, # "default": 60, # } # 同时设置多个群和私聊的限速,示例: # { # "group_12345678": 60, # "group_87654321": 60, # "person_234567890": 60, # "person_345678901": 60, # "default": 60, # } # # 注意: 未指定的都使用default的限速值,default不可删除 rate_limitation = { "default": 60, } # 会话限速策略 # - "wait": 每次对话获取到回复时,等待一定时间再发送回复,保证其不会超过限速均值 # - "drop": 此分钟内,若对话次数超过限速次数,则丢弃之后的对话,每自然分钟重置 rate_limit_strategy = "drop" # 是否在启动时进行依赖库更新 upgrade_dependencies = True # 是否上报统计信息 # 用于统计机器人的使用情况,不会收集任何用户信息 # 仅上报时间、字数使用量、绘图使用量,其他信息不会上报 report_usage = False # 日志级别 logging_level = logging.DEBUG ```
RockChinQ commented 1 year ago

可能是bug,晚些时候或明天下午分析一下,可以先尝试mirai

ShuJun-Junical commented 1 year ago

好的,感谢您的回复

RockChinQ commented 1 year ago

排查步骤

  1. go-cqhttp是否已经正常启动?
  2. go-cqhttp的config.yml中的http端口、ws端口是否与主程序config.py中的一致(详情查看config.py内说明)?
  3. 是否在go-cqhttp的config.yml中设置了access-token?如果设置了,是否在主程序config.py对应字段填写了正确的access_token
  4. 自行检查防火墙是否阻拦端口通信,尤其是go-cqhttp与主程序不在一台主机的情况,自行使用telnet等工具检查
RockChinQ commented 1 year ago

我这边测试程序无bug,Python 3.11环境下正常运行;目前没有任何证据表明ARM架构的机器不能运行,只要go-cqhttp、Python等基础软件支持的架构系统组合,理论上均可运行。