mirror of https://github.com/Mai-with-u/MaiBot.git
在目前planner已经客观决策的前提下 不再需要超时提示
parent
8b7531503e
commit
c038be2b84
|
|
@ -39,7 +39,6 @@ PROMPT_INITIAL_REPLY = """
|
|||
【最近的对话记录】(包括你已成功发送的消息 和 新收到的消息)
|
||||
{chat_history_text}
|
||||
|
||||
{spam_warning_info}
|
||||
|
||||
------
|
||||
可选行动类型以及解释:
|
||||
|
|
@ -76,8 +75,6 @@ PROMPT_FOLLOW_UP = """
|
|||
【最近的对话记录】(包括你已成功发送的消息 和 新收到的消息)
|
||||
{chat_history_text}
|
||||
|
||||
{spam_warning_info}
|
||||
|
||||
------
|
||||
可选行动类型以及解释:
|
||||
wait: 暂时不说话,留给对方交互空间,等待对方回复。
|
||||
|
|
@ -137,7 +134,6 @@ PROMPT_REFLECT_AND_ACT = """
|
|||
【最近的对话记录】(包括你已成功发送的消息 和 新收到的消息)
|
||||
{chat_history_text}
|
||||
|
||||
{spam_warning_info}
|
||||
|
||||
------
|
||||
可选行动类型以及解释:
|
||||
|
|
@ -243,27 +239,27 @@ class ActionPlanner:
|
|||
log_msg = "使用 PROMPT_REFLECT_AND_ACT (反思决策)"
|
||||
# 对于 PROMPT_REFLECT_AND_ACT,它不包含 send_new_message 选项,所以 spam_warning_message 中的相关提示可以调整或省略
|
||||
# 但为了保持占位符填充的一致性,我们仍然计算它
|
||||
spam_warning_message = ""
|
||||
if conversation_info.my_message_count > 5: # 这里的 my_message_count 仍有意义,表示之前连续发送了多少
|
||||
spam_warning_message = (
|
||||
f"⚠️【警告】**你之前已连续发送{str(conversation_info.my_message_count)}条消息!请谨慎决策。**"
|
||||
)
|
||||
elif conversation_info.my_message_count > 2:
|
||||
spam_warning_message = f"💬【提示】**你之前已连续发送{str(conversation_info.my_message_count)}条消息。请注意保持对话平衡。**"
|
||||
# spam_warning_message = ""
|
||||
# if conversation_info.my_message_count > 5: # 这里的 my_message_count 仍有意义,表示之前连续发送了多少
|
||||
# spam_warning_message = (
|
||||
# f"⚠️【警告】**你之前已连续发送{str(conversation_info.my_message_count)}条消息!请谨慎决策。**"
|
||||
# )
|
||||
# elif conversation_info.my_message_count > 2:
|
||||
# spam_warning_message = f"💬【提示】**你之前已连续发送{str(conversation_info.my_message_count)}条消息。请注意保持对话平衡。**"
|
||||
|
||||
elif last_successful_reply_action in ["direct_reply", "send_new_message"]:
|
||||
prompt_template = PROMPT_FOLLOW_UP
|
||||
log_msg = "使用 PROMPT_FOLLOW_UP (追问决策)"
|
||||
spam_warning_message = ""
|
||||
if conversation_info.my_message_count > 5:
|
||||
spam_warning_message = f"⚠️【警告】**你已连续发送{str(conversation_info.my_message_count)}条消息!请注意不要再选择send_new_message!以免刷屏对造成对方困扰!**"
|
||||
elif conversation_info.my_message_count > 2:
|
||||
spam_warning_message = f"💬【警告】**你已连续发送{str(conversation_info.my_message_count)}条消息。请保持理智,如果非必要,请避免选择send_new_message,以免给对方造成困扰。**"
|
||||
# spam_warning_message = ""
|
||||
# if conversation_info.my_message_count > 5:
|
||||
# spam_warning_message = f"⚠️【警告】**你已连续发送{str(conversation_info.my_message_count)}条消息!请注意不要再选择send_new_message!以免刷屏对造成对方困扰!**"
|
||||
# elif conversation_info.my_message_count > 2:
|
||||
# spam_warning_message = f"💬【警告】**你已连续发送{str(conversation_info.my_message_count)}条消息。请保持理智,如果非必要,请避免选择send_new_message,以免给对方造成困扰。**"
|
||||
|
||||
else:
|
||||
prompt_template = PROMPT_INITIAL_REPLY
|
||||
log_msg = "使用 PROMPT_INITIAL_REPLY (首次/非连续回复决策)"
|
||||
spam_warning_message = "" # 初始回复时通常不需要刷屏警告
|
||||
# spam_warning_message = "" # 初始回复时通常不需要刷屏警告
|
||||
|
||||
logger.debug(f"[私聊][{self.private_name}] {log_msg}")
|
||||
|
||||
|
|
@ -271,8 +267,8 @@ 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 spam_warning_message:
|
||||
spam_warning_message = f"\n{spam_warning_message}\n"
|
||||
# if spam_warning_message:
|
||||
# spam_warning_message = f"\n{spam_warning_message}\n"
|
||||
|
||||
prompt = prompt_template.format(
|
||||
persona_text=persona_text,
|
||||
|
|
@ -285,7 +281,7 @@ class ActionPlanner:
|
|||
# retrieved_memory_str=retrieved_memory_str if retrieved_memory_str else "无相关记忆。",
|
||||
# retrieved_knowledge_str=retrieved_knowledge_str if retrieved_knowledge_str else "无相关知识。",
|
||||
current_time_str=current_time_value,
|
||||
spam_warning_info=spam_warning_message,
|
||||
# spam_warning_info=spam_warning_message,
|
||||
sender_name=sender_name_str,
|
||||
relationship_text=relationship_text_str,
|
||||
current_emotion_text=current_emotion_text_str,
|
||||
|
|
|
|||
|
|
@ -103,8 +103,6 @@ PROMPT_SEND_NEW_MESSAGE = """
|
|||
|
||||
{last_rejection_info}
|
||||
|
||||
{spam_warning_info}
|
||||
|
||||
请根据上述信息,判断你是否要继续发一条新消息(例如对之前消息的补充,深入话题,或追问等等)。如果你觉得要发送,该消息应该:
|
||||
1. 符合对话目标,以"你"的角度发言(不要自己与自己对话!)
|
||||
2. 符合你的性格特征和身份细节
|
||||
|
|
@ -280,14 +278,14 @@ class ReplyGenerator:
|
|||
)
|
||||
|
||||
# 新增:构建刷屏警告信息 for PROMPT_SEND_NEW_MESSAGE
|
||||
spam_warning_message = ""
|
||||
if action_type == "send_new_message": # 只在 send_new_message 时构建刷屏警告
|
||||
if conversation_info.my_message_count > 5:
|
||||
spam_warning_message = f"⚠️【警告】**你已连续发送{str(conversation_info.my_message_count)}条消息!请谨慎考虑是否继续发送!以免刷屏对造成对方困扰!**"
|
||||
elif conversation_info.my_message_count > 2:
|
||||
spam_warning_message = f"💬【提示】**你已连续发送{str(conversation_info.my_message_count)}条消息。如果非必要,请避免连续发送,以免给对方造成困扰。**"
|
||||
if spam_warning_message:
|
||||
spam_warning_message = f"\n{spam_warning_message}\n"
|
||||
# spam_warning_message = ""
|
||||
# if action_type == "send_new_message": # 只在 send_new_message 时构建刷屏警告
|
||||
# if conversation_info.my_message_count > 5:
|
||||
# spam_warning_message = f"⚠️【警告】**你已连续发送{str(conversation_info.my_message_count)}条消息!请谨慎考虑是否继续发送!以免刷屏对造成对方困扰!**"
|
||||
# elif conversation_info.my_message_count > 2:
|
||||
# spam_warning_message = f"💬【提示】**你已连续发送{str(conversation_info.my_message_count)}条消息。如果非必要,请避免连续发送,以免给对方造成困扰。**"
|
||||
# if spam_warning_message:
|
||||
# spam_warning_message = f"\n{spam_warning_message}\n"
|
||||
|
||||
# --- 选择 Prompt ---
|
||||
if action_type == "send_new_message":
|
||||
|
|
@ -326,7 +324,7 @@ class ReplyGenerator:
|
|||
|
||||
if action_type == "send_new_message":
|
||||
current_format_params = base_format_params.copy()
|
||||
current_format_params["spam_warning_info"] = spam_warning_message
|
||||
# current_format_params["spam_warning_info"] = spam_warning_message
|
||||
prompt = prompt_template.format(**current_format_params)
|
||||
elif action_type == "say_goodbye":
|
||||
farewell_params = {
|
||||
|
|
|
|||
Loading…
Reference in New Issue