Repository navigation
feat(prefs): detect Ollama models at a custom Base URL - #59
Open
AdityaWagh06 wants to merge 2 commits into
Open
AdityaWagh06 wants to merge 2 commits into
AdityaWagh06 wants to merge 2 commits into
Conversation
An explicit Detect click now probes <Base URL>/models when the Base URL holds a URL the user typed (not empty and not the OpenAI default). The automatic probe when "Ollama (local)" is selected still goes only to localhost, so no non-local host is contacted without a click. - ollama_models_url() normalizes the Base URL: strips spaces and trailing slashes, adds /v1 when missing, and accepts only http and https. - ollama_detect_endpoint() picks the endpoint for an automatic or explicit detection. - Status messages name the probed host and port (never credentials). - Same 2 s timeout and bodyless GET as before. Closes openapi#57
The model list can now come from a server on another machine.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
This branch has not been deployed
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
An explicit Detect click now probes
<Base URL>/modelswhen the Base URL holds a URL the user typed (not empty and not the OpenAI default). Closes #57.What stays the same
localhost:11434. No non-local host is contacted without a click.Changes
ollama_models_url(): strips spaces and a trailing/, adds/v1when missing, accepts onlyhttp/https. Anything else shows an error in Preferences and sends no request.ollama_detect_endpoint(): localhost for the automatic probe, the typed URL for an explicit click.Screenshots
Detect with a non-default Base URL (
http://172.28.34.102:11500/v1, a server on another network address and port):Detect when nothing answers at that URL:
The screenshots were taken on Ubuntu 24.04 (GTK 4.14, libadwaita 1.5) with a small stand-in server that answers
GET /v1/modelsthe same way Ollama does.Tests
Fake-server tests for a custom Base URL (with and without a trailing
/and/v1), refused connection, timeout, non-http schemes and invalid ports, plus a check that the automatic probe stays on localhost. All existing tests pass (tests/test_openai_compatible.py: 43 passed;tests/test_core.py: passed).