docs, settings text
This commit is contained in:
parent
e58b089efe
commit
43e6c451d9
2 changed files with 73 additions and 103 deletions
|
@ -23,7 +23,7 @@ use settings::{Settings, SettingsStore, update_settings_file};
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
use std::sync::atomic::{AtomicU64, Ordering};
|
use std::sync::atomic::{AtomicU64, Ordering};
|
||||||
use std::{collections::HashMap, sync::Arc};
|
use std::{collections::HashMap, sync::Arc};
|
||||||
use ui::{ButtonLike, Indicator, List, prelude::*};
|
use ui::{ButtonLike, ElevationIndex, Indicator, List, Tooltip, prelude::*};
|
||||||
use ui_input::SingleLineInput;
|
use ui_input::SingleLineInput;
|
||||||
use util::ResultExt;
|
use util::ResultExt;
|
||||||
|
|
||||||
|
@ -817,19 +817,14 @@ impl Render for ConfigurationView {
|
||||||
.into_any()
|
.into_any()
|
||||||
} else {
|
} else {
|
||||||
v_flex()
|
v_flex()
|
||||||
.gap_4()
|
|
||||||
.child(
|
.child(
|
||||||
v_flex()
|
if !is_authenticated {
|
||||||
.gap_2()
|
v_flex().child(
|
||||||
.child(
|
|
||||||
Label::new("Run powerful language models locally on your machine with Ollama. Get started with Llama 3.3, Mistral, Gemma 2, and hundreds of other models.")
|
Label::new("Run powerful language models locally on your machine with Ollama. Get started with Llama 3.3, Mistral, Gemma 2, and hundreds of other models.")
|
||||||
.size(LabelSize::Small)
|
.size(LabelSize::Small)
|
||||||
.color(Color::Muted)
|
.color(Color::Muted)
|
||||||
)
|
)
|
||||||
)
|
.v_flex()
|
||||||
.child(
|
|
||||||
if !is_authenticated {
|
|
||||||
v_flex()
|
|
||||||
.gap_2()
|
.gap_2()
|
||||||
.child(
|
.child(
|
||||||
Label::new("Getting Started")
|
Label::new("Getting Started")
|
||||||
|
@ -839,8 +834,12 @@ impl Render for ConfigurationView {
|
||||||
.child(
|
.child(
|
||||||
List::new()
|
List::new()
|
||||||
.child(InstructionListItem::text_only("1. Download and install Ollama from ollama.com"))
|
.child(InstructionListItem::text_only("1. Download and install Ollama from ollama.com"))
|
||||||
.child(InstructionListItem::text_only("2. Start Ollama and download a model: `ollama run llama3.2`"))
|
.child(InstructionListItem::text_only("2. Start Ollama and download a model: `ollama run gpt-oss:20b`"))
|
||||||
.child(InstructionListItem::text_only("3. Click 'Connect' below to start using Ollama in Zed"))
|
.child(InstructionListItem::text_only("3. Click 'Connect' below to start using Ollama in Zed"))
|
||||||
|
).child(
|
||||||
|
Label::new("API Keys and API URLs are optional, Zed will default to local ollama usage.")
|
||||||
|
.size(LabelSize::Small)
|
||||||
|
.color(Color::Muted)
|
||||||
)
|
)
|
||||||
.into_any()
|
.into_any()
|
||||||
} else {
|
} else {
|
||||||
|
@ -849,39 +848,18 @@ impl Render for ConfigurationView {
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
if self.should_render_api_key_editor(cx) {
|
if self.should_render_api_key_editor(cx) {
|
||||||
v_flex()
|
v_flex()
|
||||||
.gap_2()
|
.on_action(cx.listener(Self::save_api_key))
|
||||||
.child(
|
.child(self.api_key_editor.clone())
|
||||||
Label::new("API Key (Optional)")
|
.child(
|
||||||
.size(LabelSize::Small)
|
Label::new(
|
||||||
.color(Color::Default)
|
format!("You can also assign the {OLLAMA_API_KEY_VAR} environment variable and restart Zed.")
|
||||||
)
|
)
|
||||||
.child(
|
.size(LabelSize::XSmall)
|
||||||
Label::new("Only required for remote Ollama instances or servers with authentication enabled")
|
.color(Color::Muted),
|
||||||
.size(LabelSize::XSmall)
|
).into_any()
|
||||||
.color(Color::Muted)
|
|
||||||
)
|
|
||||||
.child(
|
|
||||||
v_flex()
|
|
||||||
.on_action(cx.listener(Self::save_api_key))
|
|
||||||
.child(self.api_key_editor.clone())
|
|
||||||
.child(
|
|
||||||
Label::new(
|
|
||||||
format!("You can also assign the {OLLAMA_API_KEY_VAR} environment variable and restart Zed.")
|
|
||||||
)
|
|
||||||
.size(LabelSize::XSmall)
|
|
||||||
.color(Color::Muted),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.into_any()
|
|
||||||
} else {
|
} else {
|
||||||
v_flex()
|
v_flex()
|
||||||
.gap_2()
|
|
||||||
.child(
|
|
||||||
Label::new("API Key")
|
|
||||||
.size(LabelSize::Small)
|
|
||||||
.color(Color::Default)
|
|
||||||
)
|
|
||||||
.child(
|
.child(
|
||||||
h_flex()
|
h_flex()
|
||||||
.p_3()
|
.p_3()
|
||||||
|
@ -906,12 +884,15 @@ impl Render for ConfigurationView {
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
Button::new("reset-api-key", "Reset API Key")
|
Button::new("reset-api-key", "Reset API Key")
|
||||||
.style(ButtonStyle::Subtle)
|
.label_size(LabelSize::Small)
|
||||||
.icon(IconName::Undo)
|
.icon(IconName::Undo)
|
||||||
.icon_size(IconSize::XSmall)
|
.icon_size(IconSize::Small)
|
||||||
.on_click(cx.listener(|this, _, window, cx| {
|
.icon_position(IconPosition::Start)
|
||||||
this.reset_api_key(window, cx)
|
.layer(ElevationIndex::ModalSurface)
|
||||||
}))
|
.when(env_var_set, |this| {
|
||||||
|
this.tooltip(Tooltip::text(format!("To reset your API key, unset the {OLLAMA_API_KEY_VAR} environment variable.")))
|
||||||
|
})
|
||||||
|
.on_click(cx.listener(|this, _, window, cx| this.reset_api_key(window, cx))),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.into_any()
|
.into_any()
|
||||||
|
@ -924,66 +905,42 @@ impl Render for ConfigurationView {
|
||||||
v_flex()
|
v_flex()
|
||||||
.gap_2()
|
.gap_2()
|
||||||
.child(
|
.child(
|
||||||
Label::new("API URL (Optional)")
|
h_flex()
|
||||||
.size(LabelSize::Small)
|
.p_3()
|
||||||
.color(Color::Default)
|
.justify_between()
|
||||||
)
|
.rounded_md()
|
||||||
.child(
|
.border_1()
|
||||||
Label::new("Only required for remote Ollama instances or custom ports")
|
.border_color(cx.theme().colors().border)
|
||||||
.size(LabelSize::XSmall)
|
.bg(cx.theme().colors().elevated_surface_background)
|
||||||
.color(Color::Muted)
|
.child(
|
||||||
)
|
h_flex()
|
||||||
.child(
|
.gap_2()
|
||||||
v_flex()
|
.child(Indicator::dot().color(Color::Success))
|
||||||
.gap_2()
|
.child(
|
||||||
.child(
|
v_flex()
|
||||||
h_flex()
|
.gap_1()
|
||||||
.p_3()
|
.child(
|
||||||
.justify_between()
|
Label::new(
|
||||||
.rounded_md()
|
format!("API URL configured. {}", &AllLanguageModelSettings::get_global(cx).ollama.api_url)
|
||||||
.border_1()
|
)
|
||||||
.border_color(cx.theme().colors().border)
|
)
|
||||||
.bg(cx.theme().colors().elevated_surface_background)
|
)
|
||||||
.child(
|
)
|
||||||
h_flex()
|
.child(
|
||||||
.gap_2()
|
Button::new("reset-api-url", "Reset API URL")
|
||||||
.child(Indicator::dot().color(Color::Success))
|
.label_size(LabelSize::Small)
|
||||||
.child(
|
.icon(IconName::Undo)
|
||||||
v_flex()
|
.icon_size(IconSize::Small)
|
||||||
.gap_1()
|
.icon_position(IconPosition::Start)
|
||||||
.child(Label::new("Custom server configured"))
|
.layer(ElevationIndex::ModalSurface)
|
||||||
.child(
|
.on_click(cx.listener(|this, _, window, cx| {
|
||||||
Label::new(&AllLanguageModelSettings::get_global(cx).ollama.api_url)
|
this.reset_api_url(window, cx)
|
||||||
.size(LabelSize::XSmall)
|
}))
|
||||||
.color(Color::Muted)
|
)
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.child(
|
|
||||||
Button::new("reset-api-url", "Reset")
|
|
||||||
.style(ButtonStyle::Subtle)
|
|
||||||
.icon(IconName::Undo)
|
|
||||||
.icon_size(IconSize::XSmall)
|
|
||||||
.on_click(cx.listener(|this, _, window, cx| {
|
|
||||||
this.reset_api_url(window, cx)
|
|
||||||
}))
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
.into_any()
|
.into_any()
|
||||||
} else {
|
} else {
|
||||||
v_flex()
|
v_flex()
|
||||||
.gap_2()
|
|
||||||
.child(
|
|
||||||
Label::new("API URL (Optional)")
|
|
||||||
.size(LabelSize::Small)
|
|
||||||
.color(Color::Default)
|
|
||||||
)
|
|
||||||
.child(
|
|
||||||
Label::new("Only required for remote Ollama instances or custom ports")
|
|
||||||
.size(LabelSize::XSmall)
|
|
||||||
.color(Color::Muted)
|
|
||||||
)
|
|
||||||
.child(
|
.child(
|
||||||
v_flex()
|
v_flex()
|
||||||
.on_action(cx.listener(|this, _: &menu::Confirm, _window, cx| {
|
.on_action(cx.listener(|this, _: &menu::Confirm, _window, cx| {
|
||||||
|
|
|
@ -393,6 +393,19 @@ If the model is tagged with `thinking` in the Ollama catalog, set this option an
|
||||||
The `supports_images` option enables the model's vision capabilities, allowing it to process images included in the conversation context.
|
The `supports_images` option enables the model's vision capabilities, allowing it to process images included in the conversation context.
|
||||||
If the model is tagged with `vision` in the Ollama catalog, set this option and you can use it in Zed.
|
If the model is tagged with `vision` in the Ollama catalog, set this option and you can use it in Zed.
|
||||||
|
|
||||||
|
#### Ollama Authentication
|
||||||
|
|
||||||
|
In addition to running Ollama on your own hardware, which generally does not require authentication, Zed also supports connecting to Ollama API Keys are required for authentication.
|
||||||
|
|
||||||
|
One such service is [Ollama Turbo])(https://ollama.com/turbo). To configure Zed to use Ollama turbo:
|
||||||
|
1. Sign in to your Ollama account and subscribe to Ollama Turbo
|
||||||
|
2. Visit [ollama.com/settings/keys](https://ollama.com/settings/keys) and create an API key
|
||||||
|
3. Open the settings view (`agent: open settings`) and go to the Ollama section
|
||||||
|
4. Paste your API key and press enter.
|
||||||
|
5. For the API URL enter `https://ollama.com`
|
||||||
|
|
||||||
|
Zed will also use the `OLLAMA_API_KEY` environment variables if defined.
|
||||||
|
|
||||||
### OpenAI {#openai}
|
### OpenAI {#openai}
|
||||||
|
|
||||||
> ✅ Supports tool use
|
> ✅ Supports tool use
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue