Merge pull request #131 from fauxpilot/fix-streaming

Fix json formatting issue with streaming
This commit is contained in:
Brendan Dolan-Gavitt 2022-12-24 17:54:12 -05:00 committed by GitHub
commit e18fbf5145
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -234,8 +234,8 @@ class CodeGenProxy:
for c in choices:
completion['id'] = self.random_completion_id()
completion['choices'] = [c]
yield f'data: {json.dumps(completion)}\n\n'
yield 'data: [DONE]\n\n'
yield f'{json.dumps(completion)}'
yield '[DONE]'
def non_streamed_response(self, completion, choices) -> str:
completion['id'] = self.random_completion_id()