lss233 / chatgpt-mirai-qq-bot

🚀 一键部署!真正的 AI 聊天机器人!支持ChatGPT、文心一言、讯飞星火、Bing、Bard、ChatGLM、POE,多账号,人设调教,虚拟女仆、图片渲染、语音发送 | 支持 QQ、Telegram、Discord、微信 等平台
GNU Affero General Public License v3.0
13.37k stars 1.57k forks source link

[BUG] 对接mirai时出现报错 #1378

Open Bio233 opened 1 day ago

Bio233 commented 1 day ago

提交 issue 前,请先确认:

表现
描述 BUG 的表现情况

运行环境:

复现步骤
描述你是如何触发这个 BUG 的 采用反向连接,mirai等待对接时启动gpt,gpt和mirai出现如下报错

预期行为
连接成功

截图

2024-11-23 15:35:42.349 | INFO | launart.manager:_launchable_task_done_callback:69 - [elizabeth.connection.3433779255.websocket_server_connection] completed. 2024-11-23 15:35:42.349 | INFO | graia.amnesia.builtins.aiohttp:launch:513 - starting server on 0.0.0.0:8554 2024-11-23 15:35:42.362 | SUCCESS | launart.manager:launch:385 - Layer #1:[http.server/aiohttp, cache.client/memcache, http.client/aiohttp] preparation completed. 2024-11-23 15:35:42.363 | INFO | platforms.ariadne_bot:start_background:192 - 尝试从 Mirai 服务中读取机器人 QQ 的 session key…… 2024-11-23 15:35:42.363 | INFO | platforms.ariadne_bot:start_background:194 - [提示] 当前为反向 ws 模式,请确保你的 mirai api http 设置了正确的 reverse-ws adapter 配置 2024-11-23 15:35:42.363 | INFO | platforms.ariadne_bot:start_background:195 - [提示] 配置不正确会导致 Mirai 端出现错误提示。 2024-11-23 15:35:42.363 | SUCCESS | launart.manager:launch:385 - Layer #3:[elizabeth.service] preparation completed. 2024-11-23 15:35:42.363 | INFO | launart.manager:launch:390 - All components prepared, start blocking phase. 2024-11-23 15:35:42.977 | INFO | main::52 - [Edge TTS] 读取成功! 2024-11-23 15:35:47.254 | ERROR | graia.amnesia.transport.rider:trigger_callbacks:37 - Host 'localhost:8554' cannot contain ':' (at position 9) Traceback (most recent call last):

File "C:\Users\Bio\Miniconda3\envs\chatgpt\lib\site-packages\graia\ariadne\connection\ws.py", line 142, in _ req: HttpRequest = await io.extra(HttpRequest) │ │ └ <class 'graia.amnesia.transport.common.http.extra.HttpRequest'> │ └ <function AiohttpServerWebsocketIO.extra at 0x000001E2417CB9A0> └ <graia.amnesia.builtins.aiohttp.AiohttpServerWebsocketIO object at 0x000001E26A560EB0>

File "C:\Users\Bio\Miniconda3\envs\chatgpt\lib\site-packages\graia\amnesia\builtins\aiohttp.py", line 386, in extra self.request.url, │ │ └ <aiohttp._helpers.reify object at 0x000001E241727490> │ └ <Request GET / > └ <graia.amnesia.builtins.aiohttp.AiohttpServerWebsocketIO object at 0x000001E26A560EB0>

File "aiohttp_helpers.pyx", line 26, in aiohttp._helpers.reify.get val = self.wrapped(inst)

File "C:\Users\Bio\Miniconda3\envs\chatgpt\lib\site-packages\aiohttp\web_request.py", line 437, in url url = URL.build(scheme=self.scheme, host=self.host) │ │ │ │ │ └ <aiohttp._helpers.reify object at 0x000001E2417279D0> │ │ │ │ └ <Request GET / > │ │ │ └ <aiohttp._helpers.reify object at 0x000001E241725540> │ │ └ <Request GET / > │ └ <classmethod(<function URL.build at 0x000001E24135EDD0>)> └ <class 'yarl.URL'>

File "C:\Users\Bio\Miniconda3\envs\chatgpt\lib\site-packages\yarl_url.py", line 387, in build _host = _encode_host(host, validate_host=True) │ └ 'localhost:8554' └ <functools._lru_cache_wrapper object at 0x000001E2413A1A60>

