Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Gewechat: host 回调地址异常 / 连接不上 Gewechat #327

Closed
2 tasks done
jmt059 opened this issue Feb 3, 2025 · 29 comments
Closed
2 tasks done

[Bug] Gewechat: host 回调地址异常 / 连接不上 Gewechat #327

jmt059 opened this issue Feb 3, 2025 · 29 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@jmt059
Copy link

jmt059 commented Feb 3, 2025

发生了什么

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

额外信息

Image

Image

Image

你愿意提交 PR 吗?

  • 是的,我愿意提交 PR!

Code of Conduct

@jmt059 jmt059 added the bug Something isn't working label Feb 3, 2025
@Soulter
Copy link
Owner

Soulter commented Feb 3, 2025

方便修改代码吗?把 astrbot/core/platform/sources/gewechat/client.py 这个文件的第197行改成

Image

试一下,我人不在家,无法复现,这个遇到的人挺多的。

@jmt059 jmt059 closed this as completed Feb 3, 2025
@jmt059
Copy link
Author

jmt059 commented Feb 3, 2025

把 astrbot/core/platform/sources/gewechat/client.py 这个文件的第197行改成

Image

试一下,我人不在家,无法复现,这个遇到的人挺多的。

Image
太好了,可以设置成内网地址了,但回调依然是500报错

@jmt059 jmt059 reopened this Feb 3, 2025
@Soulter
Copy link
Owner

Soulter commented Feb 3, 2025

可以试一下这个方法:
在 gewe 的容器启动参数加上 --network container:<astrbot的容器名称>

然后host填写 localhost 即可

(我个人没测试过这个方法)

@Yiyoki
Copy link

Yiyoki commented Feb 3, 2025

我之前也碰到回调一直不成功,后面我测试了一下全部使用容器bridge局域网IP,目前可以使用,仅供参考
使用场景:linux服务器,gewechat和astrbot均用docker部署,未设置网络联通

Image

@Soulter
Copy link
Owner

Soulter commented Feb 3, 2025

我之前也碰到回调一直不成功,后面我测试了一下全部使用容器bridge局域网IP,目前可以使用,仅供参考

Image

感谢!

整理一下:

Gewechat 和 astrbot 的通信问题:

如果 astrbot 是 docker 部署,那么就是容器间的通信问题,参考 @Yiyoki 上面写的方法。

