From f835dcb5e2c54c8a00cf8b8fd2d5f32c4956c8ab Mon Sep 17 00:00:00 2001 From: Furina-1013-create <189647097+Furina-1013-create@users.noreply.github.com> Date: Tue, 19 Aug 2025 22:15:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9Bfocus=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E4=B8=8B=E7=9A=84=E5=9B=9E=E5=A4=8D=E9=80=BB=E8=BE=91=EF=BC=8C?= =?UTF-8?q?=E7=90=86=E8=AE=BA=E4=B8=8A=E7=8E=B0=E5=9C=A8focus=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E4=B8=8B=E5=9C=A8bot=E8=A2=AB@=20/=20=E6=8F=90?= =?UTF-8?q?=E5=8F=8A=20=E6=97=B6=E5=BA=94=E8=AF=A5=E4=BC=9A=E5=9B=9E?= =?UTF-8?q?=E5=A4=8D=E4=BA=86=20=E9=87=87=E7=94=A8=E7=9A=84=E6=98=AF?= =?UTF-8?q?=E5=9C=A8focus=E6=A8=A1=E5=BC=8F=E4=B8=8B=E7=A7=BB=E9=99=A4no?= =?UTF-8?q?=5Freply=E5=8A=A8=E4=BD=9C=E7=9A=84=E6=96=B9=E5=BC=8F=20?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E6=9B=B4=E6=96=B0bot=5Fconfig=5Ftemplate?= =?UTF-8?q?=E9=87=8C=E9=9D=A2=E7=9A=84=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TODO.md | 2 +- src/chat/chat_loop/heartFC_chat.py | 9 +++++++++ template/bot_config_template.toml | 11 ++++++----- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/TODO.md b/TODO.md index 875ba233e..c55725b62 100644 --- a/TODO.md +++ b/TODO.md @@ -28,7 +28,7 @@ - 大工程 -· 增加一个基于Rust后端,daisyui为前端的启动器,以下是详细功能 +· 增加一个基于Rust后端,daisyui为(装饰的)前端的启动器,以下是详细功能 - 一个好看的ui - 支持所有的非core的插件管理 - 支持一键部署所有环境 diff --git a/src/chat/chat_loop/heartFC_chat.py b/src/chat/chat_loop/heartFC_chat.py index a9f4de426..e8bf73ddc 100644 --- a/src/chat/chat_loop/heartFC_chat.py +++ b/src/chat/chat_loop/heartFC_chat.py @@ -553,6 +553,15 @@ class HeartFChatting: except Exception as e: logger.error(f"{self.log_prefix} 动作修改失败: {e}") + # 在focus模式下如果你的bot被@/提到了,那么就移除no_reply动作 + is_mentioned_bot = message_data.get("is_mentioned", False) + at_bot_mentioned = (global_config.chat.mentioned_bot_inevitable_reply and is_mentioned_bot) or \ + (global_config.chat.at_bot_inevitable_reply and is_mentioned_bot) + + if self.loop_mode == ChatMode.FOCUS and at_bot_mentioned and "no_reply" in available_actions: + logger.info(f"{self.log_prefix} Focus模式下检测到@或提及bot,移除no_reply动作以确保回复") + available_actions = {k: v for k, v in available_actions.items() if k != "no_reply"} # 用一个循环来移除no_reply + # 检查是否在normal模式下没有可用动作(除了reply相关动作) skip_planner = False if self.loop_mode == ChatMode.NORMAL: diff --git a/template/bot_config_template.toml b/template/bot_config_template.toml index 7f789cadf..0e7d97a50 100644 --- a/template/bot_config_template.toml +++ b/template/bot_config_template.toml @@ -1,5 +1,5 @@ [inner] -version = "6.3.8" +version = "6.3.9" #----以下是给开发人员阅读的,如果你只是部署了麦麦,不需要阅读---- #如果你想要修改配置文件,请递增version的值 @@ -104,8 +104,9 @@ max_context_size = 25 # 上下文长度 thinking_timeout = 40 # 麦麦一次回复最长思考规划时间,超过这个时间的思考会放弃(往往是api反应太慢) replyer_random_probability = 0.5 # 首要replyer模型被选择的概率 -mentioned_bot_inevitable_reply = true # 提及 bot 大概率回复 -at_bot_inevitable_reply = true # @bot 或 提及bot 大概率回复 +mentioned_bot_inevitable_reply = true # 提及 bot 必然回复 +at_bot_inevitable_reply = true # @bot 或 提及bot 必然回复 +# 兼容normal、focus,在focus模式下为强制移除no_reply动作 talk_frequency_adjust = [ ["", "8:00,1", "12:00,1.2", "18:00,1.5", "01:00,0.6"], @@ -161,8 +162,8 @@ ban_msgs_regex = [ ] [anti_prompt_injection] # LLM反注入系统配置 -enabled = true # 是否启用反注入系统 -enabled_rules = true # 是否启用规则检测 +enabled = false # 是否启用反注入系统 +enabled_rules = false # 是否启用规则检测 enabled_LLM = false # 是否启用LLM检测 process_mode = "lenient" # 处理模式:strict(严格模式,直接丢弃), lenient(宽松模式,消息加盾), auto(自动模式), counter_attack(反击模式,使用LLM反击并丢弃消息)