fix(chat): 防止回复媒体内容处理失败的消息

机器人此前会将 "[图片(描述生成失败)]" 等系统提示误解为用户消息并进行回复,导致异常的对话行为。

本次修复通过两个层面解决此问题:
1. 在 `ChatBot` 中添加硬编码过滤器,作为第一道防线,直接静默处理包含失败关键词的消息。
2. 更新 Planner Prompt,明确禁止 AI 回复此类消息,作为第二道保险,确保系统行为的健壮性。
This commit is contained in:
tt-P607
2025-10-23 01:29:12 +08:00
parent c149620fd0
commit f95fe72693
2 changed files with 8 additions and 1 deletions

View File

@@ -466,6 +466,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: