This commit is contained in:
Timothy Jaeryang Baek
2026-02-04 21:46:20 -06:00
parent 020cb0d4bf
commit 3ace75820e
2 changed files with 230 additions and 180 deletions
+12 -8
View File
@@ -511,7 +511,11 @@ from open_webui.utils.chat import (
chat_action as chat_action_handler,
)
from open_webui.utils.embeddings import generate_embeddings
from open_webui.utils.middleware import process_chat_payload, process_chat_response
from open_webui.utils.middleware import (
build_chat_response_context,
process_chat_payload,
process_chat_response,
)
from open_webui.utils.access_control import has_access
from open_webui.utils.auth import (
@@ -1379,9 +1383,9 @@ async def check_url(request: Request, call_next):
# Fallback to cookie token for browser sessions
if request.state.token is None and request.cookies.get("token"):
from fastapi.security import HTTPAuthorizationCredentials
request.state.token = HTTPAuthorizationCredentials(
scheme="Bearer",
credentials=request.cookies.get("token")
scheme="Bearer", credentials=request.cookies.get("token")
)
request.state.enable_api_keys = app.state.config.ENABLE_API_KEYS
@@ -1456,9 +1460,7 @@ app.include_router(functions.router, prefix="/api/v1/functions", tags=["function
app.include_router(
evaluations.router, prefix="/api/v1/evaluations", tags=["evaluations"]
)
app.include_router(
analytics.router, prefix="/api/v1/analytics", tags=["analytics"]
)
app.include_router(analytics.router, prefix="/api/v1/analytics", tags=["analytics"])
app.include_router(utils.router, prefix="/api/v1/utils", tags=["utils"])
# SCIM 2.0 API for identity management
@@ -1746,9 +1748,11 @@ async def chat_completion(
except:
pass
return await process_chat_response(
request, response, form_data, user, metadata, model, events, tasks
ctx = build_chat_response_context(
request, form_data, user, model, metadata, tasks, events
)
return await process_chat_response(response, ctx)
except asyncio.CancelledError:
log.info("Chat processing was cancelled")
try: