Skip to content

Detect Ollama models at a custom Base URL #57

Closed

Description

@francescobianco

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.

@AdityaWagh06 this is yours as discussed in #46. Thank you! 🙏

Activity

  1. AdityaWagh06 commented on Nov 18, 2026

    @AdityaWagh06
    Contributor

    Thanks @francescobianco, I'm on it! Short plan:

    1. 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.
    2. Normalize the URL: strip spaces and a trailing /, add /v1 when missing, accept only http/https.
    3. Keep the same 2 s timeout and bodyless GET, and name the probed host in status messages.
    4. Tests with the fake server: custom URL (with and without / and /v1), refused connection, timeout, invalid scheme. Existing tests unchanged.

    PR coming shortly.

  2. added a commit that references this issue on Nov 23, 2026
    e75be5b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions