assistant: Show only configured models in the model picker (#20392)

Closes https://github.com/zed-industries/zed/issues/16568

This PR introduces some changes to how we display models in the model
selector within the assistant panel. Basically, it comes down to this:

- If you don't have any provider configured, you should see _all_
available models in the picker
- But, once you've configured some, you should _only_ see models from
them in the picker

Visually, nothing's changed much aside from the added "Configured
Models" label at the top to ensure the understanding that that's a list
of, well, configured models only. 😬

<img width="700" alt="Screenshot 2024-11-07 at 23 42 41"
src="https://github.com/user-attachments/assets/219ed386-2318-43a6-abea-1de0cda8dc53">

Release Notes:

- Change model selector in the assistant panel to only show configured
models
This commit is contained in:
Danilo Leal 2024-11-08 10:08:59 -03:00 committed by GitHub
parent 435708b615
commit 187356ab9b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 88 additions and 53 deletions

View file

@ -912,7 +912,7 @@ impl Render for ConfigurationView {
let is_pro = plan == Some(proto::Plan::ZedPro);
let subscription_text = Label::new(if is_pro {
"You have full access to Zed's hosted models from Anthropic, OpenAI, Google with faster speeds and higher limits through Zed Pro."
"You have full access to Zed's hosted LLMs, which include models from Anthropic, OpenAI, and Google. They come with faster speeds and higher limits through Zed Pro."
} else {
"You have basic access to models from Anthropic through the Zed AI Free plan."
});
@ -957,27 +957,14 @@ impl Render for ConfigurationView {
})
} else {
v_flex()
.gap_6()
.child(Label::new("Use the zed.dev to access language models."))
.gap_2()
.child(Label::new("Use Zed AI to access hosted language models."))
.child(
v_flex()
.gap_2()
.child(
Button::new("sign_in", "Sign in")
.icon_color(Color::Muted)
.icon(IconName::Github)
.icon_position(IconPosition::Start)
.style(ButtonStyle::Filled)
.full_width()
.on_click(cx.listener(move |this, _, cx| this.authenticate(cx))),
)
.child(
div().flex().w_full().items_center().child(
Label::new("Sign in to enable collaboration.")
.color(Color::Muted)
.size(LabelSize::Small),
),
),
Button::new("sign_in", "Sign In")
.icon_color(Color::Muted)
.icon(IconName::Github)
.icon_position(IconPosition::Start)
.on_click(cx.listener(move |this, _, cx| this.authenticate(cx))),
)
}
}