修改提示词,增强tool调用约束

This commit is contained in:
玄凤科技
2025-04-17 10:00:13 +08:00
parent 208c045d3d
commit 9b6e57b143
3 changed files with 18 additions and 13 deletions
@@ -93,10 +93,10 @@ class LLMProvider(LLMProviderBase):
# 如果最后一个是 role="tool",附加到user上
if len(dialogue) > 1 and dialogue[-1]["role"] == "tool":
assistant_msg = "tool call result: " + dialogue[-1]["content"]
assistant_msg = "\ntool call result: " + dialogue[-1]["content"] + "\n\n"
while len(dialogue) > 1 :
if dialogue[-1]["role"] == "user":
dialogue[-1]["content"] += assistant_msg
dialogue[-1]["content"] = assistant_msg + dialogue[-1]["content"]
break
dialogue.pop()