mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-08 05:39:13 +00:00
Handle end of chunk logic in openai stream processor
This commit is contained in:
@@ -56,6 +56,8 @@ def completion_with_backoff(
|
|||||||
)
|
)
|
||||||
aggregated_response = ""
|
aggregated_response = ""
|
||||||
for chunk in chat:
|
for chunk in chat:
|
||||||
|
if len(chunk.choices) == 0:
|
||||||
|
continue
|
||||||
delta_chunk = chunk.choices[0].delta # type: ignore
|
delta_chunk = chunk.choices[0].delta # type: ignore
|
||||||
if isinstance(delta_chunk, str):
|
if isinstance(delta_chunk, str):
|
||||||
aggregated_response += delta_chunk
|
aggregated_response += delta_chunk
|
||||||
|
|||||||
Reference in New Issue
Block a user