web_ui: use configured api_base for Ollama in /api/models and warmup#18
Merged
Conversation
Summary Fixes GitHub issue #17: the web UI hardcoded "http://localhost:11434" in two places, ignoring the configured api_base. This caused the model dropdown (/api/models) and the background warmup to always target the default local Ollama host even when users set a different API base (via /url or POST /api/settings). What I changed - core/web_ui.py - api_models(): now uses base = _config.api_base or "http://localhost:11434" and requests f"{base}/api/tags" instead of the hardcoded URL. - _trigger_warmup()._do_warmup(): now uses base = _config.api_base or "http://localhost:11434" and posts to f"{base}/api/generate" instead of the hardcoded URL. This follows the same pattern already used elsewhere in web_ui.py (e.g. _get_model_context_size) so that the web UI consistently honors the api_base setting. Notes - I made the minimal changes necessary for the web UI endpoints described in the issue. There are other occurrences of hardcoded "http://localhost:11434" in the repository (core/surf.py, core/quick_chat.py) that were not part of this issue; I left them unchanged to keep the PR focused. Tests - Ran the test suite locally: 11 passed (pytest). The changes are small and do not affect existing tests. If you'd like, I can also update other parts of the codebase to consistently use the configured api_base (e.g. surf.py and quick_chat.py) in a follow-up PR. Generated by Kaji.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes GitHub issue #17: the web UI hardcoded "http://localhost:11434" in two places, ignoring the configured api_base. This caused the model dropdown (/api/models) and the background warmup to always target the default local Ollama host even when users set a different API base (via /url or POST /api/settings).
What I changed
This follows the same pattern already used elsewhere in web_ui.py (e.g. _get_model_context_size) so that the web UI consistently honors the api_base setting.
Notes
Tests
If you'd like, I can also update other parts of the codebase to consistently use the configured api_base (e.g. surf.py and quick_chat.py) in a follow-up PR.
Fixes #17
Opened by Kaji.