From 4f277c1eedea55c0f25b73dc08bd656972d0c893 Mon Sep 17 00:00:00 2001 From: tt-P607 <68868379+tt-P607@users.noreply.github.com> Date: Thu, 23 Oct 2025 01:29:12 +0800 Subject: [PATCH] =?UTF-8?q?fix(chat):=20=E9=98=B2=E6=AD=A2=E5=9B=9E?= =?UTF-8?q?=E5=A4=8D=E5=AA=92=E4=BD=93=E5=86=85=E5=AE=B9=E5=A4=84=E7=90=86?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E7=9A=84=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 机器人此前会将 "[图片(描述生成失败)]" 等系统提示误解为用户消息并进行回复,导致异常的对话行为。 本次修复通过两个层面解决此问题: 1. 在 `ChatBot` 中添加硬编码过滤器,作为第一道防线,直接静默处理包含失败关键词的消息。 2. 更新 Planner Prompt,明确禁止 AI 回复此类消息,作为第二道保险,确保系统行为的健壮性。 --- src/chat/message_receive/bot.py | 6 ++++++ .../built_in/affinity_flow_chatter/planner_prompts.py | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/chat/message_receive/bot.py b/src/chat/message_receive/bot.py index 4f598dfb7..7692e6c8f 100644 --- a/src/chat/message_receive/bot.py +++ b/src/chat/message_receive/bot.py @@ -470,6 +470,12 @@ class ChatBot: f"[{chat_name}]{message.message_info.user_info.user_nickname}:{message.processed_plain_text}\u001b[0m" ) + # 在此添加硬编码过滤,防止回复图片处理失败的消息 + failure_keywords = ["[表情包(描述生成失败)]", "[图片(描述生成失败)]"] + if any(keyword in message.processed_plain_text for keyword in failure_keywords): + logger.info(f"[硬编码过滤] 检测到媒体内容处理失败({message.processed_plain_text}),消息被静默处理。") + return + # 处理notice消息 notice_handled = await self.handle_notice_message(message) if notice_handled: diff --git a/src/plugins/built_in/affinity_flow_chatter/planner_prompts.py b/src/plugins/built_in/affinity_flow_chatter/planner_prompts.py index bbf51c7f4..3caa3f080 100644 --- a/src/plugins/built_in/affinity_flow_chatter/planner_prompts.py +++ b/src/plugins/built_in/affinity_flow_chatter/planner_prompts.py @@ -52,7 +52,8 @@ def init_prompts(): - 其他与上下文弱相关的内容最后考虑。 {mentioned_bonus} 4. 多目标:若多人同时需要回应,请在 actions 中并行生成多个 reply,每个都指向各自的 target_message_id。 -5. 避免:表情包/纯表情/无信息的消息;对这类消息通常不回复或选择 no_action/no_reply。 +5. **【核心规则】处理纯表情/符号**: 表情包和纯表情符号主要用于情感辅助。对不含任何实质文本的纯表情/符号消息,应默认选择`no_action`,除非你有非常特别的理由要回应。 +6. **【!!!绝对禁止!!!】处理失败消息**: 绝不能回复任何指示媒体内容(图片、表情包等)处理失败的消息。如果消息中出现如“[表情包(描述生成失败)]”或“[图片(描述生成失败)]”等文字,必须将其视为系统错误提示,并立即选择`no_action`。 6. 风格:保持人设一致;避免重复你说过的话;避免冗余和口头禅。 # 思绪流规范(thinking)