mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-29 21:08:47 -05:00
[PR #24800] [CLOSED] feat: Add Load/Preload Model button for Ollama models #131520
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/24800
Author: @Sarvind1
Created: 5/15/2026
Status: ❌ Closed
Base:
dev← Head:feature/load-model-button📝 Commits (1)
4d2c927feat: add Load/Preload button for Ollama models in model selector📊 Changes
5 files changed (+141 additions, -1 deletions)
View changed files
📝
backend/open_webui/main.py(+64 -0)📝
src/lib/apis/index.ts(+33 -0)📝
src/lib/components/chat/ModelSelector/ModelItem.svelte(+21 -0)📝
src/lib/components/chat/ModelSelector/Selector.svelte(+19 -1)📝
src/lib/i18n/locales/en-US/translation.json(+4 -0)📄 Description
Summary
Adds a Load / Preload Model button to the model selector dropdown — the missing counterpart to the existing Eject (unload) button. When an Ollama model is idle (not loaded in VRAM), admins can now preload it before starting a chat, eliminating cold-start latency.
Resolves community request in Discussion #14750 and related Issue #3987.
What changed
backend/open_webui/main.pyPOST /api/models/loadendpoint. Resolves the Ollama node(s) for the model and sends a keep-alive generate request (keep_alive: 5m, empty prompt) to warm the model into VRAM. Admin-only.src/lib/apis/index.tsloadModel()client function that calls the backend endpoint.src/lib/components/chat/ModelSelector/Selector.svelteloadModelHandler— callsloadModel(), shows toast notifications, refreshes the model list on success.src/lib/components/chat/ModelSelector/ModelItem.sveltesrc/lib/i18n/locales/en-US/translation.jsonLoad,Load model,Loading model...,Model loaded successfully.How it works
POST /api/models/loadaccepts{ "model": "<model_id>" }. It looks up the model inOLLAMA_MODELS, resolves prefix IDs and API keys per Ollama node, then sendsPOST /api/generatewith an empty prompt andkeep_alive: "5m"to warm the model. Returns{ "status": true }on success or a 500 with per-node error details.!item.model.loaded && item.model.owned_by === 'ollama'). Once loaded, the button disappears and the existing Eject button becomes visible instead.Screenshots
The Load button (download icon) appears next to idle Ollama models in the selector dropdown. After loading, it's replaced by the existing Eject button (upload icon). Non-Ollama models and non-admin users see no change.
Testing
ollama ps).Notes
unload_modelendpoint structure).keep_alive: "5m"default matches Ollama's standard behavior; the model stays warm for 5 minutes after the preload request.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.