assistant: Cleanup model selector (#15843)

We changed the following for the model selector:
- Fixed displaying checkmarks for selected models when using models with
the same name from different providers
- We now show the icon for the active model instead of displaying the
provider name in the trigger of the model selector
- Only display the footer when the language models feature flag is zed,
so that we don't release the hint for Zed Pro to preview tomorrow

<img width="253" alt="image"
src="https://github.com/user-attachments/assets/f95ccfb6-c0cf-43d4-9637-e2823100a427">


Release Notes:

- N/A

---------

Co-authored-by: Thorsten <thorsten@zed.dev>
This commit is contained in:
Bennet Bo Fenner 2024-08-06 11:59:54 +02:00 committed by GitHub
parent fb1cd7cae2
commit 56abd68d0e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 35 additions and 22 deletions

View file

@ -3014,6 +3014,10 @@ impl Render for ContextEditorToolbarItem {
)
.child(self.model_summary_editor.clone())
});
let active_provider = LanguageModelRegistry::read_global(cx).active_provider();
let active_model = LanguageModelRegistry::read_global(cx).active_model();
let right_side = h_flex()
.gap_2()
.child(ModelSelector::new(
@ -3029,22 +3033,25 @@ impl Render for ContextEditorToolbarItem {
.overflow_x_hidden()
.flex_grow()
.whitespace_nowrap()
.child(
Label::new(
LanguageModelRegistry::read_global(cx)
.active_model()
.map(|model| {
format!(
"{}: {}",
model.provider_name().0,
model.name().0
)
})
.unwrap_or_else(|| "No model selected".into()),
)
.size(LabelSize::Small)
.color(Color::Muted),
),
.child(match (active_provider, active_model) {
(Some(provider), Some(model)) => h_flex()
.gap_1()
.child(
Icon::new(provider.icon())
.color(Color::Muted)
.size(IconSize::XSmall),
)
.child(
Label::new(model.name().0)
.size(LabelSize::Small)
.color(Color::Muted),
)
.into_any_element(),
_ => Label::new("No model selected")
.size(LabelSize::Small)
.color(Color::Muted)
.into_any_element(),
}),
)
.child(
Icon::new(IconName::ChevronDown)