Skip to content

Commit

Permalink
refine get_input (infiniflow#2630)
Browse files Browse the repository at this point in the history
### What problem does this PR solve?

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
  • Loading branch information
KevinHuSh authored Sep 27, 2024
1 parent a246e56 commit 674d342
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
4 changes: 2 additions & 2 deletions agent/component/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ def get_input(self):

if DEBUG: print(self.component_name, reversed_cpnts[::-1])
for u in reversed_cpnts[::-1]:
if self.get_component_name(u) in ["switch"]: continue
if self.get_component_name(u) in ["switch", "concentrator"]: continue
if self.component_name.lower() == "generate" and self.get_component_name(u) == "retrieval":
o = self._canvas.get_component(u)["obj"].output(allow_partial=False)[1]
if o is not None:
Expand Down Expand Up @@ -472,7 +472,7 @@ def get_input(self):
if "content" in df:
df = df.drop_duplicates(subset=['content']).reset_index(drop=True)
return df
return pd.DataFrame()
return pd.DataFrame(self._canvas.get_history(3)[-1:])

def get_stream_input(self):
reversed_cpnts = []
Expand Down
7 changes: 1 addition & 6 deletions agent/component/concentrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,4 @@ class Concentrator(ComponentBase, ABC):
component_name = "Concentrator"

def _run(self, history, **kwargs):
input = self.get_input()
ans = " - ".join(input["content"]) if "content" in input else ""
if not ans:
return Concentrator.be_output("")

return Concentrator.be_output(input)
return Concentrator.be_output("")

0 comments on commit 674d342

Please sign in to comment.