Fix multiple generate (#1722)

### What problem does this PR solve?

#1625 

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
H
2024-07-29 09:27:59 +08:00
committed by GitHub
parent 61096596bc
commit 013856b604
2 changed files with 35 additions and 52 deletions

View File

@@ -59,8 +59,10 @@ class Answer(ComponentBase, ABC):
stream = self.get_stream_input()
if isinstance(stream, pd.DataFrame):
res = stream
answer = ""
for ii, row in stream.iterrows():
yield row.to_dict()
answer += row.to_dict()["content"]
yield {"content": answer}
else:
for st in stream():
res = st