fix(backend/chat): Filter duplicate StreamStart from non-SDK path

Routes.py already publishes a StreamStart before calling the service.
The SDK path filters the duplicate internally, but the non-SDK path
did not, causing two StreamStart events to reach the frontend.
This commit is contained in:
Zamil Majdy
2026-02-11 06:52:47 +04:00
parent 9791bdd724
commit 7cffa1895f

View File

@@ -417,6 +417,9 @@ async def stream_chat_post(
session=session, # Pass session with message already added
context=request.context,
):
# Skip duplicate StreamStart — we already published one above
if isinstance(chunk, StreamStart):
continue
chunk_count += 1
if first_chunk_time is None:
first_chunk_time = time_module.perf_counter()