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:
@@ -67,7 +67,9 @@ class DatabaseMessages(BaseDataModel):
|
||||
is_emoji: bool = False, # 是否为表情消息
|
||||
is_picid: bool = False, # 是否为图片消息(包含图片 ID)
|
||||
is_command: bool = False, # 是否为命令消息(如 /help)
|
||||
is_notify: bool = False, # 是否为通知消息(如系统通知)
|
||||
is_notify: bool = False, # 是否为notice消息(如禁言、戳一戳等系统事件)
|
||||
is_public_notice: bool = False, # 是否为公共notice(所有聊天可见)
|
||||
notice_type: str | None = None, # notice类型(由适配器指定,如 "group_ban", "poke" 等)
|
||||
selected_expressions: str | None = None, # 选择的表情或响应模板
|
||||
is_read: bool = False, # 是否已读
|
||||
user_id: str = "", # 用户 ID
|
||||
@@ -110,6 +112,8 @@ class DatabaseMessages(BaseDataModel):
|
||||
self.is_picid = is_picid
|
||||
self.is_command = is_command
|
||||
self.is_notify = is_notify
|
||||
self.is_public_notice = is_public_notice
|
||||
self.notice_type = notice_type
|
||||
self.selected_expressions = selected_expressions
|
||||
self.is_read = is_read
|
||||
self.actions = actions
|
||||
@@ -180,6 +184,8 @@ class DatabaseMessages(BaseDataModel):
|
||||
"is_picid": self.is_picid,
|
||||
"is_command": self.is_command,
|
||||
"is_notify": self.is_notify,
|
||||
"is_public_notice": self.is_public_notice,
|
||||
"notice_type": self.notice_type,
|
||||
"selected_expressions": self.selected_expressions,
|
||||
"is_read": self.is_read,
|
||||
"actions": self.actions,
|
||||
|
||||
Reference in New Issue
Block a user