Skip to content

Commit

Permalink
Fix agent non stream (infiniflow#1904)
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
guoyuhao2330 authored Aug 12, 2024
1 parent 83d525b commit 000d370
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
12 changes: 5 additions & 7 deletions agent/component/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,13 +460,11 @@ def get_input(self):
upstream_outs.append(pd.DataFrame([{"content": c}]))
break
break
if self.component_name.lower().find("answer") >= 0:
if self.get_component_name(u) in ["relevant"]:
continue
else:
o = self._canvas.get_component(u)["obj"].output(allow_partial=False)[1]
if o is not None:
upstream_outs.append(o)
if self.component_name.lower().find("answer") >= 0 and self.get_component_name(u) in ["relevant"]:
continue
o = self._canvas.get_component(u)["obj"].output(allow_partial=False)[1]
if o is not None:
upstream_outs.append(o)
break

if upstream_outs:
Expand Down
10 changes: 3 additions & 7 deletions api/apps/api_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,13 +282,9 @@ def sse():
canvas.reference.append(final_ans["reference"])
cvs.dsl = json.loads(str(canvas))

result = None
for ans in answer():
ans = {"answer": ans["content"], "reference": ans.get("reference", [])}
result = ans
fillin_conv(ans)
API4ConversationService.append_message(conv.id, conv.to_dict())
break
result = {"answer": final_ans["content"], "reference": final_ans.get("reference", [])}
fillin_conv(result)
API4ConversationService.append_message(conv.id, conv.to_dict())
rename_field(result)
return get_json_result(data=result)

Expand Down

0 comments on commit 000d370

Please sign in to comment.