Add custom icon for Anthropic hosted models (#16436)
This commit adds a custom icon for Anthropic hosted models.   - Adding a new SVG icon for Anthropic hosted models. - The new icon is located at: `assets/icons/ai_anthropic_hosted.svg` - Updating the LanguageModel trait to include an optional icon method - Implementing the icon method for CloudModel to return the custom icon for Anthropic hosted models - Updating the UI components to use the model-specific icon when available - Adding a new IconName variant for the Anthropic hosted icon We should change the non-hosted icon in some small way to distinguish it from the hosted version. I duplicated the path for now so we can hopefully add it for the next release. Release Notes: - N/A
This commit is contained in:
parent
11753914d7
commit
b9176fe4bb
7 changed files with 35 additions and 5 deletions
|
@ -36,7 +36,7 @@ pub struct ModelPickerDelegate {
|
|||
#[derive(Clone)]
|
||||
struct ModelInfo {
|
||||
model: Arc<dyn LanguageModel>,
|
||||
provider_icon: IconName,
|
||||
icon: IconName,
|
||||
availability: LanguageModelAvailability,
|
||||
is_selected: bool,
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ impl PickerDelegate for ModelPickerDelegate {
|
|||
.selected(selected)
|
||||
.start_slot(
|
||||
div().pr_1().child(
|
||||
Icon::new(model_info.provider_icon)
|
||||
Icon::new(model_info.icon)
|
||||
.color(Color::Muted)
|
||||
.size(IconSize::Medium),
|
||||
),
|
||||
|
@ -261,16 +261,17 @@ impl<T: PopoverTrigger> RenderOnce for ModelSelector<T> {
|
|||
.iter()
|
||||
.flat_map(|provider| {
|
||||
let provider_id = provider.id();
|
||||
let provider_icon = provider.icon();
|
||||
let icon = provider.icon();
|
||||
let selected_model = selected_model.clone();
|
||||
let selected_provider = selected_provider.clone();
|
||||
|
||||
provider.provided_models(cx).into_iter().map(move |model| {
|
||||
let model = model.clone();
|
||||
let icon = model.icon().unwrap_or(icon);
|
||||
|
||||
ModelInfo {
|
||||
model: model.clone(),
|
||||
provider_icon,
|
||||
icon,
|
||||
availability: model.availability(),
|
||||
is_selected: selected_model.as_ref() == Some(&model.id())
|
||||
&& selected_provider.as_ref() == Some(&provider_id),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue