mikumifa / QChatGPT-Docker-Installer

QChatGPT的docker部署
131 stars 25 forks source link

在最后启动主程序容器的步骤出现错误,容器自动退出... 求救 #11

Closed narwhrl closed 1 year ago

narwhrl commented 1 year ago

我自己排查了很久也没找到问题,config.py只改了模板中的必要选项。 Mirai容器正常启动并运行,用docker logs看日志也是正常登录了的。 报错提示我捕捉到未知异常,所以我只能来提Issue了TAT 报错内容如下

[2023-02-09 15:32:04.122] host.py (60) - [INFO] : 加载插件
[2023-02-09 15:32:04.125] host.py (72) - [INFO] : 初始化插件
2023-02-09 15:32:04 - WARNING  未找到可用的 ASGI 服务,反向 WebSocket 和 WebHook 上报将不可用。
仅 HTTP 轮询与正向 WebSocket 可用。
建议安装 ASGI 服务器,如 `uvicorn` 或 `hypercorn`。
在命令行键入:
    pip install uvicorn
或者
    pip install hypercorn
WARNING: 未找到可用的 ASGI 服务,反向 WebSocket 和 WebHook 上报将不可用。
仅 HTTP 轮询与正向 WebSocket 可用。
建议安装 ASGI 服务器,如 `uvicorn` 或 `hypercorn`。
在命令行键入:
    pip install uvicorn
或者
    pip install hypercorn
[2023-02-09 15:32:04.128] bot.py (262) - [WARNING] : 未找到可用的 ASGI 服务,反向 WebSocket 和 WebHook 上报将不可用。
仅 HTTP 轮询与正向 WebSocket 可用。
建议安装 ASGI 服务器,如 `uvicorn` 或 `hypercorn`。
在命令行键入:
    pip install uvicorn
或者
    pip install hypercorn
2023-02-09 15:32:14 - ERROR    
ERROR: 
[2023-02-09 15:32:14.146] base.py (43) - [ERROR] : 
ERROR: 捕捉到未知异常:, 请前往 https://github.com/RockChinQ/QChatGPT/issues 查找或提issue
[2023-02-09 15:32:14.152] main.py (182) - [ERROR] : 捕捉到未知异常:, 请前往 https://github.com/RockChinQ/QChatGPT/issues 查找或提issue
Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/websockets/legacy/client.py", line 666, in __await_impl__
    await protocol.handshake(
  File "/usr/local/lib/python3.9/site-packages/websockets/legacy/client.py", line 332, in handshake
    raise InvalidStatusCode(status_code, response_headers)
websockets.exceptions.InvalidStatusCode: server rejected WebSocket connection: HTTP 404

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/websockets/legacy/client.py", line 680, in __await_impl__
    await protocol.wait_closed()
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/asyncio/tasks.py", line 490, in wait_for
    return fut.result()
asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/threading.py", line 980, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.9/threading.py", line 917, in run
    self._target(*self._args, **self._kwargs)
  File "/bot/main.py", line 185, in run_bot_wrapper
    raise e
  File "/bot/main.py", line 147, in run_bot_wrapper
    qqbot.bot.run()
  File "/usr/local/lib/python3.9/site-packages/mirai/bot.py", line 199, in run
    MiraiRunner(self).run(host, port, asgi_server, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/mirai/bot.py", line 276, in run
    asyncio.run(self._run())
  File "/usr/local/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.9/site-packages/mirai/bot.py", line 240, in _run
    await self.startup()
  File "/usr/local/lib/python3.9/site-packages/mirai/bot.py", line 228, in startup
    await asyncio.gather(*coros)
  File "/usr/local/lib/python3.9/site-packages/mirai/bot.py", line 137, in startup
    await self._adapter.login(self.qq)
  File "/usr/local/lib/python3.9/site-packages/mirai/adapters/base.py", line 35, in wrapped
    return await func(self, *args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/mirai/adapters/websocket.py", line 187, in login
    self.connection = await connect(self.host_name, extra_headers=headers)
  File "/usr/local/lib/python3.9/site-packages/websockets/legacy/client.py", line 659, in __await_impl_timeout__
    return await asyncio.wait_for(self.__await_impl__(), self.open_timeout)
  File "/usr/local/lib/python3.9/asyncio/tasks.py", line 492, in wait_for
    raise exceptions.TimeoutError() from exc
asyncio.exceptions.TimeoutError
tdiabtd commented 1 year ago

报错提示websockets.exceptions.InvalidStatusCode: server rejected WebSocket connection: HTTP 404 看样子是websocket连接qqbot失败了,我也遇到了类似的问题,把我的解决方案告诉你

可以尝试查看一下mirai启动配置中使用的adapters的配置,路径在: mirai/config/net.mamoe.mirai-api-http/setting.yml 查看adapters选项,如果是http的话,可以修改一下主程序的adapters配置, 路径在: bot/config.py mirai_http_api_config中的adapter选项,修改为HTTPAdapter 再重新执行 docker compose run -itd setup

mikumifa commented 1 year ago

RockChinQ/QChatGPT#127