Fix agent non stream (#1904)

### What problem does this PR solve?

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
H
2024-08-12 12:00:59 +08:00
committed by GitHub
parent e9e39d57ce
commit cd861e3653
2 changed files with 8 additions and 14 deletions

View File

@ -282,13 +282,9 @@ def completion():
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)