File "C:\Users\Bio\Miniconda3\envs\chatgpt\lib\site-packages\yarl_url.py", line 1476, in _encode_host raise ValueError(

ValueError: Host 'localhost:8554' cannot contain ':' (at position 9) 2024-11-23 15:35:47.260 | INFO | graia.ariadne.connection.ws:_:92 - Websocket connection closed 2024-11-23 15:35:47.261 | ERROR | graia.ariadne.util:loguru_exc_callback:76 - Exception: Traceback (most recent call last):

File "E:\TOOL\GPT_mirai\chatgpt-mirai-qq-bot\bot.py", line 58, in loop.run_until_complete(asyncio.gather(*bots)) │ │ │ │ └ [<Task pending name='Task-2' coro=<start_task() running at E:\TOOL\GPT_mirai\chatgpt-mirai-qq-bot\platforms\ariadne_bot.py:33... │ │ │ └ <function gather at 0x000001E24076B400> │ │ └ <module 'asyncio' from 'C:\Users\Bio\Miniconda3\envs\chatgpt\lib\asyncio\init.py'> │ └ <function BaseEventLoop.run_until_complete at 0x000001E24078C0D0> └

File "C:\Users\Bio\Miniconda3\envs\chatgpt\lib\asyncio\base_events.py", line 636, in run_until_complete self.run_forever() │ └ <function ProactorEventLoop.run_forever at 0x000001E24080A9E0> └

File "C:\Users\Bio\Miniconda3\envs\chatgpt\lib\asyncio\windows_events.py", line 321, in run_forever super().run_forever()

File "C:\Users\Bio\Miniconda3\envs\chatgpt\lib\asyncio\base_events.py", line 603, in run_forever self._run_once() │ └ <function BaseEventLoop._run_once at 0x000001E24078DB40> └

File "C:\Users\Bio\Miniconda3\envs\chatgpt\lib\asyncio\base_events.py", line 1909, in _run_once handle._run() │ └ <function Handle._run at 0x000001E23EF58EE0> └ <Handle Task.task_wakeup(<_GatheringFu...result=[None]>)>

File "C:\Users\Bio\Miniconda3\envs\chatgpt\lib\asyncio\events.py", line 80, in _run self._context.run(self._callback, *self._args) │ │ │ │ │ └ <member '_args' of 'Handle' objects> │ │ │ │ └ <Handle Task.task_wakeup(<_GatheringFu...result=[None]>)> │ │ │ └ <member '_callback' of 'Handle' objects> │ │ └ <Handle Task.task_wakeup(<_GatheringFu...result=[None]>)> │ └ <member '_context' of 'Handle' objects> └ <Handle Task.task_wakeup(<_GatheringFu...result=[None]>)>

File "C:\Users\Bio\Miniconda3\envs\chatgpt\lib\site-packages\aiohttp\web_protocol.py", line 433, in _handle_request resp = await request_handler(request) │ └ <Request GET / > └ <bound method Application._handle of <Application 0x1e26a441570>>

File "C:\Users\Bio\Miniconda3\envs\chatgpt\lib\site-packages\aiohttp\web_app.py", line 504, in _handle resp = await handler(request) │ └ <Request GET / > └ <bound method AiohttpRouter.handle_websocket_request of <graia.amnesia.builtins.aiohttp.AiohttpRouter object at 0x000001E26A4...

File "C:\Users\Bio\Miniconda3\envs\chatgpt\lib\site-packages\graia\amnesia\builtins\aiohttp.py", line 468, in handle_websocket_request await websocket_io.close() │ └ <function AiohttpServerWebsocketIO.close at 0x000001E2417CBC70> └ <graia.amnesia.builtins.aiohttp.AiohttpServerWebsocketIO object at 0x000001E26A560EB0>

File "C:\Users\Bio\Miniconda3\envs\chatgpt\lib\site-packages\graia\amnesia\builtins\aiohttp.py", line 411, in close await self.websocket.close() │ │ └ <function WebSocketResponse.close at 0x000001E2417AF6D0> │ └ └ <graia.amnesia.builtins.aiohttp.AiohttpServerWebsocketIO object at 0x000001E26A560EB0>

File "C:\Users\Bio\Miniconda3\envs\chatgpt\lib\site-packages\aiohttp\web_ws.py", line 337, in close raise RuntimeError("Call .prepare() first")

RuntimeError: Call .prepare() first ERROR:aiohttp.server:Error handling request

image

其他内容
此处填写其他内容,没有可跳过

Bio233 commented 1 day ago

提交 issue 前,请先确认:

  • [√] 我已看过 FAQ,此问题不在列表中
  • [√] 我已看过其他 issue,他们不能解决我的问题
  • [√] 我认为这不是 Mirai 或者 OpenAI 的 BUG

表现 描述 BUG 的表现情况

运行环境:

  • 操作系统:win11
  • Docker: ?
  • 项目版本:Windows-quickstart-mirai-refs.tags.v2.5.3

复现步骤 描述你是如何触发这个 BUG 的 采用反向连接,mirai等待对接时启动gpt,gpt和mirai出现如下报错

预期行为 连接成功

截图

image image image image

image

其他内容 此处填写其他内容,没有可跳过