mirror of
https://github.com/zed-industries/zed.git
synced 2026-10-19 11:04:06 +00:00
# Objective Fix two related bugs in the Ollama edit-prediction provider config (`Settings > AI > Edit Prediction > Configure Providers`): 1. The Ollama model dropdown showed only a single model (the currently-configured one), regardless of what models were actually available on the configured server. 2. Ollama never appeared as a selectable option in the "Active Provider" list, even when fully configured. Both bugs shared the same root cause: several places in the edit-prediction code path read from the Assistant's separate Ollama *language model* provider (`language_models.ollama.*`, used by the AI panel/agent) instead of the edit-prediction-specific `edit_predictions.ollama.*` settings. These are two independent Ollama connections that can point at different servers, so the edit-prediction UI was effectively showing/gating on the wrong provider's state. This changes fixes #47393 ## Solution - **Model dropdown**: Added `edit_prediction::ollama::fetch_models_from_server`, which queries `/api/tags` directly against the edit-prediction's own configured `api_url`, independent of the Assistant's Ollama provider. The dropdown now re-fetches from that URL every time it's opened, so changing the server URL and reopening the dropdown shows the new server's models. - **Model filtering**: Fetched models are filtered to those Zed can infer a completion prompt format for (`infer_prompt_format`), so chat-only and embedding models (e.g. `nomic-embed-text`, `llama3:70b`) no longer clutter the list. This function was extracted from `edit_prediction_registry.rs` (previously private, used only for prompt-format resolution) into `edit_prediction::fim` so it can be shared between the dropdown filter and the existing routing logic — same behavior, no duplication. - **Provider visibility**: `get_available_providers` now gates Ollama's visibility on `edit_predictions.ollama.is_some()` (i.e. whether the user has configured a model), matching the existing pattern already used for the OpenAI-Compatible provider, instead of checking the unrelated Assistant provider's authentication state. Removed the now-dead `ollama::is_available`/`ensure_authenticated` functions and the startup call that existed solely to make that broken check eventually pass. ## Testing - Added unit tests for `infer_prompt_format` covering all known model families (qwen/codellama/deepseek-coder/starcoder/codestral/glm/zeta/sweep) and confirming unsupported models (chat/embedding) correctly return `None`. - Added an async test for `fetch_models_from_server` using a fake HTTP client, verifying it filters to FIM-capable models and returns them sorted. - Added a regression test, `test_ollama_provider_routes_to_fim_model`, verifying that Ollama + a known model (`qwen2.5-coder:3b`) resolves to `EditPredictionProviderConfig::Zed(EditPredictionModel::Fim { format: Qwen })` — this exercises the exact routing path underlying the provider-visibility fix. - Manually verified end-to-end against a real local Ollama server: configured a custom `api_url`, confirmed the model dropdown populated with the server's actual models, selected one, and confirmed Ollama appeared in and could be selected from the Active Provider list, with predictions successfully returned. - Ran `cargo check` and `./script/clippy` on all touched crates (`edit_prediction`, `settings_ui`, `edit_prediction_ui`, `zed`); no warnings. - Not tested: the `get_available_providers` gating change itself has no direct test (it's a one-line settings check whose underlying resolution is covered by the `zed`-crate regression test above); Windows/Linux were not tested, only macOS. ## Self-Review Checklist: - [X] I've reviewed my own diff for quality, security, and reliability - [X] Unsafe blocks (if any) have justifying comments - [X] The content adheres to Zed's UI standards ([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) and [icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md) guidelines) - [X] Tests cover the new/changed behavior - [X] Performance impact has been considered and is acceptable ## Showcase <details> <summary>Click to view showcase</summary> Now when we open the dropdown model selector on Ollama section we will see the available models in the current server that we are trying to use <img width="903" height="755" alt="image" src="https://github.com/user-attachments/assets/873c662b-3624-4530-811c-6f07ab518e35" /> Now Ollama will be displayed as provider in the edit prediction providers dropdown <img width="903" height="755" alt="image" src="https://github.com/user-attachments/assets/9dfe737d-6527-4ecd-9803-3d0959075c34" /> </details> --- Release Notes: - Fixed Ollama edit predictions not appearing as a selectable provider and the model dropdown showing only a single model instead of the models available on the configured server
63 lines
1.2 KiB
Text
63 lines
1.2 KiB
Text
**/*.db
|
|
**/*.proptest-regressions
|
|
**/cargo-target
|
|
**/target
|
|
.webrtc-sys/
|
|
**/venv
|
|
**/.direnv
|
|
*.wasm
|
|
*.xcodeproj
|
|
.DS_Store
|
|
.blob_store
|
|
.build
|
|
.claude/settings.local.json
|
|
.envrc
|
|
.flatpak-builder
|
|
.idea
|
|
.netrc
|
|
*.pyc
|
|
.pytest_cache
|
|
.swiftpm
|
|
.swiftpm/config/registries.json
|
|
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
|
|
.venv
|
|
.vscode
|
|
.wrangler
|
|
.perf-runs
|
|
/assets/*licenses.*
|
|
/crates/collab/seed.json
|
|
/crates/theme/schemas/theme.json
|
|
/crates/zed/resources/flatpak/flatpak-cargo-sources.json
|
|
/crates/project_panel/benches/linux_repo_snapshot.txt
|
|
/dev.zed.Zed*.json
|
|
/node_modules/
|
|
/plugins/bin
|
|
/script/node_modules
|
|
/snap
|
|
/zed.xcworkspace
|
|
DerivedData/
|
|
Packages
|
|
xcuserdata/
|
|
crates/docs_preprocessor/actions.json
|
|
|
|
# Don't commit any secrets to the repo.
|
|
.env
|
|
.env.secret.toml
|
|
|
|
# `nix build` output
|
|
/result
|
|
|
|
# Visual test baseline images (these will be stored outside
|
|
# the repo in the future, but we don't haven't decided exactly
|
|
# where yet, so for now they get generated into a gitignored dir.)
|
|
/crates/zed/test_fixtures/visual_tests/
|
|
|
|
# Local documentation audit files
|
|
/december-2025-releases.md
|
|
/docs/december-2025-documentation-gaps.md
|
|
|
|
# NixOS integration test state
|
|
.nixos-test-history
|
|
|
|
.local*
|
|
.cache
|