Repository navigation
feat(prefs): detect a local Ollama server and offer its models - #46
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
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.
|
Thanks a lot @AdityaWagh06, and sorry for the week of silence: this is a really solid PR. Probing only on user action, always against the local default and with a 2 s timeout is exactly the privacy behaviour I wanted, and the fake-server tests (bodyless GET, refused connection, timeout, malformed payloads) are better than most of the suite. I've read the whole diff; two small, non-blocking notes:
CI for fork PRs needs a maintainer to approve the run; that's on me now, and I'll merge once it's green. Since #5 asks for the same thing as #19, I'll close both with this PR. |
|
CI is green on every job (test, metadata, deb, flatpak), so this is merged. Thanks again @AdityaWagh06! This is your third contribution after #1 and #19, and Ollama detection is the kind of feature people notice the first time they open Preferences. It will ship in the next release. If you'd like to see what else we build, have a look at (and maybe follow) our org, @openapi. Our main work is certified data: company records, registries and other official sources served through APIs, plus the SDKs and MCP servers around them. We see our role as a trusted source that grounds AI in domains where accuracy matters, like legal, engineering and compliance. gknowledge is the local, offline side of the same idea. The follow-up for Detect with a custom Base URL is still yours if you want it. Just say so and I'll open the issue. |
|
Thanks, Francesco! I'd be happy to work on the custom Base URL detection follow-up. Please open the issue, and I'll take a look. |
feat(prefs): detect a local Ollama server and offer its models
Closes #19
Refs #5
Summary
Adds local Ollama model discovery to Preferences. When users select Ollama (local) or click Detect, the app requests
http://localhost:11434/v1/modelswith a 2-second timeout and displays the available models.GLib.idle_add.Implementation
gknowledge/providers/openai_compatible.py— Model discovery and helper functions.gknowledge/ui/preferences.py— Detection button, model dropdown, status, and selection persistence.tests/test_openai_compatible.py— Tests for discovery, connection errors, timeouts, malformed responses, URL prefill, and model selection.Tests
make test— passedpython -m pytest -q— 36 passedmake check— passedgit diff --check— passedFlatpak sandbox checks also passed for localhost reachability, on-demand detection, model selection, URL preservation, and the no-server scenario.
Screenshots
Ollama models found
No Ollama server found