Skip to content

Commit 7b707f6

Browse files
committed
Update mock_server.py
1 parent 1e4738b commit 7b707f6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/mock_server.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,13 @@ async def generation(
366366
except Exception as e:
367367
raise HTTPException(status_code=400, detail=f"Invalid JSON: {e}")
368368

369+
# --- [Auto-enable stream mode based on header] ---
370+
accept_header = request.headers.get("accept", "")
371+
if "text/event-stream" in accept_header and body.parameters:
372+
logger.info("SSE client detected, forcing incremental_output=True")
373+
body.parameters.incremental_output = True
374+
375+
369376
# --- [Mock Handling] ---
370377
if SERVER_STATE.is_mock_mode:
371378
if body:

0 commit comments

Comments
 (0)