Skip to content

Commit

Permalink
fix bug, agent invoke can not get params from begin (#4390)
Browse files Browse the repository at this point in the history
### What problem does this PR solve?

fix bug, agent invoke can not get params from begin

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

Co-authored-by: wangrui <[email protected]>
  • Loading branch information
WANGRUI-ZB and wangrui authored Jan 7, 2025
1 parent 8ec392a commit 01a122d
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions agent/component/invoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,22 @@ def _run(self, history, **kwargs):
args = {}
for para in self._param.variables:
if para.get("component_id"):
cpn = self._canvas.get_component(para["component_id"])["obj"]
if cpn.component_name.lower() == "answer":
args[para["key"]] = self._canvas.get_history(1)[0]["content"]
continue
_, out = cpn.output(allow_partial=False)
args[para["key"]] = "\n".join(out["content"])
if '@' in para["component_id"]:
component = para["component_id"].split('@')[0]
field = para["component_id"].split('@')[1]
cpn = self._canvas.get_component(component)["obj"]
for param in cpn._param.query:
if param["key"] == field:
if "value" in param:
args[para["key"]] = param["value"]
else:
cpn = self._canvas.get_component(para["component_id"])["obj"]
if cpn.component_name.lower() == "answer":
args[para["key"]] = self._canvas.get_history(1)[0]["content"]
continue
_, out = cpn.output(allow_partial=False)
if not out.empty:
args[para["key"]] = "\n".join(out["content"])
else:
args[para["key"]] = para["value"]

Expand Down

0 comments on commit 01a122d

Please sign in to comment.