AstrBot
AstrBot copied to clipboard
[Bug] 与Dify的兼容性问题
发生了什么
发几条消息之后,就会稳定出现AstrBot 请求 Dify失败。
如何复现?
在微信群里面多at几次,有时候就卡住了。 或者在AstrBot的聊天界面多试几次。
AstrBot 版本与部署方式
3.4.23 Docker
操作系统
Linux
额外信息
1.微信消息在控制台上有以下信息:
[10:55:18| INFO] [dify_api_client.py:74]: workflow_run payload: {'inputs': {'astrbot_text_query': '为什么又失败?', 'astrbot_session_id': '58165590378@chatroom'}, 'user': '58165590378@chatroom', 'response_mode': 'streaming', 'files': [], 'url': 'http://host.docker.internal/v1/workflows/run'}
[10:55:18| INFO] [dify_source.py:103]: Dify 工作流(ID: 5f1e4f1c-4e96-47f7-9b94-c6bd210a45b1)开始运行。
[2025-02-10 10:55:52 +0000] [1] [INFO] 172.18.0.2:56162 POST /astrbot-gewechat/callback 1.1 200 20 2235
[10:56:19| ERROR] [dify_request.py:62]: Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/aiohttp/streams.py", line 347, in _wait
await waiter
asyncio.exceptions.CancelledError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/AstrBot/astrbot/core/pipeline/process_stage/method/dify_request.py", line 52, in process
llm_response = await provider.text_chat(**req.__dict__) # 请求 LLM
File "/AstrBot/astrbot/core/provider/sources/dify_source.py", line 92, in text_chat
async for chunk in self.api_client.workflow_run(
File "/AstrBot/astrbot/core/utils/dify_api_client.py", line 85, in workflow_run
chunk = await resp.content.read(8192)
File "/usr/local/lib/python3.10/site-packages/aiohttp/streams.py", line 428, in read
await self._wait("read")
File "/usr/local/lib/python3.10/site-packages/aiohttp/streams.py", line 346, in _wait
with self._timer:
File "/usr/local/lib/python3.10/site-packages/aiohttp/helpers.py", line 671, in __exit__
raise asyncio.TimeoutError from exc_val
asyncio.exceptions.TimeoutError
- webchat在控制台上有如下信息:
[11:04:07| INFO] [event_bus.py:21]: [webchat] astrbot/astrbot: 柔性电子皮肤是什么?
[11:04:07| INFO] [dify_api_client.py:74]: workflow_run payload: {'inputs': {'astrbot_text_query': '柔性电子皮肤是什么?', 'astrbot_session_id': 'webchat!astrbot!c5e77a53-50bd-4631-bbaa-6fe9610c559a'}, 'user': 'webchat!astrbot!c5e77a53-50bd-4631-bbaa-6fe9610c559a', 'response_mode': 'streaming', 'files': [], 'url': 'http://host.docker.internal/v1/workflows/run'}
[11:04:07| INFO] [dify_source.py:103]: Dify 工作流(ID: e5f8a993-f9fe-448c-b08c-171a0efd3d74)开始运行。
[11:05:07| ERROR] [dify_request.py:62]: Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/aiohttp/streams.py", line 347, in _wait
await waiter
asyncio.exceptions.CancelledError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/AstrBot/astrbot/core/pipeline/process_stage/method/dify_request.py", line 52, in process
llm_response = await provider.text_chat(**req.__dict__) # 请求 LLM
File "/AstrBot/astrbot/core/provider/sources/dify_source.py", line 92, in text_chat
async for chunk in self.api_client.workflow_run(
File "/AstrBot/astrbot/core/utils/dify_api_client.py", line 85, in workflow_run
chunk = await resp.content.read(8192)
File "/usr/local/lib/python3.10/site-packages/aiohttp/streams.py", line 428, in read
await self._wait("read")
File "/usr/local/lib/python3.10/site-packages/aiohttp/streams.py", line 346, in _wait
with self._timer:
File "/usr/local/lib/python3.10/site-packages/aiohttp/helpers.py", line 671, in __exit__
raise asyncio.TimeoutError from exc_val
asyncio.exceptions.TimeoutError
[11:05:08| INFO] [stage.py:45]: AstrBot -> astrbot/astrbot: [Reply][deepseek-v3]AstrBot 请求 Dify 失败:
如果在dify自己的界面,发送多少条数据都不会卡住。
你愿意提交 PR 吗?
- [x] 是的,我愿意提交 PR!
Code of Conduct
- [x] 我已阅读并同意遵守该项目的 行为准则。