更新时间戳显示模式,在消息回复和规划器规划时:消息将显示完整日期 (如: 2024-01-15 14:30:22)
This commit is contained in:
committed by
Windpicker-owo
parent
9af7cd0ccf
commit
f53cd56148
@@ -35,7 +35,6 @@ def init_prompt():
|
|||||||
{mood_block}
|
{mood_block}
|
||||||
{time_block}
|
{time_block}
|
||||||
{identity_block}
|
{identity_block}
|
||||||
你的核心任务是智能判断消息是否真正需要你的回应,避免强行插话或无意义的参与。只有当消息确实针对你或你能提供有价值的回应时才参与对话。
|
|
||||||
|
|
||||||
{custom_prompt_block}
|
{custom_prompt_block}
|
||||||
{chat_context_description},以下是具体的聊天内容
|
{chat_context_description},以下是具体的聊天内容
|
||||||
@@ -295,7 +294,7 @@ class ActionPlanner:
|
|||||||
|
|
||||||
chat_content_block, message_id_list = build_readable_messages_with_id(
|
chat_content_block, message_id_list = build_readable_messages_with_id(
|
||||||
messages=message_list_before_now,
|
messages=message_list_before_now,
|
||||||
timestamp_mode="normal_no_YMD",
|
timestamp_mode="normal",
|
||||||
read_mark=self.last_obs_time_mark,
|
read_mark=self.last_obs_time_mark,
|
||||||
truncate=True,
|
truncate=True,
|
||||||
show_actions=True,
|
show_actions=True,
|
||||||
|
|||||||
@@ -598,7 +598,7 @@ class DefaultReplyer:
|
|||||||
all_dialogue_prompt_str = build_readable_messages(
|
all_dialogue_prompt_str = build_readable_messages(
|
||||||
latest_25_msgs,
|
latest_25_msgs,
|
||||||
replace_bot_name=True,
|
replace_bot_name=True,
|
||||||
timestamp_mode="normal_no_YMD",
|
timestamp_mode="normal",
|
||||||
truncate=True,
|
truncate=True,
|
||||||
)
|
)
|
||||||
all_dialogue_prompt = f"所有用户的发言:\n{all_dialogue_prompt_str}"
|
all_dialogue_prompt = f"所有用户的发言:\n{all_dialogue_prompt_str}"
|
||||||
@@ -606,33 +606,18 @@ class DefaultReplyer:
|
|||||||
# 构建核心对话 prompt
|
# 构建核心对话 prompt
|
||||||
core_dialogue_prompt = ""
|
core_dialogue_prompt = ""
|
||||||
if core_dialogue_list:
|
if core_dialogue_list:
|
||||||
# 检查最新五条消息中是否包含bot自己说的消息
|
core_dialogue_list = core_dialogue_list[-int(global_config.chat.max_context_size * 2) :] # 限制消息数量
|
||||||
latest_5_messages = core_dialogue_list[-5:] if len(core_dialogue_list) >= 5 else core_dialogue_list
|
|
||||||
has_bot_message = any(str(msg.get("user_id")) == bot_id for msg in latest_5_messages)
|
|
||||||
|
|
||||||
# logger.info(f"最新五条消息:{latest_5_messages}")
|
core_dialogue_prompt_str = build_readable_messages(
|
||||||
# logger.info(f"最新五条消息中是否包含bot自己说的消息:{has_bot_message}")
|
core_dialogue_list,
|
||||||
|
replace_bot_name=True,
|
||||||
# 如果最新五条消息中不包含bot的消息,则返回空字符串
|
merge_messages=False,
|
||||||
if not has_bot_message:
|
timestamp_mode="normal",
|
||||||
core_dialogue_prompt = ""
|
read_mark=0.0,
|
||||||
else:
|
truncate=True,
|
||||||
core_dialogue_list = core_dialogue_list[-int(global_config.chat.max_context_size * 0.6) :] # 限制消息数量
|
show_actions=True,
|
||||||
|
)
|
||||||
core_dialogue_prompt_str = build_readable_messages(
|
core_dialogue_prompt = core_dialogue_prompt_str
|
||||||
core_dialogue_list,
|
|
||||||
replace_bot_name=True,
|
|
||||||
merge_messages=False,
|
|
||||||
timestamp_mode="normal_no_YMD",
|
|
||||||
read_mark=0.0,
|
|
||||||
truncate=True,
|
|
||||||
show_actions=True,
|
|
||||||
)
|
|
||||||
core_dialogue_prompt = f"""--------------------------------
|
|
||||||
这是你和{sender}的对话,你们正在交流中:
|
|
||||||
{core_dialogue_prompt_str}
|
|
||||||
--------------------------------
|
|
||||||
"""
|
|
||||||
|
|
||||||
return core_dialogue_prompt, all_dialogue_prompt
|
return core_dialogue_prompt, all_dialogue_prompt
|
||||||
|
|
||||||
@@ -897,7 +882,7 @@ class DefaultReplyer:
|
|||||||
unified_message_list,
|
unified_message_list,
|
||||||
replace_bot_name=True,
|
replace_bot_name=True,
|
||||||
merge_messages=False,
|
merge_messages=False,
|
||||||
timestamp_mode="normal_no_YMD",
|
timestamp_mode="normal",
|
||||||
read_mark=0.0,
|
read_mark=0.0,
|
||||||
truncate=True,
|
truncate=True,
|
||||||
show_actions=True,
|
show_actions=True,
|
||||||
|
|||||||
@@ -221,6 +221,14 @@ class ChatConfig(ConfigBase):
|
|||||||
planner_custom_prompt_content: str = ""
|
planner_custom_prompt_content: str = ""
|
||||||
"""决策器自定义提示词内容,仅在planner_custom_prompt_enable为True时生效"""
|
"""决策器自定义提示词内容,仅在planner_custom_prompt_enable为True时生效"""
|
||||||
|
|
||||||
|
timestamp_display_mode: Literal["normal", "normal_no_YMD", "relative"] = "normal_no_YMD"
|
||||||
|
"""
|
||||||
|
消息时间戳显示模式:
|
||||||
|
- normal: 完整日期时间格式 (YYYY-MM-DD HH:MM:SS)
|
||||||
|
- normal_no_YMD: 仅显示时间 (HH:MM:SS)
|
||||||
|
- relative: 相对时间格式 (几分钟前/几小时前等)
|
||||||
|
"""
|
||||||
|
|
||||||
def get_current_talk_frequency(self, chat_stream_id: Optional[str] = None) -> float:
|
def get_current_talk_frequency(self, chat_stream_id: Optional[str] = None) -> float:
|
||||||
"""
|
"""
|
||||||
根据当前时间和聊天流获取对应的 talk_frequency
|
根据当前时间和聊天流获取对应的 talk_frequency
|
||||||
|
|||||||
Reference in New Issue
Block a user