From a748264fa47fbfd63cc2f51bca835c087a42334a Mon Sep 17 00:00:00 2001 From: Scofield <59475095+shijianhuai@users.noreply.github.com> Date: Thu, 19 Mar 2026 16:56:15 +0800 Subject: [PATCH] fix: prevent wecom ai bot long connection replies from disappearing (#6606) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: prevent empty fallback replies from clearing wecom ai bot output * fix: 优化消息发送逻辑,避免发送空消息 --------- Co-authored-by: shijianhuai Co-authored-by: Soulter <905617992@qq.com> --- astrbot/core/pipeline/scheduler.py | 6 ++++-- astrbot/core/platform/sources/wecom_ai_bot/wecomai_event.py | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/astrbot/core/pipeline/scheduler.py b/astrbot/core/pipeline/scheduler.py index ffb9c5c99..4af41eef2 100644 --- a/astrbot/core/pipeline/scheduler.py +++ b/astrbot/core/pipeline/scheduler.py @@ -86,8 +86,10 @@ class PipelineScheduler: try: await self._process_stages(event) - # 如果没有发送操作, 则发送一个空消息, 以便于后续的处理 - if isinstance(event, WebChatMessageEvent | WecomAIBotMessageEvent): + # 发送一个空消息, 以便于后续的处理 + if ( + isinstance(event, WebChatMessageEvent | WecomAIBotMessageEvent) + ): await event.send(None) logger.debug("pipeline 执行完毕。") diff --git a/astrbot/core/platform/sources/wecom_ai_bot/wecomai_event.py b/astrbot/core/platform/sources/wecom_ai_bot/wecomai_event.py index b7cf189e1..9f0c569d1 100644 --- a/astrbot/core/platform/sources/wecom_ai_bot/wecomai_event.py +++ b/astrbot/core/platform/sources/wecom_ai_bot/wecomai_event.py @@ -135,6 +135,8 @@ class WecomAIBotMessageEvent(AstrMessageEvent): async def send(self, message: MessageChain | None) -> None: """发送消息""" + if message is None: + return raw = self.message_obj.raw_message assert isinstance(raw, dict), ( "wecom_ai_bot platform event raw_message should be a dict"