fix: only response [DONE] once when streaming response. (#378)

This commit is contained in:
Ricardo Lu 2023-07-07 09:08:40 +08:00 committed by GitHub
parent 1c395b4eaa
commit b396cb4998
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -269,7 +269,7 @@ async def create_chat_completion(raw_request: Request):
finish_reason=output.finish_reason,
)
yield f"data: {response_json}\n\n"
yield "data: [DONE]\n\n"
yield "data: [DONE]\n\n"
# Streaming response
if request.stream:
@ -465,7 +465,7 @@ async def create_completion(raw_request: Request):
finish_reason=output.finish_reason,
)
yield f"data: {response_json}\n\n"
yield "data: [DONE]\n\n"
yield "data: [DONE]\n\n"
# Streaming response
if stream: