agent: Show provider icon in model selectors (#30595)
I often switch between models, and I believe many people do. Currently, it is difficult to determine which provider offers the selected model because the same models are available from different providers. I propose a simple change to the selector so that users can distinguish between providers from the model they have chosen. As a side note, I would actually prefer to have a text label with the provider’s name next to the model name in the selector. However, I understand that this is too opinionated and takes up too much space. | Before | After | | ------ | ------ | |  |  | |  |  | |  |  | Release Notes: - The model selector has been improved with a provider icon, making it easier to distinguish between providers. --------- Co-authored-by: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
This commit is contained in:
parent
a675ca7a1e
commit
695118d110
2 changed files with 40 additions and 10 deletions
|
@ -2120,12 +2120,21 @@ impl TextThreadEditor {
|
|||
let active_model = LanguageModelRegistry::read_global(cx)
|
||||
.default_model()
|
||||
.map(|default| default.model);
|
||||
let focus_handle = self.editor().focus_handle(cx).clone();
|
||||
let model_name = match active_model {
|
||||
Some(model) => model.name().0,
|
||||
None => SharedString::from("No model selected"),
|
||||
};
|
||||
|
||||
let active_provider = LanguageModelRegistry::read_global(cx)
|
||||
.default_model()
|
||||
.map(|default| default.provider);
|
||||
let provider_icon = match active_provider {
|
||||
Some(provider) => provider.icon(),
|
||||
None => IconName::Ai,
|
||||
};
|
||||
|
||||
let focus_handle = self.editor().focus_handle(cx).clone();
|
||||
|
||||
PickerPopoverMenu::new(
|
||||
self.language_model_selector.clone(),
|
||||
ButtonLike::new("active-model")
|
||||
|
@ -2133,10 +2142,16 @@ impl TextThreadEditor {
|
|||
.child(
|
||||
h_flex()
|
||||
.gap_0p5()
|
||||
.child(
|
||||
Icon::new(provider_icon)
|
||||
.color(Color::Muted)
|
||||
.size(IconSize::XSmall),
|
||||
)
|
||||
.child(
|
||||
Label::new(model_name)
|
||||
.color(Color::Muted)
|
||||
.size(LabelSize::Small)
|
||||
.color(Color::Muted),
|
||||
.ml_0p5(),
|
||||
)
|
||||
.child(
|
||||
Icon::new(IconName::ChevronDown)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue