From c33dab01190fb12ac5fe431879e15b4b935677fa Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 26 Apr 2025 12:49:58 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20=E8=87=AA=E5=8A=A8=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E5=8C=96=E4=BB=A3=E7=A0=81=20[skip=20ci]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/PFC/action_planner.py | 6 ++++-- src/plugins/PFC/conversation.py | 3 ++- src/plugins/PFC/observation_info.py | 2 +- src/plugins/PFC/pfc.py | 2 +- src/plugins/PFC/reply_generator.py | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/plugins/PFC/action_planner.py b/src/plugins/PFC/action_planner.py index 5ac6c62d7..e29d8c4fc 100644 --- a/src/plugins/PFC/action_planner.py +++ b/src/plugins/PFC/action_planner.py @@ -149,7 +149,9 @@ class ActionPlanner: timestamp_mode="relative", read_mark=0.0, ) - chat_history_text += f"\n--- 以下是 {observation_info.new_messages_count} 条新消息 ---\n{new_messages_str}" + chat_history_text += ( + f"\n--- 以下是 {observation_info.new_messages_count} 条新消息 ---\n{new_messages_str}" + ) # 清理消息应该由调用者或 observation_info 内部逻辑处理,这里不再调用 clear # if hasattr(observation_info, 'clear_unprocessed_messages'): # observation_info.clear_unprocessed_messages() @@ -302,4 +304,4 @@ end_conversation: 结束对话,对方长时间没回复或者当你觉得对 except Exception as e: logger.error(f"规划行动时调用 LLM 或处理结果出错: {str(e)}") - return "wait", f"行动规划处理中发生错误,暂时等待: {str(e)}" \ No newline at end of file + return "wait", f"行动规划处理中发生错误,暂时等待: {str(e)}" diff --git a/src/plugins/PFC/conversation.py b/src/plugins/PFC/conversation.py index df33fc11f..6bcb53fe2 100644 --- a/src/plugins/PFC/conversation.py +++ b/src/plugins/PFC/conversation.py @@ -4,6 +4,7 @@ import datetime # from .message_storage import MongoDBMessageStorage from src.plugins.utils.chat_message_builder import build_readable_messages, get_raw_msg_before_timestamp_with_chat + # from ...config.config import global_config from typing import Dict, Any from ..chat.message import Message @@ -461,4 +462,4 @@ class Conversation: except Exception as e: # 这是外层 try 对应的 except logger.error(f"发送消息或更新状态时失败: {str(e)}") - self.state = ConversationState.ANALYZING # 出错也要尝试恢复状态 \ No newline at end of file + self.state = ConversationState.ANALYZING # 出错也要尝试恢复状态 diff --git a/src/plugins/PFC/observation_info.py b/src/plugins/PFC/observation_info.py index fa24c1219..072b1fb6f 100644 --- a/src/plugins/PFC/observation_info.py +++ b/src/plugins/PFC/observation_info.py @@ -241,4 +241,4 @@ class ObservationInfo: self.has_unread_messages = False self.unprocessed_messages.clear() self.chat_history_count = len(self.chat_history) - self.new_messages_count = 0 \ No newline at end of file + self.new_messages_count = 0 diff --git a/src/plugins/PFC/pfc.py b/src/plugins/PFC/pfc.py index e792f16a6..5a70d02f3 100644 --- a/src/plugins/PFC/pfc.py +++ b/src/plugins/PFC/pfc.py @@ -381,4 +381,4 @@ class DirectMessageSender: await self.storage.store_message(message, chat_stream) logger.success(f"PFC消息已发送: {content}") except Exception as e: - logger.error(f"PFC消息发送失败: {str(e)}") \ No newline at end of file + logger.error(f"PFC消息发送失败: {str(e)}") diff --git a/src/plugins/PFC/reply_generator.py b/src/plugins/PFC/reply_generator.py index 663a529c1..65afbf64d 100644 --- a/src/plugins/PFC/reply_generator.py +++ b/src/plugins/PFC/reply_generator.py @@ -182,4 +182,4 @@ class ReplyGenerator: Returns: Tuple[bool, str, bool]: (是否合适, 原因, 是否需要重新规划) """ - return await self.reply_checker.check(reply, goal, chat_history, chat_history_str, retry_count) \ No newline at end of file + return await self.reply_checker.check(reply, goal, chat_history, chat_history_str, retry_count)