fix(streaming_handler.py): fix check when response id already set

This commit is contained in:
Krrish Dholakia 2025-05-21 12:30:28 -07:00
parent 647c473971
commit e156636b8e

View file

@ -697,10 +697,11 @@ class CustomStreamWrapper:
If a valid ID is received in any chunk, use it for the response.
"""
if self.response_id is None and id and isinstance(id, str) and id.strip():
self.response_id = id
if id and isinstance(id, str) and id.strip():
self.response_id = id
elif self.response_id is None:
self.response_id = id
model_response._hidden_params["received_model_id"] = id
if self.response_id is not None and isinstance(self.response_id, str):
model_response.id = self.response_id