agent: Don't show "Tools Unsupported" when no model is selected (#31321)

This PR makes it so we don't show "Tools Unsupported" when no model is
selected.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2025-05-23 21:45:10 -04:00 committed by GitHub
parent ab59982bf7
commit fc8702a8f8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -5,7 +5,7 @@ use assistant_settings::{
builtin_profiles,
};
use fs::Fs;
use gpui::{Action, Entity, FocusHandle, Subscription, WeakEntity, prelude::*};
use gpui::{Action, Empty, Entity, FocusHandle, Subscription, WeakEntity, prelude::*};
use language_model::LanguageModelRegistry;
use settings::{Settings as _, SettingsStore, update_settings_file};
use ui::{
@ -157,10 +157,11 @@ impl Render for ProfileSelector {
let model_registry = LanguageModelRegistry::read_global(cx);
model_registry.default_model()
});
let supports_tools =
configured_model.map_or(false, |default| default.model.supports_tools());
let Some(configured_model) = configured_model else {
return Empty.into_any_element();
};
if supports_tools {
if configured_model.model.supports_tools() {
let this = cx.entity().clone();
let focus_handle = self.focus_handle.clone();
let trigger_button = Button::new("profile-selector-model", selected_profile)