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)
This commit is contained in:
Kevin Hu
2025-09-02 11:06:17 +08:00
committed by GitHub
parent 2e00d8d3d4
commit 79968c37a8

View File

@ -17,6 +17,7 @@ import json
import logging import logging
import os import os
import re import re
from copy import deepcopy
from typing import Any, Generator from typing import Any, Generator
import json_repair import json_repair
from functools import partial from functools import partial
@ -141,7 +142,7 @@ class LLM(ComponentBase):
for p in self._param.prompts: for p in self._param.prompts:
if msg and msg[-1]["role"] == p["role"]: if msg and msg[-1]["role"] == p["role"]:
continue continue
msg.append(p) msg.append(deepcopy(p))
sys_prompt = self.string_format(sys_prompt, args) sys_prompt = self.string_format(sys_prompt, args)
for m in msg: for m in msg: