fix(proxy_server.py): return [DONE] end of stream chunk

This commit is contained in:
Krrish Dholakia 2023-12-28 11:30:30 +05:30
parent 7822a8d421
commit bf4c4426e5

View file

@ -913,6 +913,10 @@ async def async_data_generator(response, user_api_key_dict):
yield f"data: {json.dumps(chunk.dict())}\n\n"
except Exception as e:
yield f"data: {str(e)}\n\n"
# Streaming is done, yield the [DONE] chunk
done_message = "[DONE]"
yield f"data: {done_message}\n\n"
except Exception as e:
yield f"data: {str(e)}\n\n"