Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refine get_input #2630

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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("")