server: add data: [DONE] to /chat/completions stream response (#9459)
This commit is contained in:
parent
1f4111e540
commit
dcdcee3a74
2 changed files with 4 additions and 0 deletions
|
@ -1020,6 +1020,8 @@ async def oai_chat_completions(user_prompt,
|
|||
event_data = line.split(': ', 1)
|
||||
assert event_data[0] == 'data', f'Bad event code received: ```{event_data}```'
|
||||
chunk_raw = event_data[1]
|
||||
if chunk_raw == '[DONE]':
|
||||
break
|
||||
|
||||
chunk = json.loads(chunk_raw)
|
||||
assert len(chunk['choices']) == 1, f"no choices provided, line ```{line}```"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue