From 29a5def12ce233f5e98454f60af5ee4af20f25e5 Mon Sep 17 00:00:00 2001
From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com>
Date: Mon, 16 Sep 2024 07:12:07 -0400
Subject: [PATCH] Refine assistant config UI (#17871)
This PR does a little bit of a touch-up on the copywriting on the
assistant config UI. I had friends reporting to me that some of the
writing could be clearer, and hopefully, this goes into that direction!
Release Notes:
- N/A
---
assets/icons/sliders_alt.svg | 6 ++++++
assets/icons/sliders_vertical.svg | 11 +++++++++++
crates/assistant/src/assistant_panel.rs | 4 +++-
.../language_model/src/provider/anthropic.rs | 10 ++++------
.../src/provider/copilot_chat.rs | 2 +-
crates/language_model/src/provider/google.rs | 10 ++++------
crates/language_model/src/provider/open_ai.rs | 18 +++++++++++-------
crates/ui/src/components/icon.rs | 2 ++
8 files changed, 42 insertions(+), 21 deletions(-)
create mode 100644 assets/icons/sliders_alt.svg
create mode 100644 assets/icons/sliders_vertical.svg
diff --git a/assets/icons/sliders_alt.svg b/assets/icons/sliders_alt.svg
new file mode 100644
index 0000000000..36c3feccfe
--- /dev/null
+++ b/assets/icons/sliders_alt.svg
@@ -0,0 +1,6 @@
+
diff --git a/assets/icons/sliders_vertical.svg b/assets/icons/sliders_vertical.svg
new file mode 100644
index 0000000000..ab61037a51
--- /dev/null
+++ b/assets/icons/sliders_vertical.svg
@@ -0,0 +1,11 @@
+
diff --git a/crates/assistant/src/assistant_panel.rs b/crates/assistant/src/assistant_panel.rs
index 8d158193a6..59f5e81d05 100644
--- a/crates/assistant/src/assistant_panel.rs
+++ b/crates/assistant/src/assistant_panel.rs
@@ -4117,9 +4117,11 @@ impl ContextEditor {
.child(Label::new(label)),
)
.child(
- Button::new("open-configuration", "Open configuration")
+ Button::new("open-configuration", "Configure Providers")
.size(ButtonSize::Compact)
+ .icon(Some(IconName::SlidersVertical))
.icon_size(IconSize::Small)
+ .icon_position(IconPosition::Start)
.style(ButtonStyle::Filled)
.on_click({
let focus_handle = self.focus_handle(cx).clone();
diff --git a/crates/language_model/src/provider/anthropic.rs b/crates/language_model/src/provider/anthropic.rs
index 9f7135aef7..1e3d275094 100644
--- a/crates/language_model/src/provider/anthropic.rs
+++ b/crates/language_model/src/provider/anthropic.rs
@@ -657,11 +657,10 @@ impl ConfigurationView {
impl Render for ConfigurationView {
fn render(&mut self, cx: &mut ViewContext) -> impl IntoElement {
const ANTHROPIC_CONSOLE_URL: &str = "https://console.anthropic.com/settings/keys";
- const INSTRUCTIONS: [&str; 4] = [
- "To use the assistant panel or inline assistant, you need to add your Anthropic API key.",
- "You can create an API key at:",
- "",
- "Paste your Anthropic API key below and hit enter to use the assistant:",
+ const INSTRUCTIONS: [&str; 3] = [
+ "To use Zed's assistant with Anthropic, you need to add an API key. Follow these steps:",
+ "- Create one at:",
+ "- Paste your API key below and hit enter to use the assistant:",
];
let env_var_set = self.state.read(cx).api_key_from_env;
@@ -682,7 +681,6 @@ impl Render for ConfigurationView {
)
)
.child(Label::new(INSTRUCTIONS[2]))
- .child(Label::new(INSTRUCTIONS[3]))
.child(
h_flex()
.w_full()
diff --git a/crates/language_model/src/provider/copilot_chat.rs b/crates/language_model/src/provider/copilot_chat.rs
index e21060e54d..58b486921a 100644
--- a/crates/language_model/src/provider/copilot_chat.rs
+++ b/crates/language_model/src/provider/copilot_chat.rs
@@ -358,7 +358,7 @@ impl Render for ConfigurationView {
}
_ => {
const LABEL: &str =
- "To use the assistant panel or inline assistant, you must login to GitHub Copilot. Your GitHub account must have an active Copilot Chat subscription.";
+ "To use Zed's assistant with GitHub Copilot, you need to be logged in to GitHub. Note that your GitHub account must have an active Copilot Chat subscription.";
v_flex().gap_6().child(Label::new(LABEL)).child(
v_flex()
.gap_2()
diff --git a/crates/language_model/src/provider/google.rs b/crates/language_model/src/provider/google.rs
index 005f35ff8b..daa07cdc39 100644
--- a/crates/language_model/src/provider/google.rs
+++ b/crates/language_model/src/provider/google.rs
@@ -446,11 +446,10 @@ impl ConfigurationView {
impl Render for ConfigurationView {
fn render(&mut self, cx: &mut ViewContext) -> impl IntoElement {
const GOOGLE_CONSOLE_URL: &str = "https://aistudio.google.com/app/apikey";
- const INSTRUCTIONS: [&str; 4] = [
- "To use the Google AI assistant, you need to add your Google AI API key.",
- "You can create an API key at:",
- "",
- "Paste your Google AI API key below and hit enter to use the assistant:",
+ const INSTRUCTIONS: [&str; 3] = [
+ "To use Zed's assistant with Google AI, you need to add an API key. Follow these steps:",
+ "- Create one by visiting:",
+ "- Paste your API key below and hit enter to use the assistant",
];
let env_var_set = self.state.read(cx).api_key_from_env;
@@ -472,7 +471,6 @@ impl Render for ConfigurationView {
)
)
.child(Label::new(INSTRUCTIONS[2]))
- .child(Label::new(INSTRUCTIONS[3]))
.child(
h_flex()
.w_full()
diff --git a/crates/language_model/src/provider/open_ai.rs b/crates/language_model/src/provider/open_ai.rs
index 222c153041..a4efb3baf0 100644
--- a/crates/language_model/src/provider/open_ai.rs
+++ b/crates/language_model/src/provider/open_ai.rs
@@ -497,13 +497,11 @@ impl ConfigurationView {
impl Render for ConfigurationView {
fn render(&mut self, cx: &mut ViewContext) -> impl IntoElement {
const OPENAI_CONSOLE_URL: &str = "https://platform.openai.com/api-keys";
- const INSTRUCTIONS: [&str; 6] = [
- "To use the assistant panel or inline assistant, you need to add your OpenAI API key.",
- " - You can create an API key at: ",
- " - Make sure your OpenAI account has credits",
- " - Having a subscription for another service like GitHub Copilot won't work.",
- "",
- "Paste your OpenAI API key below and hit enter to use the assistant:",
+ const INSTRUCTIONS: [&str; 4] = [
+ "To use Zed's assistant with OpenAI, you need to add an API key. Follow these steps:",
+ " - Create one by visiting:",
+ " - Ensure your OpenAI account has credits",
+ " - Paste your API key below and hit enter to start using the assistant",
];
let env_var_set = self.state.read(cx).api_key_from_env;
@@ -543,6 +541,12 @@ impl Render for ConfigurationView {
)
.size(LabelSize::Small),
)
+ .child(
+ Label::new(
+ "Note that having a subscription for another service like GitHub Copilot won't work.".to_string(),
+ )
+ .size(LabelSize::Small),
+ )
.into_any()
} else {
h_flex()
diff --git a/crates/ui/src/components/icon.rs b/crates/ui/src/components/icon.rs
index a2f70244db..a71c3e9872 100644
--- a/crates/ui/src/components/icon.rs
+++ b/crates/ui/src/components/icon.rs
@@ -255,6 +255,7 @@ pub enum IconName {
Slash,
SlashSquare,
Sliders,
+ SlidersVertical,
Snip,
Space,
Sparkle,
@@ -284,6 +285,7 @@ pub enum IconName {
XCircle,
ZedAssistant,
ZedAssistantFilled,
+ ZedXCopilot,
}
#[derive(IntoElement)]