From 4f6ae8239d8a172d0c68e8e0aaedb31f804e9221 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Pyykk=C3=B6nen?= Date: Wed, 20 Nov 2024 09:25:50 +0200 Subject: [PATCH] fix: handle http exceptions --- backend/open_webui/main.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/backend/open_webui/main.py b/backend/open_webui/main.py index c145ca1b8..6a7cbb7eb 100644 --- a/backend/open_webui/main.py +++ b/backend/open_webui/main.py @@ -855,6 +855,11 @@ class PipelineMiddleware(BaseHTTPMiddleware): status_code=status.HTTP_401_UNAUTHORIZED, content={"detail": "Not authenticated"}, ) + except HTTPException as e: + return JSONResponse( + status_code=e.status_code, + content={"detail": e.detail}, + ) model_list = await get_all_models() models = {model["id"]: model for model in model_list}