open-webui/backend
Tim Champ d827039b1b Fix task generation (title, tags, etc.) failing for direct connection chats
Two fixes for direct connection users where background task generation
(titles, tags, follow-ups) crashes with TypeError or returns 404:

1. middleware.py: Clear request.state.direct before running
   background_tasks_handler so task generation routes through the
   server-side path instead of generate_direct_chat_completion, which
   requires an active WebSocket session unavailable in this context.

2. tasks.py: Always use request.app.state.MODELS for task endpoints and
   move model validation after get_task_model_id() so the configured
   task model can resolve before the existence check runs. Previously,
   the chat model (from a direct connection) was validated before the
   task model override, causing a 404 when the chat model wasn't in the
   server's MODELS registry.

Fixes #24092, Fixes #24095

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-24 13:51:15 -04:00
..
data refac: mv backend files to /open_webui dir 2024-09-04 16:54:48 +02:00
open_webui Fix task generation (title, tags, etc.) failing for direct connection chats 2026-04-24 13:51:15 -04:00
.dockerignore fix: litellm config issue 2024-02-24 22:35:11 -08:00
.gitignore refac 2024-09-06 04:59:20 +02:00
dev.sh refac 2026-03-24 19:43:30 -05:00
requirements-min.txt refac 2026-04-24 18:20:10 +09:00
requirements.txt refactor(firecrawl): use v2 API directly (#23934) 2026-04-24 18:32:08 +09:00
start.sh refac 2026-03-24 19:43:30 -05:00
start_windows.bat refac 2026-04-24 15:40:02 +09:00