Fix unnecessary Ollama model loading (#35032)

Closes https://github.com/zed-industries/zed/issues/35031

Similar solution as in https://github.com/zed-industries/zed/pull/30589

Release Notes:

- Fix unnecessary ollama model loading
This commit is contained in:
etimvr 2025-07-25 20:58:05 +07:00 committed by GitHub
parent f21ba9e2c6
commit 5de544eb4b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -192,12 +192,16 @@ impl LanguageModelProvider for OllamaLanguageModelProvider {
IconName::AiOllama
}
fn default_model(&self, cx: &App) -> Option<Arc<dyn LanguageModel>> {
self.provided_models(cx).into_iter().next()
fn default_model(&self, _: &App) -> Option<Arc<dyn LanguageModel>> {
// We shouldn't try to select default model, because it might lead to a load call for an unloaded model.
// In a constrained environment where user might not have enough resources it'll be a bad UX to select something
// to load by default.
None
}
fn default_fast_model(&self, cx: &App) -> Option<Arc<dyn LanguageModel>> {
self.default_model(cx)
fn default_fast_model(&self, _: &App) -> Option<Arc<dyn LanguageModel>> {
// See explanation for default_model.
None
}
fn provided_models(&self, cx: &App) -> Vec<Arc<dyn LanguageModel>> {