From 79968c37a8e642f7e9a405d0796367cafaecb108 Mon Sep 17 00:00:00 2001 From: Kevin Hu Date: Tue, 2 Sep 2025 11:06:17 +0800 Subject: [PATCH] Fix: agent second round issue. (#9863) ### What problem does this PR solve? ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- agent/component/llm.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/agent/component/llm.py b/agent/component/llm.py index b68f6abe1..f02d957a4 100644 --- a/agent/component/llm.py +++ b/agent/component/llm.py @@ -17,6 +17,7 @@ import json import logging import os import re +from copy import deepcopy from typing import Any, Generator import json_repair from functools import partial @@ -141,7 +142,7 @@ class LLM(ComponentBase): for p in self._param.prompts: if msg and msg[-1]["role"] == p["role"]: continue - msg.append(p) + msg.append(deepcopy(p)) sys_prompt = self.string_format(sys_prompt, args) for m in msg: