fix(api): require boolean stream values
Validate the OpenAI-compatible stream flag before choosing the response mode so string values such as "false" are rejected instead of enabling SSE. Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
1 parent
122a0f5d6f
commit
12c2c95cbb
2 files changed
+27
-1
No files matched your search
@@ -315,7 +315,10 @@ async def handle_chat_completions(request: web.Request) -> web.Response | web.St
|
||||
if not isinstance(body, dict):
|
||||
return _error_json(400, "Invalid JSON body")
|
||||
body = cast(dict[str, Any], body)
|
||||
stream = body.get("stream", False)
|
||||
stream_value = body.get("stream", False)
|
||||
if not isinstance(stream_value, bool):
|
||||
return _error_json(400, "stream must be a boolean")
|
||||
stream = stream_value
|
||||
requested_model = body.get("model")
|
||||
text, media_paths = _parse_json_content(body)
|
||||
session_id = body.get("session_id")
|
||||
|
||||
Reference in new issue
Block a user