diff --git a/src/plugins/PFC/action_planner.py b/src/plugins/PFC/action_planner.py index 3765a7d6c..8d2c7ea90 100644 --- a/src/plugins/PFC/action_planner.py +++ b/src/plugins/PFC/action_planner.py @@ -93,8 +93,7 @@ class ActionPlanner: max_tokens=1500, request_type="action_planning", ) - self.personality_info = Individuality.get_instance().get_prompt(type="personality", x_person=2, level=3) - self.identity_detail_info = Individuality.get_instance().get_prompt(type="identity", x_person=2, level=2) + self.personality_info = Individuality.get_instance().get_prompt(x_person=2, level=3) self.name = global_config.BOT_NICKNAME self.private_name = private_name self.chat_observer = ChatObserver.get_instance(stream_id, private_name) @@ -244,21 +243,7 @@ class ActionPlanner: chat_history_text = "处理聊天记录时出错。\n" # 构建 Persona 文本 (persona_text) - # (这部分逻辑不变) - identity_details_only = self.identity_detail_info - identity_addon = "" - if isinstance(identity_details_only, str): - pronouns = ["你", "我", "他"] - for p in pronouns: - if identity_details_only.startswith(p): - identity_details_only = identity_details_only[len(p) :] - break - if identity_details_only.endswith("。"): - identity_details_only = identity_details_only[:-1] - cleaned_details = identity_details_only.strip(",, ") - if cleaned_details: - identity_addon = f"并且{cleaned_details}" - persona_text = f"你的名字是{self.name},{self.personality_info}{identity_addon}。" + persona_text = f"你的名字是{self.name},{self.personality_info}。" # 构建行动历史和上一次行动结果 (action_history_summary, last_action_context) # (这部分逻辑不变) diff --git a/src/plugins/PFC/pfc.py b/src/plugins/PFC/pfc.py index 32755c29b..d6f4c5192 100644 --- a/src/plugins/PFC/pfc.py +++ b/src/plugins/PFC/pfc.py @@ -23,8 +23,7 @@ class GoalAnalyzer: model=global_config.llm_normal, temperature=0.7, max_tokens=1000, request_type="conversation_goal" ) - self.personality_info = Individuality.get_instance().get_prompt(type="personality", x_person=2, level=3) - self.identity_detail_info = Individuality.get_instance().get_prompt(type="identity", x_person=2, level=2) + self.personality_info = Individuality.get_instance().get_prompt(x_person=2, level=3) self.name = global_config.BOT_NICKNAME self.nick_name = global_config.BOT_ALIAS_NAMES self.private_name = private_name @@ -79,21 +78,7 @@ class GoalAnalyzer: # await observation_info.clear_unprocessed_messages() - identity_details_only = self.identity_detail_info - identity_addon = "" - if isinstance(identity_details_only, str): - pronouns = ["你", "我", "他"] - for p in pronouns: - if identity_details_only.startswith(p): - identity_details_only = identity_details_only[len(p) :] - break - if identity_details_only.endswith("。"): - identity_details_only = identity_details_only[:-1] - cleaned_details = identity_details_only.strip(",, ") - if cleaned_details: - identity_addon = f"并且{cleaned_details}" - - persona_text = f"你的名字是{self.name},{self.personality_info}{identity_addon}。" + persona_text = f"你的名字是{self.name},{self.personality_info}。" # 构建action历史文本 action_history_list = conversation_info.done_action action_history_text = "你之前做的事情是:" @@ -241,21 +226,8 @@ class GoalAnalyzer: timestamp_mode="relative", read_mark=0.0, ) - identity_details_only = self.identity_detail_info - identity_addon = "" - if isinstance(identity_details_only, str): - pronouns = ["你", "我", "他"] - for p in pronouns: - if identity_details_only.startswith(p): - identity_details_only = identity_details_only[len(p) :] - break - if identity_details_only.endswith("。"): - identity_details_only = identity_details_only[:-1] - cleaned_details = identity_details_only.strip(",, ") - if cleaned_details: - identity_addon = f"并且{cleaned_details}" - persona_text = f"你的名字是{self.name},{self.personality_info}{identity_addon}。" + persona_text = f"你的名字是{self.name},{self.personality_info}。" # ===> Persona 文本构建结束 <=== # --- 修改 Prompt 字符串,使用 persona_text --- diff --git a/src/plugins/PFC/reply_generator.py b/src/plugins/PFC/reply_generator.py index dea42b045..0c257a938 100644 --- a/src/plugins/PFC/reply_generator.py +++ b/src/plugins/PFC/reply_generator.py @@ -68,8 +68,7 @@ class ReplyGenerator: max_tokens=300, request_type="reply_generation", ) - self.personality_info = Individuality.get_instance().get_prompt(type="personality", x_person=2, level=3) - self.identity_detail_info = Individuality.get_instance().get_prompt(type="identity", x_person=2, level=2) + self.personality_info = Individuality.get_instance().get_prompt(x_person=2, level=3) self.name = global_config.BOT_NICKNAME self.private_name = private_name self.chat_observer = ChatObserver.get_instance(stream_id, private_name) @@ -130,20 +129,7 @@ class ReplyGenerator: chat_history_text = "还没有聊天记录。" # 构建 Persona 文本 (persona_text) - identity_details_only = self.identity_detail_info - identity_addon = "" - if isinstance(identity_details_only, str): - pronouns = ["你", "我", "他"] - for p in pronouns: - if identity_details_only.startswith(p): - identity_details_only = identity_details_only[len(p) :] - break - if identity_details_only.endswith("。"): - identity_details_only = identity_details_only[:-1] - cleaned_details = identity_details_only.strip(",, ") - if cleaned_details: - identity_addon = f"并且{cleaned_details}" - persona_text = f"你的名字是{self.name},{self.personality_info}{identity_addon}。" + persona_text = f"你的名字是{self.name},{self.personality_info}。" # --- 选择 Prompt --- if action_type == "send_new_message":