AstrBot icon indicating copy to clipboard operation
AstrBot copied to clipboard

[Bug] 企业微信收到了消息,但没有回复

Open pyao12 opened this issue 8 months ago • 3 comments

What happened / 发生了什么

我创建了一个企业微信机器人并按照文档的方法对接了astrbot。有提示:

[2026-03-07 08:00:13.488] [Core] [INFO] [wecom_ai_bot.wecomai_server:90]: 收到企业微信智能机器人 WebHook URL 验证请求。
[2026-03-07 08:00:13.488] [Core] [INFO] [wecom_ai_bot.wecomai_api:144]: URL 验证成功

我在群里@它,astrbot收到了消息:

[2026-03-07 08:02:06.053] [Core] [INFO] [core.event_bus:61]: [default] [wecom_ai_bot(wecom_ai_bot)] YaoYuChen/YaoYuChen: 你是谁啊 
[2026-03-07 08:02:07.501] [Core] [INFO] [respond.stage:184]: Prepare to send - YaoYuChen/YaoYuChen: 你好!我是你的人工智能助手,擅长中英文对话,可以帮你解答问题、提供信息和进行日常对话。有什么可以帮你的吗?

但是没有回复。

Reproduce / 如何复现?

  1. 正常配置astrbot和企业微信bot
  2. at机器人发一条消息
  3. 挂了……

AstrBot version, deployment method (e.g., Windows Docker Desktop deployment), provider used, and messaging platform used. / AstrBot 版本、部署方式(如 Windows Docker Desktop 部署)、使用的提供商、使用的消息平台适配器

4.19.2 Docker Compose(1panel)

OS

Linux

Logs / 报错日志

[2026-03-07 08:11:47.513] [Core] [INFO] [platform.manager:125]: 载入 wecom_ai_bot(wecom_ai_bot) 平台适配器 ...
[2026-03-07 08:11:47.515] [Core] [INFO] [utils.webhook_utils:66]: 
====================
🔗 机器人平台 wecom_ai_bot(企业微信智能机器人) 已启用统一 Webhook 模式
📍 Webhook 回调地址: 
   ➜  http://<your-ip>:6185/api/platform/webhook/06cb916235244057
   ➜  http(s)://<your-astrbot-domain>/api/platform/webhook/06cb916235244057
====================
[2026-03-07 08:12:30.938] [Core] [INFO] [core.event_bus:61]: [default] [wecom_ai_bot(wecom_ai_bot)] YaoYuChen/YaoYuChen: 在吗 
[2026-03-07 08:12:42.926] [Core] [INFO] [respond.stage:184]: Prepare to send - YaoYuChen/YaoYuChen: 在的!我是你的人工智能助手,随时为你服务。有什么我可以帮你的吗?

Are you willing to submit a PR? / 你愿意提交 PR 吗?

  • [ ] Yes!

Code of Conduct

pyao12 avatar Mar 07 '26 00:03 pyao12

Hi @pyao12! I'm Dosu and I’m helping the AstrBot team.

这是一个已知问题,最可能的原因是企业微信后台的企业可信IP白名单未正确配置。

解决方案:

  1. 登录企业微信管理后台,找到"企业可信IP"配置
  2. 将Docker容器所在服务器的公网出站IP添加到白名单
  3. 注意: 如果服务器入站IP和出站IP不同(Docker环境常见),两个IP都需要添加

如何获取出站IP: 在服务器上执行 curl ifconfig.me 或 curl ip.sb

如果问题仍然存在,可以:

  • 查看完整日志 docker logs -f <container_name> 检查是否有隐藏的错误
  • 尝试回退到 v4.14 或 v4.13.0 版本排除已知的 stream_id bug

To reply, just mention @dosu.


Docs are dead. Just use Dosu.

Leave Feedback Ask Dosu about AstrBot Share Dosu with your team

dosubot[bot] avatar Mar 07 '26 00:03 dosubot[bot]

你好 解决了么?今天遇到了同样的问题 长连接可以 webhook收不到消息 日志也没有报错

[2026-05-21 17:50:26.155] [Core] [INFO] [utils.webhook_utils:66]:

🔗 机器人平台 AI信息部小助理(企业微信智能机器人) 已启用统一 Webhook 模式 📍 Webhook 回调地址: ➜ http://:6185/api/platform/webhook/59f55b2 ➜ http(s):///api/platform/webhook/59f

[2026-05-21 17:55:58.281] [Core] [INFO] [wecom_ai_bot.wecomai_server:90]: 收到企业微信智能机器人 WebHook URL 验证请求。 [2026-05-21 17:55:58.282] [Core] [INFO] [wecom_ai_bot.wecomai_api:144]: URL 验证成功 [2026-05-21 17:55:58.380] [Core] [INFO] [wecom_ai_bot.wecomai_server:90]: 收到企业微信智能机器人 WebHook URL 验证请求。 [2026-05-21 17:55:58.380] [Core] [INFO] [wecom_ai_bot.wecomai_api:144]: URL 验证成功 [2026-05-21 17:56:26.905] [Core] [INFO] [core.event_bus:61]: [AI信息部小助理] [AI信息部小助理(wecom_ai_bot)] wo4UQ6DAAA9YNKk3KULOzhFwxEC2XZsw/wo4UQ6DAAA9YNKk3KULOzhFwxEC2XZsw: /new [2026-05-21 17:56:26.917] [Core] [INFO] [respond.stage:183]: Prepare to send - wo4UQ6DAAA9YNKk3KULOzhFwxEC2XZsw/wo4UQ6DAAA9YNKk3KULOzhFwxEC2XZsw: ✅ Switched to new conversation: 82d8。

MegawattJ avatar May 21 '26 10:05 MegawattJ

从日志来看,AstrBot 已经正常接收消息并生成回复,问题可能出在企业微信的消息发送或流式响应环节。 这个情况和 #5401 比较接近,后续版本也对企业微信的流式消息处理做过一些改进,不过还不能确定是否完全解决了这里的问题。 考虑到 #5401 仍然开放,建议将后续排查统一集中到那里。如果最新版本仍能复现,欢迎在 #5401 补充日志和相关配置。 这里就先作为相关问题关闭,感谢反馈! From the logs, AstrBot received the messages and generated responses successfully, so the issue may be related to WeCom's message delivery or streaming response handling. This looks closely related to #5401. There have also been some improvements to WeCom streaming in newer versions, although it's unclear whether they fully resolve this issue. Since #5401 is still open, let's keep further investigation there. If this still happens on the latest version, feel free to share updated logs and configuration details in #5401. I'll close this one as a related issue for now. Thanks for the report!

anka-afk avatar Oct 15 '26 11:10 anka-afk