diff --git a/src/plugins/PFC/action_planner.py b/src/plugins/PFC/action_planner.py index 96b1630c..21ffbef6 100644 --- a/src/plugins/PFC/action_planner.py +++ b/src/plugins/PFC/action_planner.py @@ -86,7 +86,7 @@ block_and_ignore: 更加极端的结束对话方式,直接结束对话并在 请以JSON格式输出你的决策: {{ "action": "选择的行动类型 (必须是上面列表中的一个)", - "reason": "选择该行动的详细原因 (必须有解释你是如何根据“上一次行动结果”、“对话记录”和自身设定人设做出合理判断的。请说明你为什么选择继续发言而不是等待,以及打算发送什么类型的新消息连续发言,必须记录已经发言了几次)" + "reason": "选择该行动的详细原因 (必须有解释你是如何根据“上一次行动结果”、“对话记录”和自身设定人设做出合理判断的。)" }} 注意:请严格按照JSON格式输出,不要包含任何其他内容。""" @@ -197,6 +197,9 @@ class ActionPlanner: if observation_info and hasattr(observation_info, 'current_time_str') and observation_info.current_time_str: current_time_value = observation_info.current_time_str + if conversation_info.my_message_count > 2: + current_time_value += f"\n你已连续发送{str(conversation_info.my_message_count)},如果没有必要请不要连续发送大量消息,以免形成刷屏造成对方困扰。" + prompt = prompt_template.format( persona_text=persona_text, goals_str=goals_str if goals_str.strip() else "- 目前没有明确对话目标,请考虑设定一个。", diff --git a/src/plugins/PFC/conversation.py b/src/plugins/PFC/conversation.py index d4ba017c..ad9b5281 100644 --- a/src/plugins/PFC/conversation.py +++ b/src/plugins/PFC/conversation.py @@ -799,6 +799,7 @@ class Conversation: f"[私聊][{self.private_name}] 因规划期间收到 {other_new_msg_count_during_planning} 条他人新消息,下一轮强制使用【初始回复】逻辑。" ) conversation_info.last_successful_reply_action = None # 强制初始回复 + conversation_info.my_message_count = 0 # 自身发言数量清零 else: # 规则:如果规划期间【没有】收到他人新消息,则允许追问 logger.info( @@ -1061,6 +1062,8 @@ class Conversation: content=reply_content, reply_to_message=None, # 私聊通常不需要引用回复 ) + # 自身发言数量累计 +1 + self.conversation_info.my_message_count += 1 # 发送成功后,将状态设置回分析,准备下一轮规划 self.state = ConversationState.ANALYZING return True # 返回成功 diff --git a/src/plugins/PFC/conversation_info.py b/src/plugins/PFC/conversation_info.py index 062a4641..618760f0 100644 --- a/src/plugins/PFC/conversation_info.py +++ b/src/plugins/PFC/conversation_info.py @@ -10,3 +10,4 @@ class ConversationInfo: self.last_successful_reply_action: Optional[str] = None self.last_reply_rejection_reason: Optional[str] = None # 用于存储上次回复被拒原因 self.last_rejected_reply_content: Optional[str] = None # 用于存储上次被拒的回复内容 + self.my_message_count: int = 0 # 用于存储连续发送了多少条消息 \ No newline at end of file