如果 astrbot 是 其他方式部署,那么就是宿主机和容器通信问题。base_url 填写 http://localhost:2531
(因为gewe容器已经做了映射),host 有以下几种方式:
通用方法:

  1. 填写宿主机 ip(局域网 ip或者公网地址)或者 Docker Bridge 网络网关 IP(请先在面板上更新 astrbot 到 928245cd0c50c5518c8d68358aa987ef686ef4be 这一个commit

对于 linux:

  1. 将gewechat 的网络模式设置为 host。即在启动参数加 --network=host

对于 Docker Desktop(Windows 和 macOS):

  1. 尝试host改成 host.docker.internal

@ipc-robot
Copy link

借楼,设备不存在是什么情况😭😭😭。

 [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]: ------- 

@Soulter
Copy link
Owner

Soulter commented Feb 3, 2025

借楼,设备不存在是什么情况😭😭😭。

 [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 重新试试

@ipc-robot
Copy link

ipc-robot commented Feb 3, 2025

我按照这样改之后变成这样了:

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部署,未设置网络联通

Image

借楼,设备不存在是什么情况😭😭😭。

 [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容器试试

@Soulter Soulter changed the title [Bug]host回调地址异常 [Bug] gewechat: host 回调地址异常 Feb 3, 2025
@ipc-robot
Copy link

finally.我搞定了,并且完全理解了这其中存在的问题。

@ipc-robot
Copy link

Image

我给出了另一种解法,受@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

@jmt059
Copy link
Author

jmt059 commented Feb 3, 2025

Image

我给出了另一种解法,受的启发,我想让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

非常感谢你提供的解决方法!我用这个方法完美解决了我的问题👍

Image

@Soulter Soulter changed the title [Bug] gewechat: host 回调地址异常 [Bug] Gewechat: host 回调地址异常 Feb 3, 2025
@Soulter Soulter changed the title [Bug] Gewechat: host 回调地址异常 [Bug] Gewechat: host 回调地址异常 / 连接不上 Gewechat Feb 3, 2025
@Soulter Soulter pinned this issue Feb 3, 2025
@Soulter Soulter added the good first issue Good for newcomers label Feb 3, 2025
@C702462472
Copy link

我尝试了host.docker.internal,但是不起作用

Image

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=>
astrbot | [2025-02-03 17:50:50 +0000] [1] [INFO] 172.18.0.1:58428 GET /api/stat/start-time 1.1 200 64 5437
astrbot | [2025-02-03 17:50:50 +0000] [1] [INFO] 172.18.0.1:58438 GET /api/stat/version 1.1 200 59 5648
astrbot | [2025-02-03 17:50:50 +0000] [1] [INFO] 172.18.0.1:58450 GET /api/update/check 1.1 200 91 5821
astrbot | [2025-02-03 17:50:50 +0000] [1] [INFO] 172.18.0.1:58454 GET /api/config/get 1.1 200 28733 5985
astrbot | [17:50:52| WARNING] [update.py:47]: 检查更新失败: 解析版本信息失败 (不影响除项目更新外的正常使用)
astrbot | [2025-02-03 17:50:52 +0000] [1] [INFO] 172.18.0.1:58400 GET /api/update/check 1.1 200 92 1542462

我也尝试了修改compose.yml的方法,似乎gewe没有正常工作,控制台没有任何日志

@rzpmaster
Copy link

Image
我给出了另一种解法,受的启发,我想让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

非常感谢你提供的解决方法!我用这个方法完美解决了我的问题👍

Image

方法有效,建议close

@ChanLicher
Copy link

有人只是单纯遇到这个无法获得二维码的问题吗?我看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]: -------

@muxia23
Copy link

muxia23 commented Feb 4, 2025

有人只是单纯遇到这个无法获得二维码的问题吗?我看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服务器的原因

@ChanLicher
Copy link

有人只是单纯遇到这个无法获得二维码的问题吗?我看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

@Soulter
Copy link
Owner

Soulter commented Feb 4, 2025

有人只是单纯遇到这个无法获得二维码的问题吗?我看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 试试

@jmt059 jmt059 closed this as completed Feb 4, 2025
@qumingzhentmdnan
Copy link

Image

我给出了另一种解法,受@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端口
按照上方配置进行部署,我提示了如下错误

Image

Image

查看网络,两个容器都已经加入了网络
[
{
"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"
}
}
]

将对应的网络地址修改为局域网地址、容器地址、公网地址均无法使用。请问佬们有什么头绪吗

@ChanLicher
Copy link

有人只是单纯遇到这个无法获得二维码的问题吗?我看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 试试

我试了一下并不行,挠头...我再试试用别的服务器部署

@ipc-robot
Copy link

有人只是单纯遇到这个无法获得二维码的问题吗?我看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。

@ChanLicher
Copy link

有人只是单纯遇到这个无法获得二维码的问题吗?我看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。

我用的是小号,所以只有在手机上有登录,我目前解决的方法是在一个以CentOS为基础的云服务器部署,然后把gewechat和回调的ip都填写为该云服务器的ip,就可以正常工作了。上面的改docker compose里的网络的方法我也试过,不行。但现在还有点小问题,TTS总是失败,我开了一个issue和TTS失败有关。

@qumingzhentmdnan
Copy link

Image

我给出了另一种解法,受@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

直接使用这个配置文件,在云服务环境下我是运行不起来的,需要添加privileged: true这一个配置,添加这个后gewe会额外运行两个java文件,通过ps -ef | grep java可以看见,占用的内存会大幅度提高。

  • root 342816 233706 12 11:28 ? 00:00:01 /root/gewe/api/xd java -jar finder-admin.jar
  • root 344729 342816 91 11:28 ? 00:00:08 java -jar finder-admin.jar

两核两G的小机器是跑不动的,你不限制内存机器就会崩掉,我限制712M试试,虽然看起来运行成功了,但是你访问接口,如/login/getLoginQrCode,还是会一直卡主不通的,我用2核4g云服务器试一下就可以运行了。

services:
  gewe:
    image: gewe
    container_name: gewe
    volumes:
      - ./gewechat/data:/root/temp
    ports:
      - "2531:2531"
      - "2532:2532"
    restart: always
    privileged: true
    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

@lyuchenwang
Copy link

#343 按照此issue中给出的方法操作,可能解决了问题

@syuchua
Copy link

syuchua commented Feb 27, 2025

Image

我给出了另一种解法,受@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端口
按照上方配置进行部署,我提示了如下错误

Image

Image

查看网络,两个容器都已经加入了网络
[
{
"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"
}
}
]

将对应的网络地址修改为局域网地址、容器地址、公网地址均无法使用。请问佬们有什么头绪吗

一样的问题,佬解决了没

@ChanLicher
Copy link

