Browse Source

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 months ago
parent
commit
6784e0dfee
No account linked to committer's email address
1 changed files with 10 additions and 2 deletions
  1. 10
    2
      agent/component/base.py

+ 10
- 2
agent/component/base.py View File

if len(self._canvas.path) > 1: if len(self._canvas.path) > 1:
reversed_cpnts.extend(self._canvas.path[-2]) reversed_cpnts.extend(self._canvas.path[-2])
reversed_cpnts.extend(self._canvas.path[-1]) 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: if self._param.query:
self._param.inputs = [] self._param.inputs = []


upstream_outs = [] upstream_outs = []


for u in reversed_cpnts[::-1]:
for u in reversed_up_cpnts[::-1]:
if self.get_component_name(u) in ["switch", "concentrator"]: if self.get_component_name(u) in ["switch", "concentrator"]:
continue continue
if self.component_name.lower() == "generate" and self.get_component_name(u) == "retrieval": if self.component_name.lower() == "generate" and self.get_component_name(u) == "retrieval":
if len(self._canvas.path) > 1: if len(self._canvas.path) > 1:
reversed_cpnts.extend(self._canvas.path[-2]) reversed_cpnts.extend(self._canvas.path[-2])
reversed_cpnts.extend(self._canvas.path[-1]) 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"]: if self.get_component_name(u) in ["switch", "answer"]:
continue continue
return self._canvas.get_component(u)["obj"].output()[1] return self._canvas.get_component(u)["obj"].output()[1]
def get_parent(self): def get_parent(self):
pid = self._canvas.get_component(self._id)["parent_id"] pid = self._canvas.get_component(self._id)["parent_id"]
return self._canvas.get_component(pid)["obj"] return self._canvas.get_component(pid)["obj"]

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

Loading…
Cancel
Save