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

@@ -121,6 +121,9 @@ class ChatConfig(ValidatedConfigBase):
)
# 消息打断系统配置 - 线性概率模型
interruption_enabled: bool = Field(default=True, description="是否启用消息打断系统")
allow_reply_interruption: bool = Field(
default=False, description="是否允许在正在生成回复时打断True=允许打断回复False=回复期间不允许打断)"
)
interruption_max_limit: int = Field(default=10, ge=0, description="每个聊天流的最大打断次数")
interruption_min_probability: float = Field(
default=0.1, ge=0.0, le=1.0, description="最低打断概率(即使达到较高打断次数,也保证有此概率的打断机会)"