agent_ui: Clarify disabled profile selector copy (#53797)

Fuad Hasan and Danilo Leal created

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior

After fix:


https://github.com/user-attachments/assets/7a9b7947-e222-4839-a46d-078b6aec8f18

Closes #53749

Release Notes:

- N/A

---------

Co-authored-by: Danilo Leal <daniloleal09@gmail.com>

Change summary

crates/agent_ui/src/conversation_view.rs |  4 ++++
crates/agent_ui/src/profile_selector.rs  | 19 +++++++++++++++++--
2 files changed, 21 insertions(+), 2 deletions(-)

Detailed changes

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)]

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
+        }
     }
 }