diff --git a/crates/agent/src/profile_selector.rs b/crates/agent/src/profile_selector.rs index 9284fd2ee9..b6f2ea9fdb 100644 --- a/crates/agent/src/profile_selector.rs +++ b/crates/agent/src/profile_selector.rs @@ -101,7 +101,7 @@ impl ProfileSelector { profile_id: AgentProfileId, profile: &AgentProfile, settings: &AssistantSettings, - cx: &App, + _cx: &App, ) -> ContextMenuEntry { let documentation = match profile.name.to_lowercase().as_str() { builtin_profiles::WRITE => Some("Get help to write anything."), @@ -110,12 +110,8 @@ impl ProfileSelector { _ => None, }; - let current_profile_id = self.thread.read(cx).configured_profile_id(); - - let entry = ContextMenuEntry::new(profile.name.clone()).toggleable( - IconPosition::End, - Some(profile_id.clone()) == current_profile_id, - ); + let entry = ContextMenuEntry::new(profile.name.clone()) + .toggleable(IconPosition::End, profile_id == settings.default_profile); let entry = if let Some(doc_text) = documentation { entry.documentation_aside(documentation_side(settings.dock), move |_| { @@ -129,13 +125,7 @@ impl ProfileSelector { let fs = self.fs.clone(); let thread_store = self.thread_store.clone(); let profile_id = profile_id.clone(); - let thread = self.thread.clone(); - move |_window, cx| { - thread.update(cx, |thread, cx| { - thread.set_configured_profile_id(Some(profile_id.clone()), cx); - }); - update_settings_file::(fs.clone(), cx, { let profile_id = profile_id.clone(); move |settings, _cx| { @@ -156,12 +146,8 @@ impl ProfileSelector { impl Render for ProfileSelector { fn render(&mut self, _window: &mut Window, cx: &mut Context) -> impl IntoElement { let settings = AssistantSettings::get_global(cx); - let profile_id = self - .thread - .read(cx) - .configured_profile_id() - .unwrap_or(settings.default_profile.clone()); - let profile = settings.profiles.get(&profile_id).cloned(); + let profile_id = &settings.default_profile; + let profile = settings.profiles.get(profile_id); let selected_profile = profile .map(|profile| profile.name.clone()) diff --git a/crates/agent/src/thread.rs b/crates/agent/src/thread.rs index 7ef736caa0..c6f2d74ff9 100644 --- a/crates/agent/src/thread.rs +++ b/crates/agent/src/thread.rs @@ -5,7 +5,7 @@ use std::sync::Arc; use std::time::Instant; use anyhow::{Result, anyhow}; -use assistant_settings::{AgentProfileId, AssistantSettings, CompletionMode}; +use assistant_settings::{AssistantSettings, CompletionMode}; use assistant_tool::{ActionLog, AnyToolCard, Tool, ToolWorkingSet}; use chrono::{DateTime, Utc}; use collections::HashMap; @@ -359,7 +359,6 @@ pub struct Thread { >, remaining_turns: u32, configured_model: Option, - configured_profile_id: Option, } #[derive(Debug, Clone, Serialize, Deserialize)] @@ -380,8 +379,6 @@ impl Thread { ) -> Self { let (detailed_summary_tx, detailed_summary_rx) = postage::watch::channel(); let configured_model = LanguageModelRegistry::read_global(cx).default_model(); - let assistant_settings = AssistantSettings::get_global(cx); - let configured_profile_id = assistant_settings.default_profile.clone(); Self { id: ThreadId::new(), @@ -424,7 +421,6 @@ impl Thread { request_callback: None, remaining_turns: u32::MAX, configured_model, - configured_profile_id: Some(configured_profile_id), } } @@ -472,8 +468,6 @@ impl Thread { .completion_mode .unwrap_or_else(|| AssistantSettings::get_global(cx).preferred_completion_mode); - let configured_profile_id = serialized.profile.clone(); - Self { id, updated_at: serialized.updated_at, @@ -547,7 +541,6 @@ impl Thread { request_callback: None, remaining_turns: u32::MAX, configured_model, - configured_profile_id, } } @@ -603,19 +596,6 @@ impl Thread { cx.notify(); } - pub fn configured_profile_id(&self) -> Option { - self.configured_profile_id.clone() - } - - pub fn set_configured_profile_id( - &mut self, - id: Option, - cx: &mut Context, - ) { - self.configured_profile_id = id; - cx.notify(); - } - pub const DEFAULT_SUMMARY: SharedString = SharedString::new_static("New Thread"); pub fn summary_or_default(&self) -> SharedString { @@ -1120,7 +1100,6 @@ impl Thread { provider: model.provider.id().0.to_string(), model: model.model.id().0.to_string(), }), - profile: this.configured_profile_id.clone(), completion_mode: Some(this.completion_mode), }) }) diff --git a/crates/agent/src/thread_store.rs b/crates/agent/src/thread_store.rs index 62482a822f..99ecd3d442 100644 --- a/crates/agent/src/thread_store.rs +++ b/crates/agent/src/thread_store.rs @@ -657,8 +657,6 @@ pub struct SerializedThread { pub model: Option, #[serde(default)] pub completion_mode: Option, - #[serde(default)] - pub profile: Option, } #[derive(Serialize, Deserialize, Debug)] @@ -804,7 +802,6 @@ impl LegacySerializedThread { exceeded_window_error: None, model: None, completion_mode: None, - profile: None, } } }