Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
agent_ui: Clarify disabled profile selector copy (#53797)
Fuad Hasand5d6029a663a
diff --git a/crates/agent_ui/src/conversation_view.rs b/crates/agent_ui/src/conversation_view.rsindex 33027076eff..7a4b8b02e20 100644--- a/crates/agent_ui/src/conversation_view.rs+++ b/crates/agent_ui/src/conversation_view.rs@@ -234,6 +234,10 @@ impl ProfileProvider for Entity<agent::Thread> {.model().is_some_and(|model| model.supports_tools())}++ fn model_selected(&self, cx: &App) -> bool {+ self.read(cx).model().is_some()+ }}#[derive(Default)]diff --git a/crates/agent_ui/src/profile_selector.rs b/crates/agent_ui/src/profile_selector.rsindex a73f78b1a5a..2b62b3121f8 100644--- a/crates/agent_ui/src/profile_selector.rs+++ b/crates/agent_ui/src/profile_selector.rs@@ -7,7 +7,7 @@ use agent_settings::{use fs::Fs;use fuzzy::{StringMatch, StringMatchCandidate, match_strings};use gpui::{- Action, AnyElement, AnyView, App, BackgroundExecutor, Context, DismissEvent, Entity,+ Action, AnyElement, AnyView, App, BackgroundExecutor, Context, DismissEvent, Empty, Entity,FocusHandle, Focusable, ForegroundExecutor, SharedString, Subscription, Task, Window,};use picker::{Picker, PickerDelegate, popover_menu::PickerPopoverMenu};@@ -31,6 +31,9 @@ pub trait ProfileProvider {/// Check if profiles are supported in the current context (e.g. if the model that is selected has tool support)fn profiles_supported(&self, cx: &App) -> bool;++ /// Check if there is a model selected in the current context.+ fn model_selected(&self, cx: &App) -> bool;}pub struct ProfileSelector {@@ -152,6 +155,10 @@ impl Focusable for ProfileSelector {impl Render for ProfileSelector {fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {+ if !self.provider.model_selected(cx) {+ return Empty.into_any_element();+ }+if !self.provider.profiles_supported(cx) {return Button::new("tools-not-supported-button", "Tools Unsupported").disabled(true)@@ -792,11 +799,15 @@ mod tests {struct TestProfileProvider {profile_id: AgentProfileId,+ has_model: bool,}impl TestProfileProvider {fn new(profile_id: AgentProfileId) -> Self {- Self { profile_id }+ Self {+ profile_id,+ has_model: true,+ }}}@@ -810,5 +821,9 @@ mod tests {fn profiles_supported(&self, _cx: &App) -> bool {true}++ fn model_selected(&self, _cx: &App) -> bool {+ self.has_model+ }}}