浏览代码

Fix: Resolved a bug where sibling components in Canvas were not restricted to fetching data from the upstream when parallel components were present. (#6315)

### What problem does this PR solve?

Fix: Resolved a bug where sibling components in Canvas were not
restricted to fetching data from the upstream when parallel components
were present.
Issue: When parallel components existed in Canvas, sibling components
incorrectly fetched data without being limited to the upstream scope,
causing data retrieval issues.
Solution: Adjusted the data fetching logic to ensure sibling components
only retrieve data from the upstream scope.
### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
tags/v0.18.0
科幻大脑 7 个月前
父节点
当前提交
6784e0dfee
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 10 次插入2 次删除
  1. 10
    2
      agent/component/base.py

+ 10
- 2
agent/component/base.py 查看文件

@@ -463,6 +463,8 @@ class ComponentBase(ABC):
if len(self._canvas.path) > 1:
reversed_cpnts.extend(self._canvas.path[-2])
reversed_cpnts.extend(self._canvas.path[-1])
up_cpns = self.get_upstream()
reversed_up_cpnts = [cpn for cpn in reversed_cpnts if cpn in up_cpns]

if self._param.query:
self._param.inputs = []
@@ -505,7 +507,7 @@ class ComponentBase(ABC):

upstream_outs = []

for u in reversed_cpnts[::-1]:
for u in reversed_up_cpnts[::-1]:
if self.get_component_name(u) in ["switch", "concentrator"]:
continue
if self.component_name.lower() == "generate" and self.get_component_name(u) == "retrieval":
@@ -565,8 +567,10 @@ class ComponentBase(ABC):
if len(self._canvas.path) > 1:
reversed_cpnts.extend(self._canvas.path[-2])
reversed_cpnts.extend(self._canvas.path[-1])
up_cpns = self.get_upstream()
reversed_up_cpnts = [cpn for cpn in reversed_cpnts if cpn in up_cpns]

for u in reversed_cpnts[::-1]:
for u in reversed_up_cpnts[::-1]:
if self.get_component_name(u) in ["switch", "answer"]:
continue
return self._canvas.get_component(u)["obj"].output()[1]
@@ -584,3 +588,7 @@ class ComponentBase(ABC):
def get_parent(self):
pid = self._canvas.get_component(self._id)["parent_id"]
return self._canvas.get_component(pid)["obj"]

def get_upstream(self):
cpn_nms = self._canvas.get_component(self._id)['upstream']
return cpn_nms

正在加载...
取消
保存