feat(chat): 添加Chatter处理状态跟踪机制

在StreamLoopManager中添加is_chatter_processing标志来精确跟踪Chatter处理状态,优化消息打断检查逻辑。

- 在distribution_manager中设置和清除Chatter处理标志
- 在message_manager中基于处理状态进行打断检查
- 在数据模型中添加is_chatter_processing字段
This commit is contained in:
Windpicker-owo
2025-10-27 22:37:55 +08:00
parent 09de649d48
commit 79a0088065
3 changed files with 17 additions and 1 deletions

View File

@@ -374,8 +374,15 @@ class MessageManager:
logger.info(f"消息 {message.message_id} 是表情包或Emoji跳过打断检查")
return
# 检查是否有 stream_loop_task 在运行
# 检查上下文
context = chat_stream.context_manager.context
# 只有当 Chatter 真正在处理时才检查打断
if not context.is_chatter_processing:
logger.debug(f"聊天流 {chat_stream.stream_id} Chatter 未在处理,跳过打断检查")
return
# 检查是否有 stream_loop_task 在运行
stream_loop_task = context.stream_loop_task
if stream_loop_task and not stream_loop_task.done():