[Bug] Gewechat: host 回调地址异常 / 连接不上 Gewechat
发生了什么
1.host填写localhost或127.0.0.1,任务 gewechat没报异常,但是设置回调结果: {'ret': 500, 2.host填写localhost或127.0.0.1之外的地址(如局域网地址),回调地址和任务 gewechat均报异常 3.在回调地址host的地址前加上"http://",会显示设置回调结果: {'ret': 200, 'msg': '操作成功'},但是任务 gewechat 发生错误: [Errno -2] Name or service not known
如何复现?
1.用debian的docker容器先正常运行项目 2.在后台管理界面的配置的host一栏填写localhost或者127.0.0.1,任务 gewechat不报错但回调地址会出现500错误
AstrBot 版本与部署方式
v3.4.18
操作系统
Linux
额外信息
你愿意提交 PR 吗?
- [x] 是的,我愿意提交 PR!
Code of Conduct
- [x] 我已阅读并同意遵守该项目的 行为准则。
方便修改代码吗?把 astrbot/core/platform/sources/gewechat/client.py 这个文件的第197行改成
试一下,我人不在家,无法复现,这个遇到的人挺多的。
把 astrbot/core/platform/sources/gewechat/client.py 这个文件的第197行改成
试一下,我人不在家,无法复现,这个遇到的人挺多的。
太好了,可以设置成内网地址了,但回调依然是500报错
可以试一下这个方法:
在 gewe 的容器启动参数加上 --network container:<astrbot的容器名称>
然后host填写 localhost 即可
(我个人没测试过这个方法)
我之前也碰到回调一直不成功,后面我测试了一下全部使用容器bridge局域网IP,目前可以使用,仅供参考 使用场景:linux服务器,gewechat和astrbot均用docker部署,未设置网络联通
我之前也碰到回调一直不成功,后面我测试了一下全部使用容器bridge局域网IP,目前可以使用,仅供参考
感谢!
整理一下:
Gewechat 和 astrbot 的通信问题:
如果 astrbot 是 docker 部署,那么就是容器间的通信问题,参考 @Yiyoki 上面写的方法。
如果 astrbot 是 其他方式部署,那么就是宿主机和容器通信问题。base_url 填写 http://localhost:2531 (因为gewe容器已经做了映射),host 有以下几种方式: 通用方法:
- 填写宿主机 ip(局域网 ip或者公网地址)或者 Docker Bridge 网络网关 IP(请先在面板上更新 astrbot 到
928245cd0c50c5518c8d68358aa987ef686ef4be这一个commit)
对于 linux:
- 将gewechat 的网络模式设置为 host。即在启动参数加
--network=host
对于 Docker Desktop(Windows 和 macOS):
- 尝试host改成
host.docker.internal
借楼,设备不存在是什么情况😭😭😭。
[12:13:08| INFO] [client.py:59]: 获取到 Gewechat Token: 1e604047adaf47d9b5622412d56049d3
[12:13:08| INFO] [client.py:250]: 使用 APPID: wx_FodZRYUG7E6bvEa3dL84i, soulter
[12:13:08| ERROR] [core_lifecycle.py:99]: ------- 任务 gewechat 发生错误: 获取二维码失败: {'ret': 500, 'msg': '获取二维码失败', 'data': {'code': '-1', 'msg': '[wx_FodZRYUG7E6bvEa3dL84i]设备不存在'}}
[12:13:08| ERROR] [core_lifecycle.py:101]: | Traceback (most recent call last):
[12:13:08| ERROR] [core_lifecycle.py:101]: | File "/AstrBot/astrbot/core/core_lifecycle.py", line 94, in _task_wrapper
[12:13:08| ERROR] [core_lifecycle.py:101]: | await task
[12:13:08| ERROR] [core_lifecycle.py:101]: | File "/AstrBot/astrbot/core/platform/sources/gewechat/gewechat_platform_adapter.py", line 75, in _run
[12:13:08| ERROR] [core_lifecycle.py:101]: | await self.client.login()
[12:13:08| ERROR] [core_lifecycle.py:101]: | File "/AstrBot/astrbot/core/platform/sources/gewechat/client.py", line 260, in login
[12:13:08| ERROR] [core_lifecycle.py:101]: | raise Exception(f"获取二维码失败: {json_blob}")
[12:13:08| ERROR] [core_lifecycle.py:101]: | Exception: 获取二维码失败: {'ret': 500, 'msg': '获取二维码失败', 'data': {'code': '-1', 'msg': '[wx_FodZRYUG7E6bvEa3dL84i]设备不存在'}}
[12:13:08| ERROR] [core_lifecycle.py:101]: |
[12:13:08| ERROR] [core_lifecycle.py:102]: -------
借楼,设备不存在是什么情况😭😭😭。
[12:13:08| INFO] [client.py:59]: 获取到 Gewechat Token: 1e604047adaf47d9b5622412d56049d3 [12:13:08| INFO] [client.py:250]: 使用 APPID: wx_FodZRYUG7E6bvEa3dL84i, soulter [12:13:08| ERROR] [core_lifecycle.py:99]: ------- 任务 gewechat 发生错误: 获取二维码失败: {'ret': 500, 'msg': '获取二维码失败', 'data': {'code': '-1', 'msg': '[wx_FodZRYUG7E6bvEa3dL84i]设备不存在'}} [12:13:08| ERROR] [core_lifecycle.py:101]: | Traceback (most recent call last): [12:13:08| ERROR] [core_lifecycle.py:101]: | File "/AstrBot/astrbot/core/core_lifecycle.py", line 94, in _task_wrapper [12:13:08| ERROR] [core_lifecycle.py:101]: | await task [12:13:08| ERROR] [core_lifecycle.py:101]: | File "/AstrBot/astrbot/core/platform/sources/gewechat/gewechat_platform_adapter.py", line 75, in _run [12:13:08| ERROR] [core_lifecycle.py:101]: | await self.client.login() [12:13:08| ERROR] [core_lifecycle.py:101]: | File "/AstrBot/astrbot/core/platform/sources/gewechat/client.py", line 260, in login [12:13:08| ERROR] [core_lifecycle.py:101]: | raise Exception(f"获取二维码失败: {json_blob}") [12:13:08| ERROR] [core_lifecycle.py:101]: | Exception: 获取二维码失败: {'ret': 500, 'msg': '获取二维码失败', 'data': {'code': '-1', 'msg': '[wx_FodZRYUG7E6bvEa3dL84i]设备不存在'}} [12:13:08| ERROR] [core_lifecycle.py:101]: | [12:13:08| ERROR] [core_lifecycle.py:102]: -------
删除 data/shared_preferences.json 重新试试
我按照这样改之后变成这样了:
astrbot | [12:34:04| INFO] [client.py:30]: Gewechat API: http://172.17.0.1:2531/v2/api
astrbot | [12:34:04| INFO] [client.py:31]: Gewechat 下载 API: http://172.17.0.1:2532/download/
astrbot | [12:34:04| INFO] [core_lifecycle.py:106]: AstrBot 启动完成。
astrbot | [12:34:04| INFO] [event_bus.py:13]: 事件总线已打开。
astrbot | [2025-02-03 12:34:04 +0000] [1] [INFO] Running on http://0.0.0.0:6185 (CTRL + C to quit)
astrbot | [12:34:04| ERROR] [core_lifecycle.py:99]: ------- 任务 gewechat 发生错误: Server disconnected
astrbot | [12:34:04| ERROR] [core_lifecycle.py:101]: | Traceback (most recent call last):
astrbot | [12:34:04| ERROR] [core_lifecycle.py:101]: | File "/AstrBot/astrbot/core/core_lifecycle.py", line 94, in _task_wrapper
astrbot | [12:34:04| ERROR] [core_lifecycle.py:101]: | await task
astrbot | [12:34:04| ERROR] [core_lifecycle.py:101]: | File "/AstrBot/astrbot/core/platform/sources/gewechat/gewechat_platform_adapter.py", line 75, in _run
astrbot | [12:34:04| ERROR] [core_lifecycle.py:101]: | await self.client.login()
astrbot | [12:34:04| ERROR] [core_lifecycle.py:101]: | File "/AstrBot/astrbot/core/platform/sources/gewechat/client.py", line 235, in login
astrbot | [12:34:04| ERROR] [core_lifecycle.py:101]: | await self.get_token_id()
astrbot | [12:34:04| ERROR] [core_lifecycle.py:101]: | File "/AstrBot/astrbot/core/platform/sources/gewechat/client.py", line 56, in get_token_id
astrbot | [12:34:04| ERROR] [core_lifecycle.py:101]: | async with session.post(f"{self.base_url}/tools/getTokenId") as resp:
astrbot | [12:34:04| ERROR] [core_lifecycle.py:101]: | File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 1425, in __aenter__
astrbot | [12:34:04| ERROR] [core_lifecycle.py:101]: | self._resp: _RetType = await self._coro
astrbot | [12:34:04| ERROR] [core_lifecycle.py:101]: | File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 730, in _request
astrbot | [12:34:04| ERROR] [core_lifecycle.py:101]: | await resp.start(conn)
astrbot | [12:34:04| ERROR] [core_lifecycle.py:101]: | File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 1059, in start
astrbot | [12:34:04| ERROR] [core_lifecycle.py:101]: | message, payload = await protocol.read() # type: ignore[union-attr]
astrbot | [12:34:04| ERROR] [core_lifecycle.py:101]: | File "/usr/local/lib/python3.10/site-packages/aiohttp/streams.py", line 671, in read
astrbot | [12:34:04| ERROR] [core_lifecycle.py:101]: | await self._waiter
astrbot | [12:34:04| ERROR] [core_lifecycle.py:101]: | aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
astrbot | [12:34:04| ERROR] [core_lifecycle.py:101]: |
astrbot | [12:34:04| ERROR] [core_lifecycle.py:102]: -------
我之前也碰到回调一直不成功,后面我测试了一下全部使用容器bridge局域网IP,目前可以使用,仅供参考 使用场景:linux服务器,gewechat和astrbot均用docker部署,未设置网络联通
借楼,设备不存在是什么情况😭😭😭。
[12:13:08| INFO] [client.py:59]: 获取到 Gewechat Token: 1e604047adaf47d9b5622412d56049d3 [12:13:08| INFO] [client.py:250]: 使用 APPID: wx_FodZRYUG7E6bvEa3dL84i, soulter [12:13:08| ERROR] [core_lifecycle.py:99]: ------- 任务 gewechat 发生错误: 获取二维码失败: {'ret': 500, 'msg': '获取二维码失败', 'data': {'code': '-1', 'msg': '[wx_FodZRYUG7E6bvEa3dL84i]设备不存在'}} [12:13:08| ERROR] [core_lifecycle.py:101]: | Traceback (most recent call last): [12:13:08| ERROR] [core_lifecycle.py:101]: | File "/AstrBot/astrbot/core/core_lifecycle.py", line 94, in _task_wrapper [12:13:08| ERROR] [core_lifecycle.py:101]: | await task [12:13:08| ERROR] [core_lifecycle.py:101]: | File "/AstrBot/astrbot/core/platform/sources/gewechat/gewechat_platform_adapter.py", line 75, in _run [12:13:08| ERROR] [core_lifecycle.py:101]: | await self.client.login() [12:13:08| ERROR] [core_lifecycle.py:101]: | File "/AstrBot/astrbot/core/platform/sources/gewechat/client.py", line 260, in login [12:13:08| ERROR] [core_lifecycle.py:101]: | raise Exception(f"获取二维码失败: {json_blob}") [12:13:08| ERROR] [core_lifecycle.py:101]: | Exception: 获取二维码失败: {'ret': 500, 'msg': '获取二维码失败', 'data': {'code': '-1', 'msg': '[wx_FodZRYUG7E6bvEa3dL84i]设备不存在'}} [12:13:08| ERROR] [core_lifecycle.py:101]: | [12:13:08| ERROR] [core_lifecycle.py:102]: -------删除 data/shared_preferences.json 重新试试
sudo docker logs 看看gewechat容器的日志是否有报错。重启gewechat容器试试
finally.我搞定了,并且完全理解了这其中存在的问题。
我给出了另一种解法,受@Yiyoki的启发,我想让docker自己来解决这个容器通信的问题。
我修改了compose.yml:
services:
gewe:
image: gewe
container_name: gewe
volumes:
- ./gewechat/data:/root/temp
ports:
- "2531:2531"
- "2532:2532"
restart: always
networks:
- astrbot_network
astrbot:
image: soulter/astrbot:latest
container_name: astrbot
ports:
- "6180-6200:6180-6200"
- "11451:11451"
volumes:
- ./data:/AstrBot/data
- /var/run/docker.sock:/var/run/docker.sock
networks:
- astrbot_network
networks:
astrbot_network:
name: astrbot_network
driver: bridge
我给出了另一种解法,受的启发,我想让docker自己来解决这个容器通信的问题。 我修改了:
compose.ymlservices: gewe: image: gewe container_name: gewe volumes: - ./gewechat/data:/root/temp ports: - "2531:2531" - "2532:2532" restart: always networks: - astrbot_network astrbot: image: soulter/astrbot:latest container_name: astrbot ports: - "6180-6200:6180-6200" - "11451:11451" volumes: - ./data:/AstrBot/data - /var/run/docker.sock:/var/run/docker.sock networks: - astrbot_network networks: astrbot_network: name: astrbot_network driver: bridge
非常感谢你提供的解决方法!我用这个方法完美解决了我的问题👍
我尝试了host.docker.internal,但是不起作用
astrbot | [17:49:50| INFO] [updator.py:20]: 正在终止 0 个子进程。
astrbot | [17:49:50| DEBUG] [register.py:41]: 平台适配器 webchat 已注册
astrbot | [17:49:50| WARNING] [main.py:47]: 检测到管理面板有更新。可以使用 /dashboard_update 命令更新。
astrbot | [17:49:50| INFO] [main.py:73]:
astrbot | ___ ... . ______ .___________.
astrbot | / \ / | || _ \ | _ \ / __ \ | |
astrbot | / ^ \ | (-------| |----| |) | | |) | | | | | ---| |----
astrbot | / /\ \ \ \ | | | / | _ < | | | | | |
astrbot | / _____ \ .----) | | | | |\ ----.| |) | | --' | | | astrbot | /__/ \__\ |_______/ |__| | _| .||/ ____/ ||
astrbot |
astrbot |
astrbot | [17:49:50| INFO] [core_lifecycle.py:32]: AstrBot v3.4.18
astrbot | [17:49:50| INFO] [star_manager.py:170]: 正在载入插件 python_interpreter ...
astrbot | [17:49:50| INFO] [main.py:144]: 检查 Docker 可用性: Missing valid docker_host.Either DOCKER_HOST or local sockets are not available.
astrbot | [17:49:50| INFO] [main.py:116]: Docker 不可用,代码解释器将无法使用,astrbot-python-interpreter 将自动禁用。
astrbot | [17:49:50| INFO] [star_manager.py:170]: 正在载入插件 astrbot ...
astrbot | [17:49:50| INFO] [star_manager.py:170]: 正在载入插件 reminder ...
astrbot | [17:49:50| INFO] [star_manager.py:170]: 正在载入插件 web_searcher ...
astrbot | [17:49:50| WARNING] [manager.py:214]: 未启用任何用于 文本生成 的提供商适配器。
astrbot | [17:49:50| INFO] [manager.py:43]: 尝试实例化 gewechat(gwchat) 平台适配器 ...
astrbot | [17:49:50| INFO] [stage.py:26]: 分段回复间隔时间:[1.5, 3.5]
astrbot | [17:49:50| INFO] [server.py:71]:
astrbot | ✨✨✨
astrbot | AstrBot 管理面板已启动,可访问
astrbot |
astrbot | 1. http://172.18.0.2:6185
astrbot | 2. http://localhost:6185
astrbot |
astrbot | 默认用户名和密码是 astrbot。
astrbot | ✨✨✨
astrbot |
astrbot | [17:49:50| INFO] [client.py:30]: Gewechat API: http://host.docker.internal:2531/v2/api
astrbot | [17:49:50| INFO] [client.py:31]: Gewechat 下载 API: http://host.docker.internal:2532/download/
astrbot | [17:49:50| INFO] [core_lifecycle.py:105]: AstrBot 启动完成。
astrbot | [17:49:50| INFO] [event_bus.py:13]: 事件总线已打开。
astrbot | [2025-02-03 17:49:50 +0000] [1] [INFO] Running on http://0.0.0.0:6185 (CTRL + C to quit)
astrbot | [17:49:51| INFO] [client.py:59]: 获取到 Gewechat Token: fed29e5023cd429e897162f7e69cb4aa
astrbot | Google Search using proxy:
astrbot | [2025-02-03 17:49:51 +0000] [1] [INFO] 172.18.0.1:44580 GET /api/stat/start-time 1.1 200 64 1109
astrbot | [17:49:52| INFO] [client.py:266]: APPID: wx_AK78OQuHL2xHq_kd7SsLM
astrbot | [17:49:52| WARNING] [client.py:267]: 请打开该网址,然后使用微信扫描二维码登录: https://api.cl2wm.cn/api/qrcode/code?text=http://weixin.qq.com/x/QZQINP8mzefF9XqOzrYW
astrbot | [17:49:52| INFO] [client.py:284]: 检查登录状态: {'ret': 200, 'msg': '操作成功', 'data': {'uuid': 'QZQINP8mzefF9XqOzrYW', 'headImgUrl': None, 'nickName': None, 'expiredTime': 240, 'status': 0, 'loginInfo': None}}
astrbot | [17:49:52| INFO] [client.py:293]: 等待扫码...
astrbot | [2025-02-03 17:49:53 +0000] [1] [INFO] 172.18.0.1:44580 GET /config 1.1 200 756 10960
astrbot | [2025-02-03 17:49:53 +0000] [1] [INFO] 172.18.0.1:44588 GET /api/live-log 1.1 101 - 452
astrbot | [2025-02-03 17:49:53 +0000] [1] [INFO] 172.18.0.1:44598 GET /api/update/check 1.1 200 91 6723
astrbot | [2025-02-03 17:49:53 +0000] [1] [INFO] 172.18.0.1:44602 GET /api/stat/version 1.1 200 59 6997
astrbot | [2025-02-03 17:49:53 +0000] [1] [INFO] 172.18.0.1:44610 GET /api/stat/start-time 1.1 200 64 7196
astrbot | [2025-02-03 17:49:53 +0000] [1] [INFO] 172.18.0.1:44622 GET /api/config/get 1.1 200 28733 7406
astrbot | [2025-02-03 17:49:54 +0000] [1] [INFO] 172.18.0.1:44598 GET /assets/ConsolePage-6748dc2b.css 1.1 200 88 24112
astrbot | [2025-02-03 17:49:54 +0000] [1] [INFO] 172.18.0.1:44610 GET /assets/ConsoleDisplayer-a770f122.js 1.1 200 1470 24156
astrbot | [2025-02-03 17:49:54 +0000] [1] [INFO] 172.18.0.1:44622 GET /assets/ConsolePage-da509f95.js 1.1 200 2185 24610
astrbot | [17:49:54| WARNING] [update.py:47]: 检查更新失败: 解析版本信息失败 (不影响除项目更新外的正常使用)
astrbot | [2025-02-03 17:49:54 +0000] [1] [INFO] 172.18.0.1:44580 GET /api/update/check 1.1 200 92 1352480
astrbot | [17:49:57| INFO] [client.py:284]: 检查登录状态: {'ret': 200, 'msg': '操作成功', 'data': {'uuid': 'QZQINP8mzefF9XqOzrYW', 'headImgUrl': None, 'nickName': None, 'expiredTime': 235, 'status': 0, 'loginInfo': None}}
astrbot | [17:49:57| INFO] [client.py:293]: 等待扫码...
astrbot | [17:50:02| INFO] [client.py:284]: 检查登录状态: {'ret': 200, 'msg': '操作成功', 'data': {'uuid': 'QZQINP8mzefF9XqOzrYW', 'headImgUrl': None, 'nickName': None, 'expiredTime': 229, 'status': 0, 'loginInfo': None}}
astrbot | [17:50:02| INFO] [client.py:293]: 等待扫码...
astrbot | [17:50:07| INFO] [client.py:284]: 检查登录状态: {'ret': 200, 'msg': '操作成功', 'data': {'uuid': 'QZQINP8mzefF9XqOzrYW', 'headImgUrl': None, 'nickName': None, 'expiredTime': 224, 'status': 0, 'loginInfo': None}}
astrbot | [17:50:07| INFO] [client.py:293]: 等待扫码...
astrbot | [17:50:12| INFO] [client.py:284]: 检查登录状态: {'ret': 200, 'msg': '操作成功', 'data': {'uuid': 'QZQINP8mzefF9XqOzrYW', 'headImgUrl': None, 'nickName': None, 'expiredTime': 219, 'status': 0, 'loginInfo': None}}
astrbot | [17:50:12| INFO] [client.py:293]: 等待扫码...
astrbot | [17:50:17| INFO] [client.py:284]: 检查登录状态: {'ret': 200, 'msg': '操作成功', 'data': {'uuid': 'QZQINP8mzefF9XqOzrYW', 'headImgUrl': None, 'nickName': None, 'expiredTime': 214, 'status': 0, 'loginInfo': None}}
astrbot | [17:50:17| INFO] [client.py:293]: 等待扫码...
astrbot | [17:50:23| INFO] [client.py:284]: 检查登录状态: {'ret': 200, 'msg': '操作成功', 'data': {'uuid': 'QZQINP8mzefF9XqOzrYW', 'headImgUrl': None, 'nickName': None, 'expiredTime': 209, 'status': 0, 'loginInfo': None}}
astrbot | [17:50:23| INFO] [client.py:293]: 等待扫码...
...
astrbot | [17:50:45| INFO] [client.py:284]: 检查登录状态: {'ret': 200, 'msg': '操作成功', 'data': {'uuid': 'QZQINP8mzefF9XqOzrYW', 'headImgUrl': 'http://wx.qlogo.cn/mmhead/ver_1/DW6Ndeo8q7rKibbUympTZdN21keiciaUrFfhduOPsjHQEIvhTfFVDLoCEbrHluBmQyevCRKxbrm5G0fQkYhn76zyO33xEI1zsoJ0Cy6nQXMswumiaHA28lmjodp1I20qXEib5/0', 'nickName': '', 'expiredTime': 221, 'status': 2, 'loginInfo': {'uin': 15, 'wxid': 'wxid', 'nickName': 'I', 'mobile': '', 'alias': ''}}}
astrbot | [17:50:45| INFO] [client.py:290]: 绿泡泡平台登录成功:
astrbot | [17:50:45| INFO] [client.py:301]: 已保存 APPID: wx_
astrbot | [17:50:45| INFO] [client.py:177]: 设置回调,请等待...
astrbot | [17:50:45| ERROR] [core_lifecycle.py:98]: ------- 任务 gewechat 发生错误: [Errno 99] Cannot assign requested address
astrbot | [17:50:45| ERROR] [core_lifecycle.py:100]: | Traceback (most recent call last):
astrbot | [17:50:45| ERROR] [core_lifecycle.py:100]: | File "/AstrBot/astrbot/core/core_lifecycle.py", line 93, in _task_wrapper
astrbot | [17:50:45| ERROR] [core_lifecycle.py:100]: | await task
astrbot | [17:50:45| ERROR] [core_lifecycle.py:100]: | File "/AstrBot/astrbot/core/platform/sources/gewechat/gewechat_platform_adapter.py", line 77, in _run
astrbot | [17:50:45| ERROR] [core_lifecycle.py:100]: | await self.client.start_polling()
astrbot | [17:50:45| ERROR] [core_lifecycle.py:100]: | File "/AstrBot/astrbot/core/platform/sources/gewechat/client.py", line 196, in start_polling
astrbot | [17:50:45| ERROR] [core_lifecycle.py:100]: | await self.server.run_task(
astrbot | [17:50:45| ERROR] [core_lifecycle.py:100]: | File "/usr/local/lib/python3.10/site-packages/hypercorn/asyncio/init.py", line 44, in serve
astrbot | [17:50:45| ERROR] [core_lifecycle.py:100]: | await worker_serve(
astrbot | [17:50:45| ERROR] [core_lifecycle.py:100]: | File "/usr/local/lib/python3.10/site-packages/hypercorn/asyncio/run.py", line 91, in worker_serve
astrbot | [17:50:45| ERROR] [core_lifecycle.py:100]: | sockets = config.create_sockets()
astrbot | [17:50:45| ERROR] [core_lifecycle.py:100]: | File "/usr/local/lib/python3.10/site-packages/hypercorn/config.py", line 206, in create_sockets
astrbot | [17:50:45| ERROR] [core_lifecycle.py:100]: | insecure_sockets = self._create_sockets(self.bind)
astrbot | [17:50:45| ERROR] [core_lifecycle.py:100]: | File "/usr/local/lib/python3.10/site-packages/hypercorn/config.py", line 273, in _create_sockets
astrbot | [17:50:45| ERROR] [core_lifecycle.py:100]: | sock.bind(binding)
astrbot | [17:50:45| ERROR] [core_lifecycle.py:100]: | OSError: [Errno 99] Cannot assign requested address
astrbot | [17:50:45| ERROR] [core_lifecycle.py:100]: |
astrbot | [17:50:45| ERROR] [core_lifecycle.py:101]: -------
astrbot | [17:50:48| INFO] [client.py:189]: 设置回调结果: {'ret': 500, 'msg': 'http://host.docker.internal:11451/astrbot-gewechat/callback push msg err'}
astrbot | Exception in thread Thread-1 (run):
astrbot | Traceback (most recent call last):
astrbot | File "/usr/local/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
astrbot | self.run()
astrbot | File "/usr/local/lib/python3.10/threading.py", line 953, in run
astrbot | self._target(*self._args, **self._kwargs)
astrbot | File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
astrbot | return loop.run_until_complete(main)
astrbot | File "/usr/local/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
astrbot | return future.result()
astrbot | File "/AstrBot/astrbot/core/platform/sources/gewechat/client.py", line 191, in _set_callback_url
astrbot | raise Exception(f"设置回调失败: {json_blob}")
astrbot | Exception: 设置回调失败: {'ret': 500, 'msg': 'http://host.docker.internal:11451/astrbot-gewechat/callback push msg err'}
astrbot | [2025-02-03 17:50:50 +0000] [1] [INFO] 172.18.0.1:58400 GET /config 1.1 200 756 9176
astrbot | [2025-02-03 17:50:50 +0000] [1] [INFO] 172.18.0.1:58414 GET /api/live-log 1.1 101 - 461
astrbot | Task was destroyed but it is pending!
astrbot | task: <Task pending name='Task-144' coro=<Lifespan.handle_lifespan() done, defined at /usr/local/lib/python3.10/site-packages/hypercorn/asyncio/lifespan.py:42> wait_for=
我也尝试了修改compose.yml的方法,似乎gewe没有正常工作,控制台没有任何日志
我给出了另一种解法,受的启发,我想让docker自己来解决这个容器通信的问题。 我修改了:
compose.ymlservices: gewe: image: gewe container_name: gewe volumes: - ./gewechat/data:/root/temp ports: - "2531:2531" - "2532:2532" restart: always networks: - astrbot_network astrbot: image: soulter/astrbot:latest container_name: astrbot ports: - "6180-6200:6180-6200" - "11451:11451" volumes: - ./data:/AstrBot/data - /var/run/docker.sock:/var/run/docker.sock networks: - astrbot_network networks: astrbot_network: name: astrbot_network driver: bridge非常感谢你提供的解决方法!我用这个方法完美解决了我的问题👍
方法有效,建议close
有人只是单纯遇到这个无法获得二维码的问题吗?我看Gewechat那里也有很多人有类似的问题
[04:49:19| INFO] [client.py:30]: Gewechat API: http://10.60.13.17:2531/v2/api
[04:49:19| INFO] [client.py:31]: Gewechat 下载 API: http://10.60.13.17:2532/download/
[04:49:19| INFO] [core_lifecycle.py:105]: AstrBot 启动完成。
[04:49:19| INFO] [event_bus.py:13]: 事件总线已打开。
[2025-02-04 04:49:19 -0500] [1] [INFO] Running on http://0.0.0.0:6185 (CTRL + C to quit)
[04:49:19| INFO] [client.py:59]: 获取到 Gewechat Token: 2c81f2ee87e643cab3a65803b8aa375e
Google Search using proxy:
[2025-02-04 04:49:41 -0500] [1] [INFO] 10.60.13.102:4694 GET /api/plugin/get 1.1 200 728 1390
[2025-02-04 04:49:41 -0500] [1] [INFO] 10.60.13.102:4695 GET /api/plugin/market_list 1.1 200 4391 82157
[04:49:49| ERROR] [core_lifecycle.py:98]: ------- 任务 gewechat 发生错误: 获取二维码失败: {'ret': 500, 'msg': '创建设备失败'}
[04:49:49| ERROR] [core_lifecycle.py:100]: | Traceback (most recent call last):
[04:49:49| ERROR] [core_lifecycle.py:100]: | File "/AstrBot/astrbot/core/core_lifecycle.py", line 93, in _task_wrapper
[04:49:49| ERROR] [core_lifecycle.py:100]: | await task
[04:49:49| ERROR] [core_lifecycle.py:100]: | File "/AstrBot/astrbot/core/platform/sources/gewechat/gewechat_platform_adapter.py", line 75, in _run
[04:49:49| ERROR] [core_lifecycle.py:100]: | await self.client.login()
[04:49:49| ERROR] [core_lifecycle.py:100]: | File "/AstrBot/astrbot/core/platform/sources/gewechat/client.py", line 262, in login
[04:49:49| ERROR] [core_lifecycle.py:100]: | raise Exception(f"获取二维码失败: {json_blob}")
[04:49:49| ERROR] [core_lifecycle.py:100]: | Exception: 获取二维码失败: {'ret': 500, 'msg': '创建设备失败'}
[04:49:49| ERROR] [core_lifecycle.py:100]: |
[04:49:49| ERROR] [core_lifecycle.py:101]: -------
有人只是单纯遇到这个无法获得二维码的问题吗?我看Gewechat那里也有很多人有类似的问题
[04:49:19| INFO] [client.py:30]: Gewechat API: http://10.60.13.17:2531/v2/api [04:49:19| INFO] [client.py:31]: Gewechat 下载 API: http://10.60.13.17:2532/download/ [04:49:19| INFO] [core_lifecycle.py:105]: AstrBot 启动完成。 [04:49:19| INFO] [event_bus.py:13]: 事件总线已打开。 [2025-02-04 04:49:19 -0500] [1] [INFO] Running on http://0.0.0.0:6185 (CTRL + C to quit) [04:49:19| INFO] [client.py:59]: 获取到 Gewechat Token: 2c81f2ee87e643cab3a65803b8aa375e Google Search using proxy: [2025-02-04 04:49:41 -0500] [1] [INFO] 10.60.13.102:4694 GET /api/plugin/get 1.1 200 728 1390 [2025-02-04 04:49:41 -0500] [1] [INFO] 10.60.13.102:4695 GET /api/plugin/market_list 1.1 200 4391 82157 [04:49:49| ERROR] [core_lifecycle.py:98]: ------- 任务 gewechat 发生错误: 获取二维码失败: {'ret': 500, 'msg': '创建设备失败'} [04:49:49| ERROR] [core_lifecycle.py:100]: | Traceback (most recent call last): [04:49:49| ERROR] [core_lifecycle.py:100]: | File "/AstrBot/astrbot/core/core_lifecycle.py", line 93, in _task_wrapper [04:49:49| ERROR] [core_lifecycle.py:100]: | await task [04:49:49| ERROR] [core_lifecycle.py:100]: | File "/AstrBot/astrbot/core/platform/sources/gewechat/gewechat_platform_adapter.py", line 75, in _run [04:49:49| ERROR] [core_lifecycle.py:100]: | await self.client.login() [04:49:49| ERROR] [core_lifecycle.py:100]: | File "/AstrBot/astrbot/core/platform/sources/gewechat/client.py", line 262, in login [04:49:49| ERROR] [core_lifecycle.py:100]: | raise Exception(f"获取二维码失败: {json_blob}") [04:49:49| ERROR] [core_lifecycle.py:100]: | Exception: 获取二维码失败: {'ret': 500, 'msg': '创建设备失败'} [04:49:49| ERROR] [core_lifecycle.py:100]: | [04:49:49| ERROR] [core_lifecycle.py:101]: -------
macOS解决方法是把代理彻底关闭,应该是无法连接vx服务器的原因
有人只是单纯遇到这个无法获得二维码的问题吗?我看Gewechat那里也有很多人有类似的问题
[04:49:19| INFO] [client.py:30]: Gewechat API: http://10.60.13.17:2531/v2/api [04:49:19| INFO] [client.py:31]: Gewechat 下载 API: http://10.60.13.17:2532/download/ [04:49:19| INFO] [core_lifecycle.py:105]: AstrBot 启动完成。 [04:49:19| INFO] [event_bus.py:13]: 事件总线已打开。 [2025-02-04 04:49:19 -0500] [1] [INFO] Running on http://0.0.0.0:6185 (CTRL + C to quit) [04:49:19| INFO] [client.py:59]: 获取到 Gewechat Token: 2c81f2ee87e643cab3a65803b8aa375e Google Search using proxy: [2025-02-04 04:49:41 -0500] [1] [INFO] 10.60.13.102:4694 GET /api/plugin/get 1.1 200 728 1390 [2025-02-04 04:49:41 -0500] [1] [INFO] 10.60.13.102:4695 GET /api/plugin/market_list 1.1 200 4391 82157 [04:49:49| ERROR] [core_lifecycle.py:98]: ------- 任务 gewechat 发生错误: 获取二维码失败: {'ret': 500, 'msg': '创建设备失败'} [04:49:49| ERROR] [core_lifecycle.py:100]: | Traceback (most recent call last): [04:49:49| ERROR] [core_lifecycle.py:100]: | File "/AstrBot/astrbot/core/core_lifecycle.py", line 93, in _task_wrapper [04:49:49| ERROR] [core_lifecycle.py:100]: | await task [04:49:49| ERROR] [core_lifecycle.py:100]: | File "/AstrBot/astrbot/core/platform/sources/gewechat/gewechat_platform_adapter.py", line 75, in _run [04:49:49| ERROR] [core_lifecycle.py:100]: | await self.client.login() [04:49:49| ERROR] [core_lifecycle.py:100]: | File "/AstrBot/astrbot/core/platform/sources/gewechat/client.py", line 262, in login [04:49:49| ERROR] [core_lifecycle.py:100]: | raise Exception(f"获取二维码失败: {json_blob}") [04:49:49| ERROR] [core_lifecycle.py:100]: | Exception: 获取二维码失败: {'ret': 500, 'msg': '创建设备失败'} [04:49:49| ERROR] [core_lifecycle.py:100]: | [04:49:49| ERROR] [core_lifecycle.py:101]: -------macOS解决方法是把代理彻底关闭,应该是无法连接vx服务器的原因
我目前只是刚刚搭建好,没有开任何代理。我的部署环境是群晖的Docker
有人只是单纯遇到这个无法获得二维码的问题吗?我看Gewechat那里也有很多人有类似的问题
[04:49:19| INFO] [client.py:30]: Gewechat API: http://10.60.13.17:2531/v2/api [04:49:19| INFO] [client.py:31]: Gewechat 下载 API: http://10.60.13.17:2532/download/ [04:49:19| INFO] [core_lifecycle.py:105]: AstrBot 启动完成。 [04:49:19| INFO] [event_bus.py:13]: 事件总线已打开。 [2025-02-04 04:49:19 -0500] [1] [INFO] Running on http://0.0.0.0:6185 (CTRL + C to quit) [04:49:19| INFO] [client.py:59]: 获取到 Gewechat Token: 2c81f2ee87e643cab3a65803b8aa375e Google Search using proxy: [2025-02-04 04:49:41 -0500] [1] [INFO] 10.60.13.102:4694 GET /api/plugin/get 1.1 200 728 1390 [2025-02-04 04:49:41 -0500] [1] [INFO] 10.60.13.102:4695 GET /api/plugin/market_list 1.1 200 4391 82157 [04:49:49| ERROR] [core_lifecycle.py:98]: ------- 任务 gewechat 发生错误: 获取二维码失败: {'ret': 500, 'msg': '创建设备失败'} [04:49:49| ERROR] [core_lifecycle.py:100]: | Traceback (most recent call last): [04:49:49| ERROR] [core_lifecycle.py:100]: | File "/AstrBot/astrbot/core/core_lifecycle.py", line 93, in _task_wrapper [04:49:49| ERROR] [core_lifecycle.py:100]: | await task [04:49:49| ERROR] [core_lifecycle.py:100]: | File "/AstrBot/astrbot/core/platform/sources/gewechat/gewechat_platform_adapter.py", line 75, in _run [04:49:49| ERROR] [core_lifecycle.py:100]: | await self.client.login() [04:49:49| ERROR] [core_lifecycle.py:100]: | File "/AstrBot/astrbot/core/platform/sources/gewechat/client.py", line 262, in login [04:49:49| ERROR] [core_lifecycle.py:100]: | raise Exception(f"获取二维码失败: {json_blob}") [04:49:49| ERROR] [core_lifecycle.py:100]: | Exception: 获取二维码失败: {'ret': 500, 'msg': '创建设备失败'} [04:49:49| ERROR] [core_lifecycle.py:100]: | [04:49:49| ERROR] [core_lifecycle.py:101]: -------macOS解决方法是把代理彻底关闭,应该是无法连接vx服务器的原因
我目前只是刚刚搭建好,没有开任何代理。我的部署环境是群晖的Docker
删除 AstrBot/data/shared_preferences.json 试试
我给出了另一种解法,受@Yiyoki的启发,我想让docker自己来解决这个容器通信的问题。 我修改了
compose.yml:services: gewe: image: gewe container_name: gewe volumes: - ./gewechat/data:/root/temp ports: - "2531:2531" - "2532:2532" restart: always networks: - astrbot_network astrbot: image: soulter/astrbot:latest container_name: astrbot ports: - "6180-6200:6180-6200" - "11451:11451" volumes: - ./data:/AstrBot/data - /var/run/docker.sock:/var/run/docker.sock networks: - astrbot_network networks: astrbot_network: name: astrbot_network driver: bridge
环境是阿里云服务器,已开放2531端口 按照上方配置进行部署,我提示了如下错误
查看网络,两个容器都已经加入了网络 [ { "Name": "astrbot_network", "Id": "509bcfd210d1b156ea87007b5c02e4c5f339ed577d0d654de91f6fdf36be6aec", "Created": "2025-02-04T21:56:11.947306543+08:00", "Scope": "local", "Driver": "bridge", "EnableIPv6": false, "IPAM": { "Driver": "default", "Options": null, "Config": [ { "Subnet": "172.23.0.0/16", "Gateway": "172.23.0.1" } ] }, "Internal": false, "Attachable": false, "Ingress": false, "ConfigFrom": { "Network": "" }, "ConfigOnly": false, "Containers": { "a47d5537b6a708ebbc778957bdcd5d27b3920f07e0d3a606b237d24a0bad7306": { "Name": "gewe", "EndpointID": "ad994a77004349637816d09f324363558e71fc4feb6bf867802cdeed930e18dd", "MacAddress": "02:42:ac:17:00:03", "IPv4Address": "172.23.0.3/16", "IPv6Address": "" }, "f19c79e923f1a56b72d3317471ca10d4b9784a50c2539bed289e46dfc6537a6e": { "Name": "astrbot", "EndpointID": "1c5510d153dd975e84041c50ee163ab7591fb9b8c4c4ca45b7603882100fc880", "MacAddress": "02:42:ac:17:00:02", "IPv4Address": "172.23.0.2/16", "IPv6Address": "" } }, "Options": {}, "Labels": { "com.docker.compose.network": "astrbot_network", "com.docker.compose.project": "java", "com.docker.compose.version": "2.27.0" } } ]
将对应的网络地址修改为局域网地址、容器地址、公网地址均无法使用。请问佬们有什么头绪吗
有人只是单纯遇到这个无法获得二维码的问题吗?我看Gewechat那里也有很多人有类似的问题
[04:49:19| INFO] [client.py:30]: Gewechat API: http://10.60.13.17:2531/v2/api [04:49:19| INFO] [client.py:31]: Gewechat 下载 API: http://10.60.13.17:2532/download/ [04:49:19| INFO] [core_lifecycle.py:105]: AstrBot 启动完成。 [04:49:19| INFO] [event_bus.py:13]: 事件总线已打开。 [2025-02-04 04:49:19 -0500] [1] [INFO] Running on http://0.0.0.0:6185 (CTRL + C to quit) [04:49:19| INFO] [client.py:59]: 获取到 Gewechat Token: 2c81f2ee87e643cab3a65803b8aa375e Google Search using proxy: [2025-02-04 04:49:41 -0500] [1] [INFO] 10.60.13.102:4694 GET /api/plugin/get 1.1 200 728 1390 [2025-02-04 04:49:41 -0500] [1] [INFO] 10.60.13.102:4695 GET /api/plugin/market_list 1.1 200 4391 82157 [04:49:49| ERROR] [core_lifecycle.py:98]: ------- 任务 gewechat 发生错误: 获取二维码失败: {'ret': 500, 'msg': '创建设备失败'} [04:49:49| ERROR] [core_lifecycle.py:100]: | Traceback (most recent call last): [04:49:49| ERROR] [core_lifecycle.py:100]: | File "/AstrBot/astrbot/core/core_lifecycle.py", line 93, in _task_wrapper [04:49:49| ERROR] [core_lifecycle.py:100]: | await task [04:49:49| ERROR] [core_lifecycle.py:100]: | File "/AstrBot/astrbot/core/platform/sources/gewechat/gewechat_platform_adapter.py", line 75, in _run [04:49:49| ERROR] [core_lifecycle.py:100]: | await self.client.login() [04:49:49| ERROR] [core_lifecycle.py:100]: | File "/AstrBot/astrbot/core/platform/sources/gewechat/client.py", line 262, in login [04:49:49| ERROR] [core_lifecycle.py:100]: | raise Exception(f"获取二维码失败: {json_blob}") [04:49:49| ERROR] [core_lifecycle.py:100]: | Exception: 获取二维码失败: {'ret': 500, 'msg': '创建设备失败'} [04:49:49| ERROR] [core_lifecycle.py:100]: | [04:49:49| ERROR] [core_lifecycle.py:101]: -------macOS解决方法是把代理彻底关闭,应该是无法连接vx服务器的原因
我目前只是刚刚搭建好,没有开任何代理。我的部署环境是群晖的Docker
删除 AstrBot/data/shared_preferences.json 试试
我试了一下并不行,挠头...我再试试用别的服务器部署
有人只是单纯遇到这个无法获得二维码的问题吗?我看Gewechat那里也有很多人有类似的问题
[04:49:19| INFO] [client.py:30]: Gewechat API: http://10.60.13.17:2531/v2/api [04:49:19| INFO] [client.py:31]: Gewechat 下载 API: http://10.60.13.17:2532/download/ [04:49:19| INFO] [core_lifecycle.py:105]: AstrBot 启动完成。 [04:49:19| INFO] [event_bus.py:13]: 事件总线已打开。 [2025-02-04 04:49:19 -0500] [1] [INFO] Running on http://0.0.0.0:6185 (CTRL + C to quit) [04:49:19| INFO] [client.py:59]: 获取到 Gewechat Token: 2c81f2ee87e643cab3a65803b8aa375e Google Search using proxy: [2025-02-04 04:49:41 -0500] [1] [INFO] 10.60.13.102:4694 GET /api/plugin/get 1.1 200 728 1390 [2025-02-04 04:49:41 -0500] [1] [INFO] 10.60.13.102:4695 GET /api/plugin/market_list 1.1 200 4391 82157 [04:49:49| ERROR] [core_lifecycle.py:98]: ------- 任务 gewechat 发生错误: 获取二维码失败: {'ret': 500, 'msg': '创建设备失败'} [04:49:49| ERROR] [core_lifecycle.py:100]: | Traceback (most recent call last): [04:49:49| ERROR] [core_lifecycle.py:100]: | File "/AstrBot/astrbot/core/core_lifecycle.py", line 93, in _task_wrapper [04:49:49| ERROR] [core_lifecycle.py:100]: | await task [04:49:49| ERROR] [core_lifecycle.py:100]: | File "/AstrBot/astrbot/core/platform/sources/gewechat/gewechat_platform_adapter.py", line 75, in _run [04:49:49| ERROR] [core_lifecycle.py:100]: | await self.client.login() [04:49:49| ERROR] [core_lifecycle.py:100]: | File "/AstrBot/astrbot/core/platform/sources/gewechat/client.py", line 262, in login [04:49:49| ERROR] [core_lifecycle.py:100]: | raise Exception(f"获取二维码失败: {json_blob}") [04:49:49| ERROR] [core_lifecycle.py:100]: | Exception: 获取二维码失败: {'ret': 500, 'msg': '创建设备失败'} [04:49:49| ERROR] [core_lifecycle.py:100]: | [04:49:49| ERROR] [core_lifecycle.py:101]: -------macOS解决方法是把代理彻底关闭,应该是无法连接vx服务器的原因
我目前只是刚刚搭建好,没有开任何代理。我的部署环境是群晖的Docker
删除 AstrBot/data/shared_preferences.json 试试
我试了一下并不行,挠头...我再试试用别的服务器部署
试试先从手机微信上把平板退出登录,再启动docker。