Skip to content

web_ui: use configured api_base for Ollama in /api/models and warmup#18

Merged
rar-file merged 1 commit into
mainfrom
kaji/issue-17-8546
May 9, 2026
Merged

web_ui: use configured api_base for Ollama in /api/models and warmup#18
rar-file merged 1 commit into
mainfrom
kaji/issue-17-8546

Conversation

@kaji-codes

@kaji-codes kaji-codes Bot commented May 9, 2026

Copy link
Copy Markdown
Contributor

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.

Fixes #17

Opened by Kaji.

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.
@rar-file rar-file merged commit ed12ae2 into main May 9, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Web UI hardcodes http://localhost:11434 in /api/models and warmup, ignoring _config.api_base

1 participant