diff --git a/crates/language_models/src/provider/anthropic.rs b/crates/language_models/src/provider/anthropic.rs index 2897b836b12d7bcaabfe3841a9f0c77ba6ab497e..8389af090de26f481d327a93df1a299881e6cad1 100644 --- a/crates/language_models/src/provider/anthropic.rs +++ b/crates/language_models/src/provider/anthropic.rs @@ -924,6 +924,7 @@ impl Render for ConfigurationView { List::new() .child( InstructionListItem::new( + "anthropic-console-keys", "Create one by visiting", Some("Anthropic's settings"), Some("https://console.anthropic.com/settings/keys") diff --git a/crates/language_models/src/provider/bedrock.rs b/crates/language_models/src/provider/bedrock.rs index 47dd565f6af64d5ddb1d19cd6ed95ceeffd57cc9..706ce2d417e2ea82e9188babef5b465089c5088c 100644 --- a/crates/language_models/src/provider/bedrock.rs +++ b/crates/language_models/src/provider/bedrock.rs @@ -1208,6 +1208,7 @@ impl Render for ConfigurationView { List::new() .child( InstructionListItem::new( + "bedrock-prerequisites", "Grant permissions to the strategy you'll use according to the:", Some("Prerequisites"), Some("https://docs.aws.amazon.com/bedrock/latest/userguide/inference-prereq.html"), @@ -1215,6 +1216,7 @@ impl Render for ConfigurationView { ) .child( InstructionListItem::new( + "bedrock-model-catalog", "Select the models you would like access to:", Some("Bedrock Model Catalog"), Some("https://us-east-1.console.aws.amazon.com/bedrock/home?region=us-east-1#/modelaccess"), @@ -1260,11 +1262,13 @@ impl ConfigurationView { .child( List::new() .child(InstructionListItem::new( + "bedrock-iam-console", "Create an IAM user in the AWS console with programmatic access", Some("IAM Console"), Some("https://us-east-1.console.aws.amazon.com/iam/home?region=us-east-1#/users"), )) .child(InstructionListItem::new( + "bedrock-user", "Attach the necessary Bedrock permissions to this ", Some("user"), Some("https://docs.aws.amazon.com/bedrock/latest/userguide/inference-prereq.html"), diff --git a/crates/language_models/src/provider/deepseek.rs b/crates/language_models/src/provider/deepseek.rs index ec420bfd83b427701ffa6eb13a9eb6035604f0b1..98680579a155e5ef1c1cf345dfe821ffd38bdc9e 100644 --- a/crates/language_models/src/provider/deepseek.rs +++ b/crates/language_models/src/provider/deepseek.rs @@ -612,6 +612,7 @@ impl Render for ConfigurationView { .child( List::new() .child(InstructionListItem::new( + "deepseek-console", "Get your API key from the", Some("DeepSeek console"), Some("https://platform.deepseek.com/api_keys"), diff --git a/crates/language_models/src/provider/google.rs b/crates/language_models/src/provider/google.rs index f6ac364611c0e121115a4bd692893ed8bfa89ab3..9b41222bb8af0d6f5d4d87fc90dfd9efb0b4aa3a 100644 --- a/crates/language_models/src/provider/google.rs +++ b/crates/language_models/src/provider/google.rs @@ -849,6 +849,7 @@ impl Render for ConfigurationView { .child( List::new() .child(InstructionListItem::new( + "google-ai-console", "Create one by visiting", Some("Google AI's console"), Some("https://aistudio.google.com/app/apikey"), diff --git a/crates/language_models/src/provider/mistral.rs b/crates/language_models/src/provider/mistral.rs index 7623f123c60e75a9c1fc6716e56075e4ea5b882b..a7aac12aff735b11bb007724c4ca2ac9b270ee6f 100644 --- a/crates/language_models/src/provider/mistral.rs +++ b/crates/language_models/src/provider/mistral.rs @@ -782,6 +782,7 @@ impl Render for ConfigurationView { .child( List::new() .child(InstructionListItem::new( + "mistral-console", "Create one by visiting", Some("Mistral's console"), Some("https://console.mistral.ai/api-keys"), diff --git a/crates/language_models/src/provider/ollama.rs b/crates/language_models/src/provider/ollama.rs index d3a4289f24f651507ed493af228ac30314d975d6..93efb5335e4a28bd334e03d214ef76a7979f5603 100644 --- a/crates/language_models/src/provider/ollama.rs +++ b/crates/language_models/src/provider/ollama.rs @@ -733,6 +733,7 @@ impl ConfigurationView { .child( List::new() .child(InstructionListItem::new( + "ollama-console", "Download and install Ollama from", Some("ollama.com"), Some("https://ollama.com/download"), diff --git a/crates/language_models/src/provider/open_ai.rs b/crates/language_models/src/provider/open_ai.rs index 3eaaa8b58598328e6e843b1f86b8f4e5cbd04c1e..42859f4a115b81900dc25add538dae30471e2393 100644 --- a/crates/language_models/src/provider/open_ai.rs +++ b/crates/language_models/src/provider/open_ai.rs @@ -768,6 +768,7 @@ impl Render for ConfigurationView { .child( List::new() .child(InstructionListItem::new( + "openai-console", "Create one by visiting", Some("OpenAI's console"), Some("https://platform.openai.com/api-keys"), diff --git a/crates/language_models/src/provider/open_router.rs b/crates/language_models/src/provider/open_router.rs index 5bfc97c41f60351288ccf08c3a86b4b0947ee997..768aa01f296c82c628e1fa408fa135fa2d77aafe 100644 --- a/crates/language_models/src/provider/open_router.rs +++ b/crates/language_models/src/provider/open_router.rs @@ -788,6 +788,7 @@ impl Render for ConfigurationView { .child( List::new() .child(InstructionListItem::new( + "openrouter-console", "Create an API key by visiting", Some("OpenRouter's console"), Some("https://openrouter.ai/keys"), diff --git a/crates/language_models/src/provider/vercel.rs b/crates/language_models/src/provider/vercel.rs index ad12e5a628779eddf333bdd4f91bddbea016c402..5203595adc7b6518dea7aa6361229ad47e4719f9 100644 --- a/crates/language_models/src/provider/vercel.rs +++ b/crates/language_models/src/provider/vercel.rs @@ -456,6 +456,7 @@ impl Render for ConfigurationView { .child( List::new() .child(InstructionListItem::new( + "vercel-console", "Create one by visiting", Some("Vercel v0's console"), Some("https://v0.dev/chat/settings/keys"), diff --git a/crates/language_models/src/provider/x_ai.rs b/crates/language_models/src/provider/x_ai.rs index 243a2e3e0217f10d580a278d25e7168f4f62fe21..29d27e35d6ae27f0aa64700a620d5aa2a7b45d14 100644 --- a/crates/language_models/src/provider/x_ai.rs +++ b/crates/language_models/src/provider/x_ai.rs @@ -453,6 +453,7 @@ impl Render for ConfigurationView { .child( List::new() .child(InstructionListItem::new( + "xai-console", "Create one by visiting", Some("xAI console"), Some("https://console.x.ai/team/default/api-keys"), diff --git a/crates/language_models/src/ui/instruction_list_item.rs b/crates/language_models/src/ui/instruction_list_item.rs index bdb5fbe242ee902dc98a37addfaa0f103ef9ad20..f61b1fbb200908fdc724c109edf966a432a5141f 100644 --- a/crates/language_models/src/ui/instruction_list_item.rs +++ b/crates/language_models/src/ui/instruction_list_item.rs @@ -3,6 +3,7 @@ use ui::{ListItem, prelude::*}; /// A reusable list item component for adding LLM provider configuration instructions pub struct InstructionListItem { + id: ElementId, label: SharedString, button_label: Option, button_link: Option, @@ -10,11 +11,13 @@ pub struct InstructionListItem { impl InstructionListItem { pub fn new( + id: impl Into, label: impl Into, button_label: Option>, button_link: Option>, ) -> Self { Self { + id: id.into(), label: label.into(), button_label: button_label.map(|l| l.into()), button_link: button_link.map(|l| l.into()), @@ -23,6 +26,7 @@ impl InstructionListItem { pub fn text_only(label: impl Into) -> Self { Self { + id: id.into(), label: label.into(), button_label: None, button_link: None, @@ -37,26 +41,23 @@ impl IntoElement for InstructionListItem { let item_content = if let (Some(button_label), Some(button_link)) = (self.button_label, self.button_link) { - let link = button_link; - let unique_id = SharedString::from(format!("{}-button", self.label)); - h_flex() .flex_wrap() .child(Label::new(self.label)) .child( - Button::new(unique_id, button_label) + Button::new("button", button_label) .style(ButtonStyle::Subtle) .icon(IconName::ArrowUpRight) .icon_size(IconSize::Small) .icon_color(Color::Muted) - .on_click(move |_, _window, cx| cx.open_url(&link)), + .on_click(move |_, _window, cx| cx.open_url(&button_link)), ) .into_any_element() } else { Label::new(self.label).into_any_element() }; - ListItem::new("list-item") + ListItem::new(self.id) .selectable(false) .start_slot( Icon::new(IconName::Dash)