Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions astrbot/core/pipeline/respond/stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ async def _is_empty_message_chain(self, chain: list[BaseMessageComponent]) -> bo
# 如果所有组件都为空
return True

async def _after_sent_cleanup(self, event: AstrMessageEvent) -> bool:
if await call_event_hook(event, EventType.OnAfterMessageSentEvent):
return True
event.clear_result()
return False

def is_seg_reply_required(self, event: AstrMessageEvent) -> bool:
"""检查是否需要分段回复"""
if not self.enable_seg:
Expand Down Expand Up @@ -222,6 +228,8 @@ async def process(
)
logger.info(f"Applying streaming output ({event.get_platform_id()}).")
await event.send_streaming(result.async_stream, realtime_segmenting)
if await self._after_sent_cleanup(event):
return
return
if len(result.chain) > 0:
# 检查路径映射
Expand Down Expand Up @@ -319,7 +327,5 @@ async def process(
exc_info=True,
)

if await call_event_hook(event, EventType.OnAfterMessageSentEvent):
if await self._after_sent_cleanup(event):
return

event.clear_result()