From 19a172fad791749dbe083489a619e38b4be147ba Mon Sep 17 00:00:00 2001 From: Bakadax Date: Tue, 6 May 2025 21:17:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BA=E5=B7=B2=E8=AF=BB=E5=8A=A0=E4=B8=8A?= =?UTF-8?q?=E5=B7=B2=E8=AF=BB=E6=A0=87=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/PFC/action_planner.py | 4 ++++ src/plugins/PFC/pfc.py | 5 ++++- src/plugins/PFC/reply_generator.py | 5 ++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/plugins/PFC/action_planner.py b/src/plugins/PFC/action_planner.py index df7bac51..754096a7 100644 --- a/src/plugins/PFC/action_planner.py +++ b/src/plugins/PFC/action_planner.py @@ -408,6 +408,10 @@ class ActionPlanner: f"\n--- 以下是 {other_unread_count} 条你需要处理的新消息 ---\n{new_messages_str}\n------\n" ) logger.debug(f"[私聊][{self.private_name}] 向 LLM 追加了 {other_unread_count} 条未读消息。") + else: + chat_history_text += ( + f"\n--- 以上均为已读消息,未读消息均已处理完毕 ---\n" + ) except AttributeError as e: logger.warning(f"[私聊][{self.private_name}] 构建聊天记录文本时属性错误: {e}") chat_history_text = "[获取聊天记录时出错]\n" diff --git a/src/plugins/PFC/pfc.py b/src/plugins/PFC/pfc.py index b17ee21d..69f4d7eb 100644 --- a/src/plugins/PFC/pfc.py +++ b/src/plugins/PFC/pfc.py @@ -98,7 +98,10 @@ class GoalAnalyzer: read_mark=0.0, ) chat_history_text += f"\n--- 以下是 {observation_info.new_messages_count} 条新消息 ---\n{new_messages_str}" - + else: + chat_history_text += ( + f"\n--- 以上均为已读消息,未读消息均已处理完毕 ---\n" + ) # await observation_info.clear_unprocessed_messages() persona_text = f"你的名字是{self.name},{self.personality_info}。" diff --git a/src/plugins/PFC/reply_generator.py b/src/plugins/PFC/reply_generator.py index b93171ea..feba6162 100644 --- a/src/plugins/PFC/reply_generator.py +++ b/src/plugins/PFC/reply_generator.py @@ -175,7 +175,10 @@ class ReplyGenerator: chat_history_text += f"\n--- 以下是 {observation_info.new_messages_count} 条新消息 ---\n{new_messages_str}" elif not chat_history_text: chat_history_text = "还没有聊天记录。" - + else: + chat_history_text += ( + f"\n--- 以上均为已读消息,未读消息均已处理完毕 ---\n" + ) # 构建 Persona 文本 (persona_text) persona_text = f"你的名字是{self.name},{self.personality_info}。" retrieval_context = chat_history_text # 使用前面构建好的 chat_history_text