mirror of https://github.com/Mai-with-u/MaiBot.git
pfc action prompt 优化,尝试解决私聊刷屏问题(action: 计数这种东西为什么要让我来?代码里写死不是更准确吗?)
parent
c9d63d2f8d
commit
517222166b
|
|
@ -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 "- 目前没有明确对话目标,请考虑设定一个。",
|
||||
|
|
|
|||
|
|
@ -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 # 返回成功
|
||||
|
|
|
|||
|
|
@ -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 # 用于存储连续发送了多少条消息
|
||||
Loading…
Reference in New Issue