Unverified Commit b396cb49 authored by Ricardo Lu's avatar Ricardo Lu Committed by GitHub
Browse files

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

parent 1c395b4e
...@@ -269,7 +269,7 @@ async def create_chat_completion(raw_request: Request): ...@@ -269,7 +269,7 @@ async def create_chat_completion(raw_request: Request):
finish_reason=output.finish_reason, finish_reason=output.finish_reason,
) )
yield f"data: {response_json}\n\n" yield f"data: {response_json}\n\n"
yield "data: [DONE]\n\n" yield "data: [DONE]\n\n"
# Streaming response # Streaming response
if request.stream: if request.stream:
...@@ -465,7 +465,7 @@ async def create_completion(raw_request: Request): ...@@ -465,7 +465,7 @@ async def create_completion(raw_request: Request):
finish_reason=output.finish_reason, finish_reason=output.finish_reason,
) )
yield f"data: {response_json}\n\n" yield f"data: {response_json}\n\n"
yield "data: [DONE]\n\n" yield "data: [DONE]\n\n"
# Streaming response # Streaming response
if stream: if stream:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment