mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-04 21:29:12 +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 = ""
|
||||
for chunk in chat:
|
||||
if len(chunk.choices) == 0:
|
||||
continue
|
||||
delta_chunk = chunk.choices[0].delta # type: ignore
|
||||
if isinstance(delta_chunk, str):
|
||||
aggregated_response += delta_chunk
|
||||
|
||||
Reference in New Issue
Block a user