feat(notice): 实现全局notice消息管理系统

添加全局notice管理器,将notice消息与普通消息分离处理。主要功能包括:

- 创建 GlobalNoticeManager 单例类,支持公共和特定聊天流作用域
- 在 message_manager 中集成notice检测和处理逻辑
- 扩展数据库模型和消息类,添加notice相关字段
- 在提示词生成器中添加notice信息块展示
- 配置系统支持notice相关参数设置
- 适配器插件增强notice类型识别和配置

notice消息特点:
- 默认不触发聊天流程,只记录到全局管理器
- 可在提示词中展示最近的系统通知
- 支持按类型设置不同的生存时间
- 支持公共notice(所有聊天可见)和流特定notice

BREAKING CHANGE: 数据库消息表结构变更,需要添加 is_public_notice 和 notice_type 字段
This commit is contained in:
Windpicker-owo
2025-10-19 22:45:19 +08:00
parent 6eb6bab4df
commit 2ec3be7c84
15 changed files with 841 additions and 10 deletions

View File

@@ -150,6 +150,17 @@ class MessageReceiveConfig(ValidatedConfigBase):
ban_msgs_regex: list[str] = Field(default_factory=lambda: [], description="禁用消息正则列表")
class NoticeConfig(ValidatedConfigBase):
"""Notice消息配置类"""
enable_notice_trigger_chat: bool = Field(default=False, description="是否允许notice消息触发聊天流程")
notice_in_prompt: bool = Field(default=True, description="是否在提示词中展示最近的notice消息")
notice_prompt_limit: int = Field(default=5, ge=1, le=20, description="在提示词中展示的最大notice数量")
notice_time_window: int = Field(default=3600, ge=60, le=86400, description="notice时间窗口(秒)")
max_notices_per_chat: int = Field(default=30, ge=10, le=100, description="每个聊天保留的notice数量上限")
notice_retention_time: int = Field(default=86400, ge=3600, le=604800, description="notice保留时间(秒)")
class NormalChatConfig(ValidatedConfigBase):
"""普通聊天配置类"""