mirror of
https://github.com/open-webui/open-webui.git
synced 2026-09-28 01:31:28 +00:00
fix: wrap non-JSON SSE error responses in JSON so middleware handles them
This commit is contained in:
parent
7c527837f0
commit
7ab0478f31
1 changed files with 4 additions and 1 deletions
|
|
@ -1206,7 +1206,10 @@ async def generate_chat_completion(
|
|||
error_json = json.loads(error_body)
|
||||
return JSONResponse(status_code=r.status, content=error_json)
|
||||
except json.JSONDecodeError:
|
||||
return PlainTextResponse(status_code=r.status, content=error_body)
|
||||
return JSONResponse(
|
||||
status_code=r.status,
|
||||
content={"error": {"message": error_body, "code": r.status}},
|
||||
)
|
||||
|
||||
streaming = True
|
||||
return StreamingResponse(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue