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]接口为dify时,高负载报错 #264

Open
1 of 2 tasks
CyanidEEEEE opened this issue Jan 31, 2025 · 5 comments
Open
1 of 2 tasks

[Bug]接口为dify时,高负载报错 #264

CyanidEEEEE opened this issue Jan 31, 2025 · 5 comments
Labels
bug Something isn't working

Comments

@CyanidEEEEE
Copy link

发生了什么

接口为dify时,高频率使用就会出现,不分消息平台

如何复现?

接入dify时高强度使用

AstrBot 版本与部署方式

windows最新版本

操作系统

Windows

额外信息

Task exception was never retrieved
future: <Task finished name='Task-1460' coro=<PipelineScheduler.execute() done, defined at C:\Users\sxc09\Desktop\AstrBot\AstrBotLauncher-0.1.3\AstrBot\astrbot\core\pipeline\scheduler.py:41> exception=BadRequest('Message text is empty')>
Traceback (most recent call last):
File "C:\Users\sxc09\Desktop\AstrBot\AstrBotLauncher-0.1.3\AstrBot\astrbot\core\pipeline\scheduler.py", line 43, in execute
await self._process_stages(event)
File "C:\Users\sxc09\Desktop\AstrBot\AstrBotLauncher-0.1.3\AstrBot\astrbot\core\pipeline\scheduler.py", line 29, in _process_stages
await self._process_stages(event, i + 1)
File "C:\Users\sxc09\Desktop\AstrBot\AstrBotLauncher-0.1.3\AstrBot\astrbot\core\pipeline\scheduler.py", line 31, in _process_stages
await coro
File "C:\Users\sxc09\Desktop\AstrBot\AstrBotLauncher-0.1.3\AstrBot\astrbot\core\pipeline\respond\stage.py", line 40, in process
await event.send(MessageChain([comp]))
File "C:\Users\sxc09\Desktop\AstrBot\AstrBotLauncher-0.1.3\AstrBot\data\plugins\astrbot_plugin_telegram\tg_message_event.py", line 49, in send
await self.send_with_client(self.client, message, self.get_sender_id())
File "C:\Users\sxc09\Desktop\AstrBot\AstrBotLauncher-0.1.3\AstrBot\data\plugins\astrbot_plugin_telegram\tg_message_event.py", line 37, in send_with_client
await client.send_message(text=i.text, **payload)
File "C:\Users\sxc09\Desktop\AstrBot\AstrBotLauncher-0.1.3\AstrBot\venv\Lib\site-packages\telegram\ext_extbot.py", line 2965, in send_message
return await super().send_message(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\sxc09\Desktop\AstrBot\AstrBotLauncher-0.1.3\AstrBot\venv\Lib\site-packages\telegram_bot.py", line 1019, in send_message
return await self._send_message(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\sxc09\Desktop\AstrBot\AstrBotLauncher-0.1.3\AstrBot\venv\Lib\site-packages\telegram\ext_extbot.py", line 610, in _send_message
result = await super()._send_message(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\sxc09\Desktop\AstrBot\AstrBotLauncher-0.1.3\AstrBot\venv\Lib\site-packages\telegram_bot.py", line 731, in _send_message
result = await self._post(
^^^^^^^^^^^^^^^^^
File "C:\Users\sxc09\Desktop\AstrBot\AstrBotLauncher-0.1.3\AstrBot\venv\Lib\site-packages\telegram_bot.py", line 619, in _post
return await self._do_post(
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\sxc09\Desktop\AstrBot\AstrBotLauncher-0.1.3\AstrBot\venv\Lib\site-packages\telegram\ext_extbot.py", line 354, in _do_post
return await super()._do_post(
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\sxc09\Desktop\AstrBot\AstrBotLauncher-0.1.3\AstrBot\venv\Lib\site-packages\telegram_bot.py", line 648, in _do_post
result = await request.post(
^^^^^^^^^^^^^^^^^^^
File "C:\Users\sxc09\Desktop\AstrBot\AstrBotLauncher-0.1.3\AstrBot\venv\Lib\site-packages\telegram\request_baserequest.py", line 202, in post
result = await self._request_wrapper(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\sxc09\Desktop\AstrBot\AstrBotLauncher-0.1.3\AstrBot\venv\Lib\site-packages\telegram\request_baserequest.py", line 383, in _request_wrapper
raise BadRequest(message)
telegram.error.BadRequest: Message text is empty
[19:21:40| ERROR] [dify_request.py:58]: Traceback (most recent call last):
File "C:\Users\sxc09\Desktop\AstrBot\AstrBotLauncher-0.1.3\AstrBot\astrbot\core\pipeline\process_stage\method\dify_request.py", line 55, in process
yield # rick roll
^^^^^
GeneratorExit

你愿意提交 PR 吗?

  • 是的,我愿意提交 PR!

Code of Conduct

@CyanidEEEEE CyanidEEEEE added the bug Something isn't working label Jan 31, 2025
@Soulter
Copy link
Owner

Soulter commented Jan 31, 2025

应该是 telegram.error.BadRequest: Message text is empty telegram 空消息导致了这个问题,我一会修复一下

@CyanidEEEEE
Copy link
Author

在qq平台上使用也会出现这个报错,我在尝试给dify的消息增加60s的超时时间看看能否修复

@CyanidEEEEE
Copy link
Author

CyanidEEEEE commented Feb 1, 2025

应该是 telegram.error.BadRequest: Message text is empty telegram 空消息导致了这个问题,我一会修复一下

我排查了很久,我认为dify应该改成流式传输,否则这个问题难以解决

@Soulter
Copy link
Owner

Soulter commented Feb 1, 2025

检测文本是否为空就行了,为空就不发送,这样可以避免这个报错

应该是 telegram.error.BadRequest: Message text is empty telegram 空消息导致了这个问题,我一会修复一下

我排查了很久,我认为dify应该改成流式传输,否则这个问题难以解决

@CyanidEEEEE
Copy link
Author

检测文本是否为空就行了,为空就不发送,这样可以避免这个报错

应该是 telegram.error.BadRequest: Message text is empty telegram 空消息导致了这个问题,我一会修复一下

我排查了很久,我认为dify应该改成流式传输,否则这个问题难以解决

我改过了,问题不是在于解决报错,而是一旦有空消息,单一用户后续的所有对于dify的访问都会卡住,目前我使用newapi中转dify规避这个问题了

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

No branches or pull requests

2 participants