fix bug of chat without stream (#830)

### What problem does this PR solve?

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
KevinHuSh
2024-05-17 20:03:00 +08:00
committed by GitHub
parent 2bfacd0469
commit 673a28e492
3 changed files with 17 additions and 13 deletions

View File

@ -162,10 +162,13 @@ def completion():
return resp
else:
ans = chat(dia, msg, **req)
fillin_conv(ans)
ConversationService.update_by_id(conv.id, conv.to_dict())
return get_json_result(data=ans)
answer = None
for ans in chat(dia, msg, **req):
answer = ans
fillin_conv(ans)
ConversationService.update_by_id(conv.id, conv.to_dict())
break
return get_json_result(data=answer)
except Exception as e:
return server_error_response(e)