mirror of
https://github.com/open-webui/open-webui.git
synced 2026-08-24 14:23:59 -05:00
The per-request Ollama handlers (chat, generate, embed, embeddings, and the OpenAI-compat completions/chat-completions/messages/responses endpoints) fetched 'ollama.api_configs' up to three times and 'ollama.base_urls' separately within a single request — the .get() default-argument pattern made the second api_configs fetch unconditional, and get_api_key() triggered a third. Up to four sequential SELECTs per request collapse to one. A new get_ollama_connection_config() helper fetches base_urls and api_configs together in one batched Config.get_many where both are needed; handlers that only need api_configs fetch it once into a local. Admin operations (pull/push/copy/delete) and the TTL-cached model-list path are deliberately left untouched. Resolution semantics (str(idx) key first, url-key legacy fallback, same defaults) are unchanged. Claude-Session: https://claude.ai/code/session_01MHg5zs1VBjvRWQ54qHpfYD Co-authored-by: Claude <noreply@anthropic.com>