feat(chat): 优化流处理逻辑与Normal模式性能

- 在StreamLoopManager中添加流能量更新机制,在处理消息前更新能量值用于间隔计算
- 为消息打断系统添加allow_reply_interruption配置选项,控制是否允许在回复时打断
- 重构AffinityFlowChatter规划器,为Normal模式添加简化流程,显著降低延迟
- 实现Normal模式与Focus模式间的智能切换机制,基于focus_energy概率退出Normal模式
- 移除冗余的兴趣度批量更新逻辑,优化数据库写入性能
- 更新配置模板版本至7.5.0

BREAKING CHANGE: 配置文件中新增allow_reply_interruption选项,需要更新配置
This commit is contained in:
Windpicker-owo
2025-10-28 19:13:18 +08:00
parent 82f2b68293
commit f6aa923f06
5 changed files with 230 additions and 56 deletions

View File

@@ -364,10 +364,13 @@ class MessageManager:
if not global_config.chat.interruption_enabled or not chat_stream or not message:
return
# 检查是否正在回复
# 检查是否正在回复,以及是否允许在回复时打断
if chat_stream.context_manager.context.is_replying:
logger.info(f"聊天流 {chat_stream.stream_id} 正在回复中,跳过打断检查")
return
if not global_config.chat.allow_reply_interruption:
logger.debug(f"聊天流 {chat_stream.stream_id} 正在回复中,且配置不允许回复时打断,跳过打断检查")
return
else:
logger.debug(f"聊天流 {chat_stream.stream_id} 正在回复中,但配置允许回复时打断")
# 检查是否为表情包消息
if message.is_picid or message.is_emoji: