Merge pull request #58 from devchat-ai/fix_chunk_content_none

Fix empty content issue in create_chat_completion_content function
This commit is contained in:
kagami 2024-01-29 17:58:25 +08:00 committed by GitHub
commit bcba74375b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -53,6 +53,6 @@ def create_chat_completion_content(client: Optional[OpenAI] = None, **kwargs) ->
for chunk in chunks:
if chunk.choices[0].finish_reason == "stop":
break
results.append(chunk.choices[0].delta.content)
results.append(chunk.choices[0].delta.content or "")
return "".join(results)