refactor(chat): 调整分段指令在提示词中的位置

将回复分割指令从注入到 "现在,你说:" 之前,改为直接添加到整个提示词的顶部。

这种调整简化了提示词的构建逻辑,并确保分割指令作为最高优先级的上下文被模型处理,从而提高其遵循指令的稳定性。
This commit is contained in:
minecraft1024a
2025-09-12 19:08:16 +08:00
parent ebb575ec53
commit eb5011ada1

View File

@@ -1038,10 +1038,8 @@ class DefaultReplyer:
**任务**: 请结合你的智慧和人设,自然地决定是否需要分段。如果需要,请在最恰当的位置插入 `[SPLIT]` 标记。
"""
# 在 "现在,你说:" 之前插入
parts = prompt_text.rsplit("现在,你说:", 1)
if len(parts) == 2:
prompt_text = f"{parts[0]}{split_instruction}\n现在,你说:{parts[1]}"
# 将分段指令添加到提示词顶部
prompt_text = f"{split_instruction}\n{prompt_text}"
return prompt_text