agent: Fix new thread model selection when starting new thread (#34708)

Release Notes:

- agent: Fixed an issue where clicking on "Start New Thread" in the
agent configuration would not always switch to the correct
provider/model
This commit is contained in:
Bennet Bo Fenner 2025-07-18 15:58:44 +02:00 committed by GitHub
parent fd8480a9dc
commit 4002801034
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -53,7 +53,8 @@ use gpui::{
};
use language::LanguageRegistry;
use language_model::{
ConfigurationError, LanguageModelProviderTosView, LanguageModelRegistry, ZED_CLOUD_PROVIDER_ID,
ConfigurationError, ConfiguredModel, LanguageModelProviderTosView, LanguageModelRegistry,
ZED_CLOUD_PROVIDER_ID,
};
use project::{Project, ProjectPath, Worktree};
use prompt_store::{PromptBuilder, PromptStore, UserPromptId};
@ -1347,6 +1348,19 @@ impl AgentPanel {
}
self.new_thread(&NewThread::default(), window, cx);
if let Some((thread, model)) =
self.active_thread(cx).zip(provider.default_model(cx))
{
thread.update(cx, |thread, cx| {
thread.set_configured_model(
Some(ConfiguredModel {
provider: provider.clone(),
model,
}),
cx,
);
});
}
}
}
}