WANGRUI-ZB
wangrui
commited on
Commit
·
0e1662f
1
Parent(s):
fd59b94
fix bug, agent invoke can not get params from begin (#4390)
Browse files### 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]>
- agent/component/invoke.py +16 -6
agent/component/invoke.py
CHANGED
@@ -50,12 +50,22 @@ class Invoke(ComponentBase, ABC):
|
|
50 |
args = {}
|
51 |
for para in self._param.variables:
|
52 |
if para.get("component_id"):
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
else:
|
60 |
args[para["key"]] = para["value"]
|
61 |
|
|
|
50 |
args = {}
|
51 |
for para in self._param.variables:
|
52 |
if para.get("component_id"):
|
53 |
+
if '@' in para["component_id"]:
|
54 |
+
component = para["component_id"].split('@')[0]
|
55 |
+
field = para["component_id"].split('@')[1]
|
56 |
+
cpn = self._canvas.get_component(component)["obj"]
|
57 |
+
for param in cpn._param.query:
|
58 |
+
if param["key"] == field:
|
59 |
+
if "value" in param:
|
60 |
+
args[para["key"]] = param["value"]
|
61 |
+
else:
|
62 |
+
cpn = self._canvas.get_component(para["component_id"])["obj"]
|
63 |
+
if cpn.component_name.lower() == "answer":
|
64 |
+
args[para["key"]] = self._canvas.get_history(1)[0]["content"]
|
65 |
+
continue
|
66 |
+
_, out = cpn.output(allow_partial=False)
|
67 |
+
if not out.empty:
|
68 |
+
args[para["key"]] = "\n".join(out["content"])
|
69 |
else:
|
70 |
args[para["key"]] = para["value"]
|
71 |
|