Image
我给出了另一种解法,受@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端口
按照上方配置进行部署,我提示了如下错误
Image
Image
查看网络,两个容器都已经加入了网络
[
{
"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"
}
}
]
将对应的网络地址修改为局域网地址、容器地址、公网地址均无法使用。请问佬们有什么头绪吗

一样的问题,佬解决了没

我最后使用了和他类似的方法,还有我找到了一个别人Build的很小的gewechat镜像,以下是我的docker compose,如果你觉得有用的话,可以试试看。

services:
  gewechat:
    image: wuhuan123/gewechat:latest
    container_name: Gewechat
    restart: always
    privileged: true
    tty: true
    stdin_open: true
    networks:
      - astrbot_network
    ports:
      - "2531:2531"
      - "2532:2532"
    volumes:
      - /path/to/gewechat:/root/temp
    healthcheck:
      test: ["CMD", "nc", "-zv", "127.0.0.1", "2531"]
      interval: 10s
      retries: 5
      start_period: 10s
      timeout: 5s
  
  astrbot:
    image: soulter/astrbot:latest
    container_name: Astrbot
    restart: always
    networks:
      - astrbot_network
    ports:
      - "6180-6200:6180-6200"
      - "11451:11451"
    depends_on:
      gewechat:
        condition: service_healthy
    environment:
      - TZ=US/Eastern
    volumes:
      - /path/to/astrbot:/AstrBot/data
      - /var/run/docker.sock:/var/run/docker.sock

networks:
  astrbot_network:
    name: astrbot_network
    driver: bridge

@syuchua
Copy link

syuchua commented Mar 1, 2025

Image
我给出了另一种解法,受@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端口
按照上方配置进行部署,我提示了如下错误
Image
Image
查看网络,两个容器都已经加入了网络
[
{
"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"
}
}
]
将对应的网络地址修改为局域网地址、容器地址、公网地址均无法使用。请问佬们有什么头绪吗

一样的问题,佬解决了没

我最后使用了和他类似的方法,还有我找到了一个别人Build的很小的gewechat镜像,以下是我的docker compose,如果你觉得有用的话,可以试试看。

services:
  gewechat:
    image: wuhuan123/gewechat:latest
    container_name: Gewechat
    restart: always
    privileged: true
    tty: true
    stdin_open: true
    networks:
      - astrbot_network
    ports:
      - "2531:2531"
      - "2532:2532"
    volumes:
      - /path/to/gewechat:/root/temp
    healthcheck:
      test: ["CMD", "nc", "-zv", "127.0.0.1", "2531"]
      interval: 10s
      retries: 5
      start_period: 10s
      timeout: 5s
  
  astrbot:
    image: soulter/astrbot:latest
    container_name: Astrbot
    restart: always
    networks:
      - astrbot_network
    ports:
      - "6180-6200:6180-6200"
      - "11451:11451"
    depends_on:
      gewechat:
        condition: service_healthy
    environment:
      - TZ=US/Eastern
    volumes:
      - /path/to/astrbot:/AstrBot/data
      - /var/run/docker.sock:/var/run/docker.sock

networks:
  astrbot_network:
    name: astrbot_network
    driver: bridge

感谢,解决了

@Wayneless
Copy link

有人只是单纯遇到这个无法获得二维码的问题吗?我看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。

我用的是小号,所以只有在手机上有登录,我目前解决的方法是在一个以CentOS为基础的云服务器部署,然后把gewechat和回调的ip都填写为该云服务器的ip,就可以正常工作了。上面的改docker compose里的网络的方法我也试过,不行。但现在还有点小问题,TTS总是失败,我开了一个issue和TTS失败有关。

3-11同样问题,楼上方法都试过了,还是获取二维码失败

@HJHuangjie
Copy link

发生了什么

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

额外信息

Image

Image

Image

你愿意提交 PR 吗?

  • 是的,我愿意提交 PR!

Code of Conduct

发现另一个解决问题的方法
我是部署环境在Linux 服务器上的,一开始配置了容器内部的地址显示回调接口验证失败,见下图

Image

后面经测试发现其实不用 进入容器内部区获取 IpAddress 的地址的,
Host 参数 配置为你的AstrBot 部署的主机地址就可以,公网或私网任意一个即可,
注意:不需要带 http:// 前缀,直接填写 IP 地址即可

Image

回调成功:

Image

一句话总结就是,不用在进入容器内部获取 IP地址,Host -> 直接填写服务器的公网地址

@diqiuren888
Copy link

base_url 设置gewe的本地IP
host 设置astrbot的本地IP

看我图片,已经成功

Image
Image
Image
Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests