From c14f49f59be061f5888a1571e46bbaa2c10e3fe2 Mon Sep 17 00:00:00 2001 From: Dt8333 Date: Fri, 7 Nov 2025 15:12:34 +0800 Subject: [PATCH] =?UTF-8?q?chore(core.platform):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E9=83=A8=E5=88=86=E5=AE=9E=E7=8E=B0Lint?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- astrbot/core/platform/sources/webchat/webchat_event.py | 8 +++++--- .../core/platform/sources/wecom_ai_bot/wecomai_event.py | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/astrbot/core/platform/sources/webchat/webchat_event.py b/astrbot/core/platform/sources/webchat/webchat_event.py index 956fee9c0..c5152e3bf 100644 --- a/astrbot/core/platform/sources/webchat/webchat_event.py +++ b/astrbot/core/platform/sources/webchat/webchat_event.py @@ -19,7 +19,9 @@ class WebChatMessageEvent(AstrMessageEvent): os.makedirs(imgs_dir, exist_ok=True) @staticmethod - async def _send(message: MessageChain, session_id: str, streaming: bool = False): + async def _send( + message: MessageChain | None, session_id: str, streaming: bool = False + ): cid = session_id.split("!")[-1] web_chat_back_queue = webchat_queue_mgr.get_or_create_back_queue(cid) if not message: @@ -107,9 +109,9 @@ class WebChatMessageEvent(AstrMessageEvent): return data - async def send(self, message: MessageChain): + async def send(self, message: MessageChain | None): await WebChatMessageEvent._send(message, session_id=self.session_id) - await super().send(message) + await super().send(MessageChain([])) async def send_streaming(self, generator, use_fallback: bool = False): final_data = "" 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 130182b48..c65a94989 100644 --- a/astrbot/core/platform/sources/wecom_ai_bot/wecomai_event.py +++ b/astrbot/core/platform/sources/wecom_ai_bot/wecomai_event.py @@ -37,7 +37,7 @@ class WecomAIBotMessageEvent(AstrMessageEvent): @staticmethod async def _send( - message_chain: MessageChain, + message_chain: MessageChain | None, stream_id: str, streaming: bool = False, ): @@ -87,7 +87,7 @@ class WecomAIBotMessageEvent(AstrMessageEvent): return data - async def send(self, message: MessageChain): + async def send(self, message: MessageChain | None): """发送消息""" raw = self.message_obj.raw_message assert isinstance(raw, dict), ( @@ -95,7 +95,7 @@ class WecomAIBotMessageEvent(AstrMessageEvent): ) stream_id = raw.get("stream_id", self.session_id) await WecomAIBotMessageEvent._send(message, stream_id) - await super().send(message) + await super().send(MessageChain([])) async def send_streaming(self, generator, use_fallback=False): """流式发送消息,参考webchat的send_streaming设计"""