Kevin Hu commited on
Commit
2d687fd
·
1 Parent(s): ccbf758

refine get_input (#2630)

Browse files

### What problem does this PR solve?

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

agent/component/base.py CHANGED
@@ -444,7 +444,7 @@ class ComponentBase(ABC):
444
 
445
  if DEBUG: print(self.component_name, reversed_cpnts[::-1])
446
  for u in reversed_cpnts[::-1]:
447
- if self.get_component_name(u) in ["switch"]: continue
448
  if self.component_name.lower() == "generate" and self.get_component_name(u) == "retrieval":
449
  o = self._canvas.get_component(u)["obj"].output(allow_partial=False)[1]
450
  if o is not None:
@@ -472,7 +472,7 @@ class ComponentBase(ABC):
472
  if "content" in df:
473
  df = df.drop_duplicates(subset=['content']).reset_index(drop=True)
474
  return df
475
- return pd.DataFrame()
476
 
477
  def get_stream_input(self):
478
  reversed_cpnts = []
 
444
 
445
  if DEBUG: print(self.component_name, reversed_cpnts[::-1])
446
  for u in reversed_cpnts[::-1]:
447
+ if self.get_component_name(u) in ["switch", "concentrator"]: continue
448
  if self.component_name.lower() == "generate" and self.get_component_name(u) == "retrieval":
449
  o = self._canvas.get_component(u)["obj"].output(allow_partial=False)[1]
450
  if o is not None:
 
472
  if "content" in df:
473
  df = df.drop_duplicates(subset=['content']).reset_index(drop=True)
474
  return df
475
+ return pd.DataFrame(self._canvas.get_history(3)[-1:])
476
 
477
  def get_stream_input(self):
478
  reversed_cpnts = []
agent/component/concentrator.py CHANGED
@@ -33,9 +33,4 @@ class Concentrator(ComponentBase, ABC):
33
  component_name = "Concentrator"
34
 
35
  def _run(self, history, **kwargs):
36
- input = self.get_input()
37
- ans = " - ".join(input["content"]) if "content" in input else ""
38
- if not ans:
39
- return Concentrator.be_output("")
40
-
41
- return Concentrator.be_output(input)
 
33
  component_name = "Concentrator"
34
 
35
  def _run(self, history, **kwargs):
36
+ return Concentrator.be_output("")