mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-14 00:15:53 +08:00
Fix: catch non-begin component output (#7827)
### What problem does this PR solve? Catch non-begin component output ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
parent
d285a12b85
commit
6ca1aef52e
@ -79,7 +79,7 @@ class Code(ComponentBase, ABC):
|
|||||||
def _run(self, history, **kwargs):
|
def _run(self, history, **kwargs):
|
||||||
arguments = {}
|
arguments = {}
|
||||||
for input in self._param.arguments:
|
for input in self._param.arguments:
|
||||||
assert "@" in input["component_id"], "Each code argument should bind to a specific compontent"
|
if "@" in input["component_id"]:
|
||||||
component_id = input["component_id"].split("@")[0]
|
component_id = input["component_id"].split("@")[0]
|
||||||
refered_component_key = input["component_id"].split("@")[1]
|
refered_component_key = input["component_id"].split("@")[1]
|
||||||
refered_component = self._canvas.get_component(component_id)["obj"]
|
refered_component = self._canvas.get_component(component_id)["obj"]
|
||||||
@ -88,6 +88,14 @@ class Code(ComponentBase, ABC):
|
|||||||
if param["key"] == refered_component_key:
|
if param["key"] == refered_component_key:
|
||||||
if "value" in param:
|
if "value" in param:
|
||||||
arguments[input["name"]] = param["value"]
|
arguments[input["name"]] = param["value"]
|
||||||
|
else:
|
||||||
|
cpn = self._canvas.get_component(input["component_id"])["obj"]
|
||||||
|
if cpn.component_name.lower() == "answer":
|
||||||
|
arguments[input["name"]] = self._canvas.get_history(1)[0]["content"]
|
||||||
|
continue
|
||||||
|
_, out = cpn.output(allow_partial=False)
|
||||||
|
if not out.empty:
|
||||||
|
arguments[input["name"]] = "\n".join(out["content"])
|
||||||
|
|
||||||
return self._execute_code(
|
return self._execute_code(
|
||||||
language=self._param.lang,
|
language=self._param.lang,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user