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
|
@ -54,6 +54,10 @@ pub struct LanguageModelCacheConfiguration {
|
|||
pub trait LanguageModel: Send + Sync {
|
||||
fn id(&self) -> LanguageModelId;
|
||||
fn name(&self) -> LanguageModelName;
|
||||
/// If None, falls back to [LanguageModelProvider::icon]
|
||||
fn icon(&self) -> Option<IconName> {
|
||||
None
|
||||
}
|
||||
fn provider_id(&self) -> LanguageModelProviderId;
|
||||
fn provider_name(&self) -> LanguageModelProviderName;
|
||||
fn telemetry_id(&self) -> String;
|
||||
|
|
|
@ -2,6 +2,7 @@ use proto::Plan;
|
|||
use schemars::JsonSchema;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use strum::EnumIter;
|
||||
use ui::IconName;
|
||||
|
||||
use crate::LanguageModelAvailability;
|
||||
|
||||
|
@ -65,6 +66,13 @@ impl CloudModel {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn icon(&self) -> Option<IconName> {
|
||||
match self {
|
||||
Self::Anthropic(_) => Some(IconName::AiAnthropicHosted),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn max_token_count(&self) -> usize {
|
||||
match self {
|
||||
Self::Anthropic(model) => model.max_token_count(),
|
||||
|
|
|
@ -398,6 +398,10 @@ impl LanguageModel for CloudLanguageModel {
|
|||
LanguageModelName::from(self.model.display_name().to_string())
|
||||
}
|
||||
|
||||
fn icon(&self) -> Option<IconName> {
|
||||
self.model.icon()
|
||||
}
|
||||
|
||||
fn provider_id(&self) -> LanguageModelProviderId {
|
||||
LanguageModelProviderId(PROVIDER_ID.into())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue