diff --git a/src/common/logger.py b/src/common/logger.py index 0b800a851..34581fdaa 100644 --- a/src/common/logger.py +++ b/src/common/logger.py @@ -485,6 +485,33 @@ MODULE_COLORS = { # 其他工具 "消息压缩工具": "\033[38;5;244m", # 灰色 "lpmm_get_knowledge_tool": "\033[38;5;102m", # 绿色 + "message_chunker": "\033[38;5;244m", + "plan_generator": "\033[38;5;171m", + "Permission": "\033[38;5;196m", + "web_search_plugin": "\033[38;5;130m", + "url_parser_tool": "\033[38;5;130m", + "api_key_manager": "\033[38;5;130m", + "tavily_engine": "\033[38;5;130m", + "exa_engine": "\033[38;5;130m", + "ddg_engine": "\033[38;5;130m", + "bing_engine": "\033[38;5;130m", + "vector_instant_memory_v2": "\033[38;5;117m", + "async_memory_optimizer": "\033[38;5;117m", + "async_instant_memory_wrapper": "\033[38;5;117m", + "action_diagnostics": "\033[38;5;214m", + "anti_injector.message_processor": "\033[38;5;196m", + "anti_injector.user_ban": "\033[38;5;196m", + "anti_injector.statistics": "\033[38;5;196m", + "anti_injector.decision_maker": "\033[38;5;196m", + "anti_injector.counter_attack": "\033[38;5;196m", + "hfc.processor": "\033[38;5;81m", + "hfc.normal_mode": "\033[38;5;81m", + "wakeup": "\033[38;5;81m", + "cache_manager": "\033[38;5;244m", + "monthly_plan_db": "\033[38;5;94m", + "db_migration": "\033[38;5;94m", + "小彩蛋": "\033[38;5;214m", + "AioHTTP-Gemini客户端": "\033[38;5;81m", } # 定义模块别名映射 - 将真实的logger名称映射到显示的别名 @@ -531,6 +558,7 @@ MODULE_ALIASES = { "base_event_handler": "事件处理", "events_manager": "事件管理", "global_announcement_manager": "全局通知", + "event_manager" # 工具和依赖管理 "dependency_config": "依赖配置", @@ -585,6 +613,34 @@ MODULE_ALIASES = { # 其他工具 "消息压缩工具": "消息压缩", "lpmm_get_knowledge_tool": "知识获取", + "message_chunker": "消息分块", + "plan_generator": "计划生成", + "Permission": "权限管理", + "web_search_plugin": "网页搜索插件", + "url_parser_tool": "URL解析工具", + "api_key_manager": "API密钥管理", + "tavily_engine": "Tavily引擎", + "exa_engine": "Exa引擎", + "ddg_engine": "DDG引擎", + "bing_engine": "Bing引擎", + "vector_instant_memory_v2": "向量瞬时记忆", + "async_memory_optimizer": "异步记忆优化器", + "async_instant_memory_wrapper": "异步瞬时记忆包装器", + "action_diagnostics": "动作诊断", + "anti_injector.message_processor": "反注入消息处理器", + "anti_injector.user_ban": "反注入用户封禁", + "anti_injector.statistics": "反注入统计", + "anti_injector.decision_maker": "反注入决策者", + "anti_injector.counter_attack": "反注入反击", + "hfc.processor": "聊天节奏处理器", + "hfc.normal_mode": "聊天节奏普通模式", + "wakeup": "唤醒", + "cache_manager": "缓存管理", + "monthly_plan_db": "月度计划数据库", + "db_migration": "数据库迁移", + "小彩蛋": "小彩蛋", + "AioHTTP-Gemini客户端": "AioHTTP-Gemini客户端", + "event_manager" : "事件管理器" } RESET_COLOR = "\033[0m" diff --git a/src/config/official_configs.py b/src/config/official_configs.py index 3fd778c59..e8f41d00f 100644 --- a/src/config/official_configs.py +++ b/src/config/official_configs.py @@ -87,12 +87,6 @@ class ChatConfig(ValidatedConfigBase): proactive_thinking_enable_in_private: List[str] = Field(default_factory=list, description="启用主动思考的私聊范围,格式:platform:user_id,为空则不限制") proactive_thinking_enable_in_groups: List[str] = Field(default_factory=list, description="启用主动思考的群聊范围,格式:platform:group_id,为空则不限制") delta_sigma: int = Field(default=120, description="采用正态分布随机时间间隔") - proactive_thinking_prompt_template: str = Field(default="""现在群里面已经隔了{time}没有人发送消息了,请你结合上下文以及群聊里面之前聊过的话题和你的人设来决定要不要主动发送消息,你可以选择: - -1. 继续保持沉默(当{time}以前已经结束了一个话题并且你不想挑起新话题时) -2. 选择回复(当{time}以前你发送了一条消息且没有人回复你时、你想主动挑起一个话题时) - -请根据当前情况做出选择。如果选择回复,请直接发送你想说的内容;如果选择保持沉默,请只回复"沉默"(注意:这个词不会被发送到群聊中)。""", description="主动思考提示模板") def get_current_talk_frequency(self, chat_stream_id: Optional[str] = None) -> float: """ diff --git a/template/bot_config_template.toml b/template/bot_config_template.toml index 337efa0fb..24fe3dd0a 100644 --- a/template/bot_config_template.toml +++ b/template/bot_config_template.toml @@ -1,5 +1,5 @@ [inner] -version = "6.5.1" +version = "6.5.2" #----以下是给开发人员阅读的,如果你只是部署了麦麦,不需要阅读---- #如果你想要修改配置文件,请递增version的值 @@ -150,20 +150,13 @@ proactive_thinking_interval = 1500 # 主动思考触发间隔时间(秒), proactive_thinking_in_private = true # 主动思考可以在私聊里面启用 proactive_thinking_in_group = true # 主动思考可以在群聊里面启用 - # 主动思考启用范围配置 - 按平台和类型分别配置,建议平台配置为小写 # 格式:["platform:user_id", "platform:user_id", ...] # 示例:["qq:123456789", "telegram:user123", "bilibili:987654321"] -proactive_thinking_enable_in_private = [ - -] # 启用主动思考的私聊范围,为空则不限制 - -proactive_thinking_enable_in_groups = [ - -] # 启用主动思考的群聊范围,为空则不限制 +proactive_thinking_enable_in_private = [] # 启用主动思考的私聊范围,为空则不限制 +proactive_thinking_enable_in_groups = [] # 启用主动思考的群聊范围,为空则不限制 delta_sigma = 120 # 正态分布的标准差,控制时间间隔的随机程度 - # 特殊用法: # - 设置为0:禁用正态分布,使用固定间隔 # - 设置得很大(如6000):产生高度随机的间隔,即使基础间隔为0也能工作 @@ -171,16 +164,6 @@ delta_sigma = 120 # 正态分布的标准差,控制时间间隔的随机程度 # 实验建议:试试 proactive_thinking_interval=0 + delta_sigma 非常大 的纯随机模式! # 结果保证:生成的间隔永远为正数(负数会取绝对值),最小1秒,最大24小时 -# 主动思考prompt模板,{time}会被替换为实际的沉默时间(如"2小时30分15秒") -proactive_thinking_prompt_template = """现在当前的聊天里面已经隔了{time}没有人发送消息了,请你结合上下文以及群聊里面之前聊过的话题和你的人设来决定要不要主动发送消息,你可以选择: - -1. 继续保持沉默(当{time}以前已经结束了一个话题并且你不想挑起新话题时) -2. 选择回复(当{time}以前你发送了一条消息且没有人回复你时、你想主动挑起一个话题时) - -请根据当前情况做出选择。如果选择回复,请直接发送你想说的内容;如果选择保持沉默,请只回复"沉默"(注意:这个词不会被发送到群聊中)。""" -# 你可以在这里配置主动思考的prompt,但是务必不要修改{time}一类的占位符,不然会影响主动思考的质量(因为time占位符会在实际的prompt里面被替换为时间间隔) -# 自己配置的建议是中间的情况描述 - [relationship] enable_relationship = true # 是否启用关系系统 relation_frequency = 1 # 关系频率,麦麦构建关系的频率 @@ -203,29 +186,23 @@ enabled = false # 是否启用反注入系统 enabled_rules = false # 是否启用规则检测 enabled_LLM = false # 是否启用LLM检测 process_mode = "lenient" # 处理模式:strict(严格模式,直接丢弃), lenient(宽松模式,消息加盾), auto(自动模式), counter_attack(反击模式,使用LLM反击并丢弃消息) - # 白名单配置 # 格式:[[platform, user_id], ...] # 示例:[["qq", "123456"], ["telegram", "user789"]] whitelist = [] # 用户白名单,这些用户的消息将跳过检测 - # LLM检测配置 llm_detection_enabled = true # 是否启用LLM二次分析 llm_detection_threshold = 0.7 # LLM判定危险的置信度阈值(0-1) - # 性能配置 cache_enabled = true # 是否启用检测结果缓存 cache_ttl = 3600 # 缓存有效期(秒) max_message_length = 150 # 最大检测消息长度,超过将直接判定为危险 - # 统计配置 stats_enabled = true # 是否启用统计功能 - # 自动封禁配置 auto_ban_enabled = false # 是否启用自动封禁功能 auto_ban_violation_threshold = 3 # 触发封禁的违规次数阈值 auto_ban_duration_hours = 2 # 封禁持续时间(小时) - # 消息加盾配置(宽松模式下使用) shield_prefix = "🛡️ " # 加盾消息前缀 shield_suffix = " 🛡️" # 加盾消息后缀