You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Follow-up to #46 (local Ollama detection, thanks @AdityaWagh06).
Today the Detect button in Preferences always probes http://localhost:11434/v1/models (discover_ollama_models in gknowledge/providers/openai_compatible.py). If the Base URL points to an Ollama on another machine, e.g. http://192.168.1.50:11434/v1, Detect finds nothing, or it lists the local server's models instead of the remote ones.
Proposal: when the user explicitly clicks Detect and the Base URL field holds a URL they typed themselves (not empty and not the OpenAI default, see should_prefill_ollama_base_url), probe <Base URL>/models instead of localhost.
Keep as is
The automatic probe when Ollama (local) is selected still goes only to localhost. No request to a non-local host happens without an explicit click.
Same 2 s timeout, a GET with no body, no document content sent.
Same error handling and status messages, naming the host that was probed.
Acceptance
Unit tests with the fake server for a custom Base URL (with and without a trailing /, with and without /v1), refused connection, timeout.
The existing localhost tests still pass.
A screenshot of Preferences listing models from a non-default URL, if you can set one up.
Only an explicit Detect click uses the Base URL, and only when the user typed one (not empty and not the OpenAI default). The automatic probe stays on localhost.
Normalize the URL: strip spaces and a trailing /, add /v1 when missing, accept only http/https.
Keep the same 2 s timeout and bodyless GET, and name the probed host in status messages.
Tests with the fake server: custom URL (with and without / and /v1), refused connection, timeout, invalid scheme. Existing tests unchanged.
Activity
AdityaWagh06 commentedon Nov 18, 2026
Thanks @francescobianco, I'm on it! Short plan:
/, add/v1when missing, accept onlyhttp/https./and/v1), refused connection, timeout, invalid scheme. Existing tests unchanged.PR coming shortly.
feat(prefs): detect Ollama models at a custom Base URL (openapi#59)