Feat: add citation option to agent and enlarge the timeouts. (#9484)

### What problem does this PR solve?

#9422

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
Kevin Hu
2025-08-15 10:05:01 +08:00
committed by GitHub
parent 562349eb02
commit 2114e966d8
6 changed files with 22 additions and 21 deletions

View File

@ -244,7 +244,7 @@ class Agent(LLM, ToolBase):
def complete():
nonlocal hist
need2cite = self._canvas.get_reference()["chunks"] and self._id.find("-->") < 0
need2cite = self._param.cite and self._canvas.get_reference()["chunks"] and self._id.find("-->") < 0
cited = False
if hist[0]["role"] == "system" and need2cite:
if len(hist) < 7:

View File

@ -145,7 +145,7 @@ class LLM(ComponentBase):
prompt = self.string_format(prompt, args)
for m in msg:
m["content"] = self.string_format(m["content"], args)
if self._canvas.get_reference()["chunks"]:
if self._param.cite and self._canvas.get_reference()["chunks"]:
prompt += citation_prompt()
return prompt, msg