Rename assistant_settings to agent_settings (#31513)

This PR renames the `assistant_settings` crate to `agent_settings`, as
well a number of constructs within it.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2025-05-27 11:16:55 -04:00 committed by GitHub
parent 61a40e293d
commit 8faeb34367
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
43 changed files with 418 additions and 451 deletions

68
Cargo.lock generated
View file

@ -53,9 +53,9 @@ dependencies = [
name = "agent" name = "agent"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"agent_settings",
"anyhow", "anyhow",
"assistant_context_editor", "assistant_context_editor",
"assistant_settings",
"assistant_slash_command", "assistant_slash_command",
"assistant_slash_commands", "assistant_slash_commands",
"assistant_tool", "assistant_tool",
@ -135,6 +135,33 @@ dependencies = [
"zed_llm_client", "zed_llm_client",
] ]
[[package]]
name = "agent_settings"
version = "0.1.0"
dependencies = [
"anthropic",
"anyhow",
"collections",
"deepseek",
"fs",
"gpui",
"indexmap",
"language_model",
"lmstudio",
"log",
"mistral",
"ollama",
"open_ai",
"paths",
"schemars",
"serde",
"serde_json",
"serde_json_lenient",
"settings",
"workspace-hack",
"zed_llm_client",
]
[[package]] [[package]]
name = "ahash" name = "ahash"
version = "0.7.8" version = "0.7.8"
@ -482,8 +509,8 @@ dependencies = [
name = "assistant_context_editor" name = "assistant_context_editor"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"agent_settings",
"anyhow", "anyhow",
"assistant_settings",
"assistant_slash_command", "assistant_slash_command",
"assistant_slash_commands", "assistant_slash_commands",
"chrono", "chrono",
@ -534,33 +561,6 @@ dependencies = [
"zed_actions", "zed_actions",
] ]
[[package]]
name = "assistant_settings"
version = "0.1.0"
dependencies = [
"anthropic",
"anyhow",
"collections",
"deepseek",
"fs",
"gpui",
"indexmap",
"language_model",
"lmstudio",
"log",
"mistral",
"ollama",
"open_ai",
"paths",
"schemars",
"serde",
"serde_json",
"serde_json_lenient",
"settings",
"workspace-hack",
"zed_llm_client",
]
[[package]] [[package]]
name = "assistant_slash_command" name = "assistant_slash_command"
version = "0.1.0" version = "0.1.0"
@ -657,9 +657,9 @@ dependencies = [
name = "assistant_tools" name = "assistant_tools"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"agent_settings",
"aho-corasick", "aho-corasick",
"anyhow", "anyhow",
"assistant_settings",
"assistant_tool", "assistant_tool",
"buffer_diff", "buffer_diff",
"chrono", "chrono",
@ -2976,9 +2976,9 @@ dependencies = [
name = "collab" name = "collab"
version = "0.44.0" version = "0.44.0"
dependencies = [ dependencies = [
"agent_settings",
"anyhow", "anyhow",
"assistant_context_editor", "assistant_context_editor",
"assistant_settings",
"assistant_slash_command", "assistant_slash_command",
"assistant_tool", "assistant_tool",
"async-stripe", "async-stripe",
@ -4995,8 +4995,8 @@ name = "eval"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"agent", "agent",
"agent_settings",
"anyhow", "anyhow",
"assistant_settings",
"assistant_tool", "assistant_tool",
"assistant_tools", "assistant_tools",
"async-trait", "async-trait",
@ -6097,9 +6097,9 @@ dependencies = [
name = "git_ui" name = "git_ui"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"agent_settings",
"anyhow", "anyhow",
"askpass", "askpass",
"assistant_settings",
"buffer_diff", "buffer_diff",
"chrono", "chrono",
"collections", "collections",
@ -19679,12 +19679,12 @@ version = "0.189.0"
dependencies = [ dependencies = [
"activity_indicator", "activity_indicator",
"agent", "agent",
"agent_settings",
"anyhow", "anyhow",
"ashpd", "ashpd",
"askpass", "askpass",
"assets", "assets",
"assistant_context_editor", "assistant_context_editor",
"assistant_settings",
"assistant_tool", "assistant_tool",
"assistant_tools", "assistant_tools",
"async-watch", "async-watch",

View file

@ -3,11 +3,11 @@ resolver = "2"
members = [ members = [
"crates/activity_indicator", "crates/activity_indicator",
"crates/agent", "crates/agent",
"crates/agent_settings",
"crates/anthropic", "crates/anthropic",
"crates/askpass", "crates/askpass",
"crates/assets", "crates/assets",
"crates/assistant_context_editor", "crates/assistant_context_editor",
"crates/assistant_settings",
"crates/assistant_slash_command", "crates/assistant_slash_command",
"crates/assistant_slash_commands", "crates/assistant_slash_commands",
"crates/assistant_tool", "crates/assistant_tool",
@ -211,12 +211,12 @@ edition = "2024"
activity_indicator = { path = "crates/activity_indicator" } activity_indicator = { path = "crates/activity_indicator" }
agent = { path = "crates/agent" } agent = { path = "crates/agent" }
agent_settings = { path = "crates/agent_settings" }
ai = { path = "crates/ai" } ai = { path = "crates/ai" }
anthropic = { path = "crates/anthropic" } anthropic = { path = "crates/anthropic" }
askpass = { path = "crates/askpass" } askpass = { path = "crates/askpass" }
assets = { path = "crates/assets" } assets = { path = "crates/assets" }
assistant_context_editor = { path = "crates/assistant_context_editor" } assistant_context_editor = { path = "crates/assistant_context_editor" }
assistant_settings = { path = "crates/assistant_settings" }
assistant_slash_command = { path = "crates/assistant_slash_command" } assistant_slash_command = { path = "crates/assistant_slash_command" }
assistant_slash_commands = { path = "crates/assistant_slash_commands" } assistant_slash_commands = { path = "crates/assistant_slash_commands" }
assistant_tool = { path = "crates/assistant_tool" } assistant_tool = { path = "crates/assistant_tool" }

View file

@ -19,9 +19,9 @@ test-support = [
] ]
[dependencies] [dependencies]
agent_settings.workspace = true
anyhow.workspace = true anyhow.workspace = true
assistant_context_editor.workspace = true assistant_context_editor.workspace = true
assistant_settings.workspace = true
assistant_slash_command.workspace = true assistant_slash_command.workspace = true
assistant_slash_commands.workspace = true assistant_slash_commands.workspace = true
assistant_tool.workspace = true assistant_tool.workspace = true

View file

@ -13,8 +13,8 @@ use crate::tool_use::{PendingToolUseStatus, ToolUse};
use crate::ui::{ use crate::ui::{
AddedContext, AgentNotification, AgentNotificationEvent, AnimatedLabel, ContextPill, AddedContext, AgentNotification, AgentNotificationEvent, AnimatedLabel, ContextPill,
}; };
use agent_settings::{AgentSettings, NotifyWhenAgentWaiting};
use anyhow::Context as _; use anyhow::Context as _;
use assistant_settings::{AssistantSettings, NotifyWhenAgentWaiting};
use assistant_tool::ToolUseStatus; use assistant_tool::ToolUseStatus;
use audio::{Audio, Sound}; use audio::{Audio, Sound};
use collections::{HashMap, HashSet}; use collections::{HashMap, HashSet};
@ -1151,7 +1151,7 @@ impl ActiveThread {
} }
fn play_notification_sound(&self, cx: &mut App) { fn play_notification_sound(&self, cx: &mut App) {
let settings = AssistantSettings::get_global(cx); let settings = AgentSettings::get_global(cx);
if settings.play_sound_when_agent_done { if settings.play_sound_when_agent_done {
Audio::play_sound(Sound::AgentDone, cx); Audio::play_sound(Sound::AgentDone, cx);
} }
@ -1170,7 +1170,7 @@ impl ActiveThread {
let title = self.thread.read(cx).summary().unwrap_or("Agent Panel"); let title = self.thread.read(cx).summary().unwrap_or("Agent Panel");
match AssistantSettings::get_global(cx).notify_when_agent_waiting { match AgentSettings::get_global(cx).notify_when_agent_waiting {
NotifyWhenAgentWaiting::PrimaryScreen => { NotifyWhenAgentWaiting::PrimaryScreen => {
if let Some(primary) = cx.primary_display() { if let Some(primary) = cx.primary_display() {
self.pop_up(icon, caption.into(), title.clone(), window, primary, cx); self.pop_up(icon, caption.into(), title.clone(), window, primary, cx);
@ -1441,7 +1441,7 @@ impl ActiveThread {
tools: vec![], tools: vec![],
tool_choice: None, tool_choice: None,
stop: vec![], stop: vec![],
temperature: AssistantSettings::temperature_for_model( temperature: AgentSettings::temperature_for_model(
&configured_model.model, &configured_model.model,
cx, cx,
), ),
@ -1898,7 +1898,7 @@ impl ActiveThread {
.child(open_as_markdown), .child(open_as_markdown),
) )
.into_any_element(), .into_any_element(),
None if AssistantSettings::get_global(cx).enable_feedback => None if AgentSettings::get_global(cx).enable_feedback =>
feedback_container feedback_container
.child( .child(
div().visible_on_hover("feedback_container").child( div().visible_on_hover("feedback_container").child(
@ -3078,7 +3078,7 @@ impl ActiveThread {
.on_click(cx.listener( .on_click(cx.listener(
move |this, event, window, cx| { move |this, event, window, cx| {
if let Some(fs) = fs.clone() { if let Some(fs) = fs.clone() {
update_settings_file::<AssistantSettings>( update_settings_file::<AgentSettings>(
fs.clone(), fs.clone(),
cx, cx,
|settings, _| { |settings, _| {
@ -3690,7 +3690,7 @@ mod tests {
cx.set_global(settings_store); cx.set_global(settings_store);
language::init(cx); language::init(cx);
Project::init_settings(cx); Project::init_settings(cx);
AssistantSettings::register(cx); AgentSettings::register(cx);
prompt_store::init(cx); prompt_store::init(cx);
thread_store::init(cx); thread_store::init(cx);
workspace::init_settings(cx); workspace::init_settings(cx);

View file

@ -28,7 +28,7 @@ mod ui;
use std::sync::Arc; use std::sync::Arc;
use assistant_settings::{AgentProfileId, AssistantSettings, LanguageModelSelection}; use agent_settings::{AgentProfileId, AgentSettings, LanguageModelSelection};
use assistant_slash_command::SlashCommandRegistry; use assistant_slash_command::SlashCommandRegistry;
use client::Client; use client::Client;
use feature_flags::FeatureFlagAppExt as _; use feature_flags::FeatureFlagAppExt as _;
@ -121,7 +121,7 @@ pub fn init(
is_eval: bool, is_eval: bool,
cx: &mut App, cx: &mut App,
) { ) {
AssistantSettings::register(cx); AgentSettings::register(cx);
SlashCommandSettings::register(cx); SlashCommandSettings::register(cx);
assistant_context_editor::init(client.clone(), cx); assistant_context_editor::init(client.clone(), cx);
@ -174,7 +174,7 @@ fn init_language_model_settings(cx: &mut App) {
} }
fn update_active_language_model_from_settings(cx: &mut App) { fn update_active_language_model_from_settings(cx: &mut App) {
let settings = AssistantSettings::get_global(cx); let settings = AgentSettings::get_global(cx);
fn to_selected_model(selection: &LanguageModelSelection) -> language_model::SelectedModel { fn to_selected_model(selection: &LanguageModelSelection) -> language_model::SelectedModel {
language_model::SelectedModel { language_model::SelectedModel {

View file

@ -5,7 +5,7 @@ mod tool_picker;
use std::{sync::Arc, time::Duration}; use std::{sync::Arc, time::Duration};
use assistant_settings::AssistantSettings; use agent_settings::AgentSettings;
use assistant_tool::{ToolSource, ToolWorkingSet}; use assistant_tool::{ToolSource, ToolWorkingSet};
use collections::HashMap; use collections::HashMap;
use context_server::ContextServerId; use context_server::ContextServerId;
@ -249,7 +249,7 @@ impl AgentConfiguration {
} }
fn render_command_permission(&mut self, cx: &mut Context<Self>) -> impl IntoElement { fn render_command_permission(&mut self, cx: &mut Context<Self>) -> impl IntoElement {
let always_allow_tool_actions = AssistantSettings::get_global(cx).always_allow_tool_actions; let always_allow_tool_actions = AgentSettings::get_global(cx).always_allow_tool_actions;
h_flex() h_flex()
.gap_4() .gap_4()
@ -277,7 +277,7 @@ impl AgentConfiguration {
let fs = self.fs.clone(); let fs = self.fs.clone();
move |state, _window, cx| { move |state, _window, cx| {
let allow = state == &ToggleState::Selected; let allow = state == &ToggleState::Selected;
update_settings_file::<AssistantSettings>( update_settings_file::<AgentSettings>(
fs.clone(), fs.clone(),
cx, cx,
move |settings, _| { move |settings, _| {
@ -290,7 +290,7 @@ impl AgentConfiguration {
} }
fn render_single_file_review(&mut self, cx: &mut Context<Self>) -> impl IntoElement { fn render_single_file_review(&mut self, cx: &mut Context<Self>) -> impl IntoElement {
let single_file_review = AssistantSettings::get_global(cx).single_file_review; let single_file_review = AgentSettings::get_global(cx).single_file_review;
h_flex() h_flex()
.gap_4() .gap_4()
@ -315,7 +315,7 @@ impl AgentConfiguration {
let fs = self.fs.clone(); let fs = self.fs.clone();
move |state, _window, cx| { move |state, _window, cx| {
let allow = state == &ToggleState::Selected; let allow = state == &ToggleState::Selected;
update_settings_file::<AssistantSettings>( update_settings_file::<AgentSettings>(
fs.clone(), fs.clone(),
cx, cx,
move |settings, _| { move |settings, _| {
@ -328,8 +328,7 @@ impl AgentConfiguration {
} }
fn render_sound_notification(&mut self, cx: &mut Context<Self>) -> impl IntoElement { fn render_sound_notification(&mut self, cx: &mut Context<Self>) -> impl IntoElement {
let play_sound_when_agent_done = let play_sound_when_agent_done = AgentSettings::get_global(cx).play_sound_when_agent_done;
AssistantSettings::get_global(cx).play_sound_when_agent_done;
h_flex() h_flex()
.gap_4() .gap_4()
@ -354,7 +353,7 @@ impl AgentConfiguration {
let fs = self.fs.clone(); let fs = self.fs.clone();
move |state, _window, cx| { move |state, _window, cx| {
let allow = state == &ToggleState::Selected; let allow = state == &ToggleState::Selected;
update_settings_file::<AssistantSettings>( update_settings_file::<AgentSettings>(
fs.clone(), fs.clone(),
cx, cx,
move |settings, _| { move |settings, _| {

View file

@ -2,7 +2,7 @@ mod profile_modal_header;
use std::sync::Arc; use std::sync::Arc;
use assistant_settings::{AgentProfile, AgentProfileId, AssistantSettings, builtin_profiles}; use agent_settings::{AgentProfile, AgentProfileId, AgentSettings, builtin_profiles};
use assistant_tool::ToolWorkingSet; use assistant_tool::ToolWorkingSet;
use convert_case::{Case, Casing as _}; use convert_case::{Case, Casing as _};
use editor::Editor; use editor::Editor;
@ -42,7 +42,7 @@ enum Mode {
impl Mode { impl Mode {
pub fn choose_profile(_window: &mut Window, cx: &mut Context<ManageProfilesModal>) -> Self { pub fn choose_profile(_window: &mut Window, cx: &mut Context<ManageProfilesModal>) -> Self {
let settings = AssistantSettings::get_global(cx); let settings = AgentSettings::get_global(cx);
let mut builtin_profiles = Vec::new(); let mut builtin_profiles = Vec::new();
let mut custom_profiles = Vec::new(); let mut custom_profiles = Vec::new();
@ -196,7 +196,7 @@ impl ManageProfilesModal {
window: &mut Window, window: &mut Window,
cx: &mut Context<Self>, cx: &mut Context<Self>,
) { ) {
let settings = AssistantSettings::get_global(cx); let settings = AgentSettings::get_global(cx);
let Some(profile) = settings.profiles.get(&profile_id).cloned() else { let Some(profile) = settings.profiles.get(&profile_id).cloned() else {
return; return;
}; };
@ -234,7 +234,7 @@ impl ManageProfilesModal {
window: &mut Window, window: &mut Window,
cx: &mut Context<Self>, cx: &mut Context<Self>,
) { ) {
let settings = AssistantSettings::get_global(cx); let settings = AgentSettings::get_global(cx);
let Some(profile) = settings.profiles.get(&profile_id).cloned() else { let Some(profile) = settings.profiles.get(&profile_id).cloned() else {
return; return;
}; };
@ -270,7 +270,7 @@ impl ManageProfilesModal {
match &self.mode { match &self.mode {
Mode::ChooseProfile { .. } => {} Mode::ChooseProfile { .. } => {}
Mode::NewProfile(mode) => { Mode::NewProfile(mode) => {
let settings = AssistantSettings::get_global(cx); let settings = AgentSettings::get_global(cx);
let base_profile = mode let base_profile = mode
.base_profile_id .base_profile_id
@ -332,7 +332,7 @@ impl ManageProfilesModal {
profile: AgentProfile, profile: AgentProfile,
cx: &mut Context<Self>, cx: &mut Context<Self>,
) { ) {
update_settings_file::<AssistantSettings>(self.fs.clone(), cx, { update_settings_file::<AgentSettings>(self.fs.clone(), cx, {
move |settings, _cx| { move |settings, _cx| {
settings.create_profile(profile_id, profile).log_err(); settings.create_profile(profile_id, profile).log_err();
} }
@ -485,7 +485,7 @@ impl ManageProfilesModal {
_window: &mut Window, _window: &mut Window,
cx: &mut Context<Self>, cx: &mut Context<Self>,
) -> impl IntoElement { ) -> impl IntoElement {
let settings = AssistantSettings::get_global(cx); let settings = AgentSettings::get_global(cx);
let base_profile_name = mode.base_profile_id.as_ref().map(|base_profile_id| { let base_profile_name = mode.base_profile_id.as_ref().map(|base_profile_id| {
settings settings
@ -518,7 +518,7 @@ impl ManageProfilesModal {
window: &mut Window, window: &mut Window,
cx: &mut Context<Self>, cx: &mut Context<Self>,
) -> impl IntoElement { ) -> impl IntoElement {
let settings = AssistantSettings::get_global(cx); let settings = AgentSettings::get_global(cx);
let profile_id = &settings.default_profile; let profile_id = &settings.default_profile;
let profile_name = settings let profile_name = settings
@ -712,7 +712,7 @@ impl ManageProfilesModal {
impl Render for ManageProfilesModal { impl Render for ManageProfilesModal {
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement { fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
let settings = AssistantSettings::get_global(cx); let settings = AgentSettings::get_global(cx);
let go_back_item = div() let go_back_item = div()
.id("cancel-item") .id("cancel-item")

View file

@ -1,7 +1,7 @@
use std::{collections::BTreeMap, sync::Arc}; use std::{collections::BTreeMap, sync::Arc};
use assistant_settings::{ use agent_settings::{
AgentProfile, AgentProfileContent, AgentProfileId, AssistantSettings, AssistantSettingsContent, AgentProfile, AgentProfileContent, AgentProfileId, AgentSettings, AgentSettingsContent,
ContextServerPresetContent, ContextServerPresetContent,
}; };
use assistant_tool::{ToolSource, ToolWorkingSet}; use assistant_tool::{ToolSource, ToolWorkingSet};
@ -259,7 +259,7 @@ impl PickerDelegate for ToolPickerDelegate {
is_enabled is_enabled
}; };
let active_profile_id = &AssistantSettings::get_global(cx).default_profile; let active_profile_id = &AgentSettings::get_global(cx).default_profile;
if active_profile_id == &self.profile_id { if active_profile_id == &self.profile_id {
self.thread_store self.thread_store
.update(cx, |this, cx| { .update(cx, |this, cx| {
@ -268,12 +268,12 @@ impl PickerDelegate for ToolPickerDelegate {
.log_err(); .log_err();
} }
update_settings_file::<AssistantSettings>(self.fs.clone(), cx, { update_settings_file::<AgentSettings>(self.fs.clone(), cx, {
let profile_id = self.profile_id.clone(); let profile_id = self.profile_id.clone();
let default_profile = self.profile.clone(); let default_profile = self.profile.clone();
let server_id = server_id.clone(); let server_id = server_id.clone();
let tool_name = tool_name.clone(); let tool_name = tool_name.clone();
move |settings: &mut AssistantSettingsContent, _cx| { move |settings: &mut AgentSettingsContent, _cx| {
settings settings
.v2_setting(|v2_settings| { .v2_setting(|v2_settings| {
let profiles = v2_settings.profiles.get_or_insert_default(); let profiles = v2_settings.profiles.get_or_insert_default();

View file

@ -1,6 +1,6 @@
use crate::{Keep, KeepAll, OpenAgentDiff, Reject, RejectAll, Thread, ThreadEvent}; use crate::{Keep, KeepAll, OpenAgentDiff, Reject, RejectAll, Thread, ThreadEvent};
use agent_settings::AgentSettings;
use anyhow::Result; use anyhow::Result;
use assistant_settings::AssistantSettings;
use buffer_diff::DiffHunkStatus; use buffer_diff::DiffHunkStatus;
use collections::{HashMap, HashSet}; use collections::{HashMap, HashSet};
use editor::{ use editor::{
@ -1253,9 +1253,9 @@ impl AgentDiff {
let settings_subscription = cx.observe_global_in::<SettingsStore>(window, { let settings_subscription = cx.observe_global_in::<SettingsStore>(window, {
let workspace = workspace.clone(); let workspace = workspace.clone();
let mut was_active = AssistantSettings::get_global(cx).single_file_review; let mut was_active = AgentSettings::get_global(cx).single_file_review;
move |this, window, cx| { move |this, window, cx| {
let is_active = AssistantSettings::get_global(cx).single_file_review; let is_active = AgentSettings::get_global(cx).single_file_review;
if was_active != is_active { if was_active != is_active {
was_active = is_active; was_active = is_active;
this.update_reviewing_editors(&workspace, window, cx); this.update_reviewing_editors(&workspace, window, cx);
@ -1461,7 +1461,7 @@ impl AgentDiff {
window: &mut Window, window: &mut Window,
cx: &mut Context<Self>, cx: &mut Context<Self>,
) { ) {
if !AssistantSettings::get_global(cx).single_file_review { if !AgentSettings::get_global(cx).single_file_review {
for (editor, _) in self.reviewing_editors.drain() { for (editor, _) in self.reviewing_editors.drain() {
editor editor
.update(cx, |editor, cx| editor.end_temporary_diff_override(cx)) .update(cx, |editor, cx| editor.end_temporary_diff_override(cx))
@ -1736,7 +1736,7 @@ impl editor::Addon for EditorAgentDiffAddon {
mod tests { mod tests {
use super::*; use super::*;
use crate::{Keep, ThreadStore, thread_store}; use crate::{Keep, ThreadStore, thread_store};
use assistant_settings::AssistantSettings; use agent_settings::AgentSettings;
use assistant_tool::ToolWorkingSet; use assistant_tool::ToolWorkingSet;
use editor::EditorSettings; use editor::EditorSettings;
use gpui::{TestAppContext, UpdateGlobal, VisualTestContext}; use gpui::{TestAppContext, UpdateGlobal, VisualTestContext};
@ -1755,7 +1755,7 @@ mod tests {
cx.set_global(settings_store); cx.set_global(settings_store);
language::init(cx); language::init(cx);
Project::init_settings(cx); Project::init_settings(cx);
AssistantSettings::register(cx); AgentSettings::register(cx);
prompt_store::init(cx); prompt_store::init(cx);
thread_store::init(cx); thread_store::init(cx);
workspace::init_settings(cx); workspace::init_settings(cx);
@ -1911,7 +1911,7 @@ mod tests {
cx.set_global(settings_store); cx.set_global(settings_store);
language::init(cx); language::init(cx);
Project::init_settings(cx); Project::init_settings(cx);
AssistantSettings::register(cx); AgentSettings::register(cx);
prompt_store::init(cx); prompt_store::init(cx);
thread_store::init(cx); thread_store::init(cx);
workspace::init_settings(cx); workspace::init_settings(cx);

View file

@ -1,4 +1,4 @@
use assistant_settings::AssistantSettings; use agent_settings::AgentSettings;
use fs::Fs; use fs::Fs;
use gpui::{Entity, FocusHandle, SharedString}; use gpui::{Entity, FocusHandle, SharedString};
@ -63,7 +63,7 @@ impl AgentModelSelector {
); );
} }
}); });
update_settings_file::<AssistantSettings>( update_settings_file::<AgentSettings>(
fs.clone(), fs.clone(),
cx, cx,
move |settings, _cx| { move |settings, _cx| {
@ -72,7 +72,7 @@ impl AgentModelSelector {
); );
} }
ModelType::InlineAssistant => { ModelType::InlineAssistant => {
update_settings_file::<AssistantSettings>( update_settings_file::<AgentSettings>(
fs.clone(), fs.clone(),
cx, cx,
move |settings, _cx| { move |settings, _cx| {

View file

@ -7,13 +7,13 @@ use std::time::Duration;
use db::kvp::{Dismissable, KEY_VALUE_STORE}; use db::kvp::{Dismissable, KEY_VALUE_STORE};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use agent_settings::{AgentDockPosition, AgentSettings, DefaultView};
use anyhow::{Result, anyhow}; use anyhow::{Result, anyhow};
use assistant_context_editor::{ use assistant_context_editor::{
AgentPanelDelegate, AssistantContext, ConfigurationError, ContextEditor, ContextEvent, AgentPanelDelegate, AssistantContext, ConfigurationError, ContextEditor, ContextEvent,
ContextSummary, SlashCommandCompletionProvider, humanize_token_count, ContextSummary, SlashCommandCompletionProvider, humanize_token_count,
make_lsp_adapter_delegate, render_remaining_tokens, make_lsp_adapter_delegate, render_remaining_tokens,
}; };
use assistant_settings::{AssistantDockPosition, AssistantSettings, DefaultView};
use assistant_slash_command::SlashCommandWorkingSet; use assistant_slash_command::SlashCommandWorkingSet;
use assistant_tool::ToolWorkingSet; use assistant_tool::ToolWorkingSet;
@ -523,7 +523,7 @@ impl AgentPanel {
cx.observe(&history_store, |_, _, cx| cx.notify()).detach(); cx.observe(&history_store, |_, _, cx| cx.notify()).detach();
let panel_type = AssistantSettings::get_global(cx).default_view; let panel_type = AgentSettings::get_global(cx).default_view;
let active_view = match panel_type { let active_view = match panel_type {
DefaultView::Thread => ActiveView::thread(thread.clone(), window, cx), DefaultView::Thread => ActiveView::thread(thread.clone(), window, cx),
DefaultView::TextThread => { DefaultView::TextThread => {
@ -1250,7 +1250,7 @@ impl AgentPanel {
.map_or(true, |model| model.provider.id() != provider.id()) .map_or(true, |model| model.provider.id() != provider.id())
{ {
if let Some(model) = provider.default_model(cx) { if let Some(model) = provider.default_model(cx) {
update_settings_file::<AssistantSettings>( update_settings_file::<AgentSettings>(
self.fs.clone(), self.fs.clone(),
cx, cx,
move |settings, _| settings.set_model(model), move |settings, _| settings.set_model(model),
@ -1381,10 +1381,10 @@ impl Focusable for AgentPanel {
} }
fn agent_panel_dock_position(cx: &App) -> DockPosition { fn agent_panel_dock_position(cx: &App) -> DockPosition {
match AssistantSettings::get_global(cx).dock { match AgentSettings::get_global(cx).dock {
AssistantDockPosition::Left => DockPosition::Left, AgentDockPosition::Left => DockPosition::Left,
AssistantDockPosition::Bottom => DockPosition::Bottom, AgentDockPosition::Bottom => DockPosition::Bottom,
AssistantDockPosition::Right => DockPosition::Right, AgentDockPosition::Right => DockPosition::Right,
} }
} }
@ -1404,22 +1404,18 @@ impl Panel for AgentPanel {
} }
fn set_position(&mut self, position: DockPosition, _: &mut Window, cx: &mut Context<Self>) { fn set_position(&mut self, position: DockPosition, _: &mut Window, cx: &mut Context<Self>) {
settings::update_settings_file::<AssistantSettings>( settings::update_settings_file::<AgentSettings>(self.fs.clone(), cx, move |settings, _| {
self.fs.clone(), let dock = match position {
cx, DockPosition::Left => AgentDockPosition::Left,
move |settings, _| { DockPosition::Bottom => AgentDockPosition::Bottom,
let dock = match position { DockPosition::Right => AgentDockPosition::Right,
DockPosition::Left => AssistantDockPosition::Left, };
DockPosition::Bottom => AssistantDockPosition::Bottom, settings.set_dock(dock);
DockPosition::Right => AssistantDockPosition::Right, });
};
settings.set_dock(dock);
},
);
} }
fn size(&self, window: &Window, cx: &App) -> Pixels { fn size(&self, window: &Window, cx: &App) -> Pixels {
let settings = AssistantSettings::get_global(cx); let settings = AgentSettings::get_global(cx);
match self.position(window, cx) { match self.position(window, cx) {
DockPosition::Left | DockPosition::Right => { DockPosition::Left | DockPosition::Right => {
self.width.unwrap_or(settings.default_width) self.width.unwrap_or(settings.default_width)
@ -1444,8 +1440,7 @@ impl Panel for AgentPanel {
} }
fn icon(&self, _window: &Window, cx: &App) -> Option<IconName> { fn icon(&self, _window: &Window, cx: &App) -> Option<IconName> {
(self.enabled(cx) && AssistantSettings::get_global(cx).button) (self.enabled(cx) && AgentSettings::get_global(cx).button).then_some(IconName::ZedAssistant)
.then_some(IconName::ZedAssistant)
} }
fn icon_tooltip(&self, _window: &Window, _cx: &App) -> Option<&'static str> { fn icon_tooltip(&self, _window: &Window, _cx: &App) -> Option<&'static str> {
@ -1461,7 +1456,7 @@ impl Panel for AgentPanel {
} }
fn enabled(&self, cx: &App) -> bool { fn enabled(&self, cx: &App) -> bool {
AssistantSettings::get_global(cx).enabled AgentSettings::get_global(cx).enabled
} }
fn is_zoomed(&self, _window: &Window, _cx: &App) -> bool { fn is_zoomed(&self, _window: &Window, _cx: &App) -> bool {

View file

@ -1,8 +1,8 @@
use crate::context::ContextLoadResult; use crate::context::ContextLoadResult;
use crate::inline_prompt_editor::CodegenStatus; use crate::inline_prompt_editor::CodegenStatus;
use crate::{context::load_context, context_store::ContextStore}; use crate::{context::load_context, context_store::ContextStore};
use agent_settings::AgentSettings;
use anyhow::{Context as _, Result}; use anyhow::{Context as _, Result};
use assistant_settings::AssistantSettings;
use client::telemetry::Telemetry; use client::telemetry::Telemetry;
use collections::HashSet; use collections::HashSet;
use editor::{Anchor, AnchorRangeExt, MultiBuffer, MultiBufferSnapshot, ToOffset as _, ToPoint}; use editor::{Anchor, AnchorRangeExt, MultiBuffer, MultiBufferSnapshot, ToOffset as _, ToPoint};
@ -443,7 +443,7 @@ impl CodegenAlternative {
} }
}); });
let temperature = AssistantSettings::temperature_for_model(&model, cx); let temperature = AgentSettings::temperature_for_model(&model, cx);
Ok(cx.spawn(async move |_cx| { Ok(cx.spawn(async move |_cx| {
let mut request_message = LanguageModelRequestMessage { let mut request_message = LanguageModelRequestMessage {

View file

@ -4,8 +4,8 @@ use std::ops::Range;
use std::rc::Rc; use std::rc::Rc;
use std::sync::Arc; use std::sync::Arc;
use agent_settings::AgentSettings;
use anyhow::{Context as _, Result}; use anyhow::{Context as _, Result};
use assistant_settings::AssistantSettings;
use client::telemetry::Telemetry; use client::telemetry::Telemetry;
use collections::{HashMap, HashSet, VecDeque, hash_map}; use collections::{HashMap, HashSet, VecDeque, hash_map};
use editor::display_map::EditorMargins; use editor::display_map::EditorMargins;
@ -134,7 +134,7 @@ impl InlineAssistant {
let Some(terminal_panel) = workspace.read(cx).panel::<TerminalPanel>(cx) else { let Some(terminal_panel) = workspace.read(cx).panel::<TerminalPanel>(cx) else {
return; return;
}; };
let enabled = AssistantSettings::get_global(cx).enabled; let enabled = AgentSettings::get_global(cx).enabled;
terminal_panel.update(cx, |terminal_panel, cx| { terminal_panel.update(cx, |terminal_panel, cx| {
terminal_panel.set_assistant_enabled(enabled, cx) terminal_panel.set_assistant_enabled(enabled, cx)
}); });
@ -219,7 +219,7 @@ impl InlineAssistant {
window: &mut Window, window: &mut Window,
cx: &mut Context<Workspace>, cx: &mut Context<Workspace>,
) { ) {
let settings = AssistantSettings::get_global(cx); let settings = AgentSettings::get_global(cx);
if !settings.enabled { if !settings.enabled {
return; return;
} }
@ -1771,7 +1771,7 @@ impl CodeActionProvider for AssistantCodeActionProvider {
_: &mut Window, _: &mut Window,
cx: &mut App, cx: &mut App,
) -> Task<Result<Vec<CodeAction>>> { ) -> Task<Result<Vec<CodeAction>>> {
if !AssistantSettings::get_global(cx).enabled { if !AgentSettings::get_global(cx).enabled {
return Task::ready(Ok(Vec::new())); return Task::ready(Ok(Vec::new()));
} }

View file

@ -9,8 +9,8 @@ use crate::ui::{
AnimatedLabel, MaxModeTooltip, AnimatedLabel, MaxModeTooltip,
preview::{AgentPreview, UsageCallout}, preview::{AgentPreview, UsageCallout},
}; };
use agent_settings::{AgentSettings, CompletionMode};
use assistant_context_editor::language_model_selector::ToggleModelSelector; use assistant_context_editor::language_model_selector::ToggleModelSelector;
use assistant_settings::{AssistantSettings, CompletionMode};
use buffer_diff::BufferDiff; use buffer_diff::BufferDiff;
use client::UserStore; use client::UserStore;
use collections::{HashMap, HashSet}; use collections::{HashMap, HashSet};
@ -1272,7 +1272,7 @@ impl MessageEditor {
tools: vec![], tools: vec![],
tool_choice: None, tool_choice: None,
stop: vec![], stop: vec![],
temperature: AssistantSettings::temperature_for_model(&model.model, cx), temperature: AgentSettings::temperature_for_model(&model.model, cx),
}; };
Some(model.model.count_tokens(request, cx)) Some(model.model.count_tokens(request, cx))

View file

@ -1,7 +1,7 @@
use std::sync::Arc; use std::sync::Arc;
use assistant_settings::{ use agent_settings::{
AgentProfile, AgentProfileId, AssistantDockPosition, AssistantSettings, GroupedAgentProfiles, AgentDockPosition, AgentProfile, AgentProfileId, AgentSettings, GroupedAgentProfiles,
builtin_profiles, builtin_profiles,
}; };
use fs::Fs; use fs::Fs;
@ -39,7 +39,7 @@ impl ProfileSelector {
}); });
Self { Self {
profiles: GroupedAgentProfiles::from_settings(AssistantSettings::get_global(cx)), profiles: GroupedAgentProfiles::from_settings(AgentSettings::get_global(cx)),
fs, fs,
thread, thread,
thread_store, thread_store,
@ -54,7 +54,7 @@ impl ProfileSelector {
} }
fn refresh_profiles(&mut self, cx: &mut Context<Self>) { fn refresh_profiles(&mut self, cx: &mut Context<Self>) {
self.profiles = GroupedAgentProfiles::from_settings(AssistantSettings::get_global(cx)); self.profiles = GroupedAgentProfiles::from_settings(AgentSettings::get_global(cx));
} }
fn build_context_menu( fn build_context_menu(
@ -63,7 +63,7 @@ impl ProfileSelector {
cx: &mut Context<Self>, cx: &mut Context<Self>,
) -> Entity<ContextMenu> { ) -> Entity<ContextMenu> {
ContextMenu::build(window, cx, |mut menu, _window, cx| { ContextMenu::build(window, cx, |mut menu, _window, cx| {
let settings = AssistantSettings::get_global(cx); let settings = AgentSettings::get_global(cx);
for (profile_id, profile) in self.profiles.builtin.iter() { for (profile_id, profile) in self.profiles.builtin.iter() {
menu = menu.item(self.menu_entry_for_profile( menu = menu.item(self.menu_entry_for_profile(
profile_id.clone(), profile_id.clone(),
@ -100,7 +100,7 @@ impl ProfileSelector {
&self, &self,
profile_id: AgentProfileId, profile_id: AgentProfileId,
profile: &AgentProfile, profile: &AgentProfile,
settings: &AssistantSettings, settings: &AgentSettings,
_cx: &App, _cx: &App,
) -> ContextMenuEntry { ) -> ContextMenuEntry {
let documentation = match profile.name.to_lowercase().as_str() { let documentation = match profile.name.to_lowercase().as_str() {
@ -126,7 +126,7 @@ impl ProfileSelector {
let thread_store = self.thread_store.clone(); let thread_store = self.thread_store.clone();
let profile_id = profile_id.clone(); let profile_id = profile_id.clone();
move |_window, cx| { move |_window, cx| {
update_settings_file::<AssistantSettings>(fs.clone(), cx, { update_settings_file::<AgentSettings>(fs.clone(), cx, {
let profile_id = profile_id.clone(); let profile_id = profile_id.clone();
move |settings, _cx| { move |settings, _cx| {
settings.set_profile(profile_id.clone()); settings.set_profile(profile_id.clone());
@ -145,7 +145,7 @@ impl ProfileSelector {
impl Render for ProfileSelector { impl Render for ProfileSelector {
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement { fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
let settings = AssistantSettings::get_global(cx); let settings = AgentSettings::get_global(cx);
let profile_id = &settings.default_profile; let profile_id = &settings.default_profile;
let profile = settings.profiles.get(profile_id); let profile = settings.profiles.get(profile_id);
@ -208,10 +208,10 @@ impl Render for ProfileSelector {
} }
} }
fn documentation_side(position: AssistantDockPosition) -> DocumentationSide { fn documentation_side(position: AgentDockPosition) -> DocumentationSide {
match position { match position {
AssistantDockPosition::Left => DocumentationSide::Right, AgentDockPosition::Left => DocumentationSide::Right,
AssistantDockPosition::Bottom => DocumentationSide::Left, AgentDockPosition::Bottom => DocumentationSide::Left,
AssistantDockPosition::Right => DocumentationSide::Left, AgentDockPosition::Right => DocumentationSide::Left,
} }
} }

View file

@ -5,8 +5,8 @@ use crate::inline_prompt_editor::{
}; };
use crate::terminal_codegen::{CLEAR_INPUT, CodegenEvent, TerminalCodegen}; use crate::terminal_codegen::{CLEAR_INPUT, CodegenEvent, TerminalCodegen};
use crate::thread_store::{TextThreadStore, ThreadStore}; use crate::thread_store::{TextThreadStore, ThreadStore};
use agent_settings::AgentSettings;
use anyhow::{Context as _, Result}; use anyhow::{Context as _, Result};
use assistant_settings::AssistantSettings;
use client::telemetry::Telemetry; use client::telemetry::Telemetry;
use collections::{HashMap, VecDeque}; use collections::{HashMap, VecDeque};
use editor::{MultiBuffer, actions::SelectAll}; use editor::{MultiBuffer, actions::SelectAll};
@ -271,7 +271,7 @@ impl TerminalInlineAssistant {
.inline_assistant_model() .inline_assistant_model()
.context("No inline assistant model")?; .context("No inline assistant model")?;
let temperature = AssistantSettings::temperature_for_model(&model, cx); let temperature = AgentSettings::temperature_for_model(&model, cx);
Ok(cx.background_spawn(async move { Ok(cx.background_spawn(async move {
let mut request_message = LanguageModelRequestMessage { let mut request_message = LanguageModelRequestMessage {

View file

@ -4,8 +4,8 @@ use std::ops::Range;
use std::sync::Arc; use std::sync::Arc;
use std::time::Instant; use std::time::Instant;
use agent_settings::{AgentSettings, CompletionMode};
use anyhow::{Result, anyhow}; use anyhow::{Result, anyhow};
use assistant_settings::{AssistantSettings, CompletionMode};
use assistant_tool::{ActionLog, AnyToolCard, Tool, ToolWorkingSet}; use assistant_tool::{ActionLog, AnyToolCard, Tool, ToolWorkingSet};
use chrono::{DateTime, Utc}; use chrono::{DateTime, Utc};
use collections::HashMap; use collections::HashMap;
@ -329,7 +329,7 @@ pub struct Thread {
detailed_summary_task: Task<Option<()>>, detailed_summary_task: Task<Option<()>>,
detailed_summary_tx: postage::watch::Sender<DetailedSummaryState>, detailed_summary_tx: postage::watch::Sender<DetailedSummaryState>,
detailed_summary_rx: postage::watch::Receiver<DetailedSummaryState>, detailed_summary_rx: postage::watch::Receiver<DetailedSummaryState>,
completion_mode: assistant_settings::CompletionMode, completion_mode: agent_settings::CompletionMode,
messages: Vec<Message>, messages: Vec<Message>,
next_message_id: MessageId, next_message_id: MessageId,
last_prompt_id: PromptId, last_prompt_id: PromptId,
@ -415,7 +415,7 @@ impl Thread {
detailed_summary_task: Task::ready(None), detailed_summary_task: Task::ready(None),
detailed_summary_tx, detailed_summary_tx,
detailed_summary_rx, detailed_summary_rx,
completion_mode: AssistantSettings::get_global(cx).preferred_completion_mode, completion_mode: AgentSettings::get_global(cx).preferred_completion_mode,
messages: Vec::new(), messages: Vec::new(),
next_message_id: MessageId(0), next_message_id: MessageId(0),
last_prompt_id: PromptId::new(), last_prompt_id: PromptId::new(),
@ -493,7 +493,7 @@ impl Thread {
let completion_mode = serialized let completion_mode = serialized
.completion_mode .completion_mode
.unwrap_or_else(|| AssistantSettings::get_global(cx).preferred_completion_mode); .unwrap_or_else(|| AgentSettings::get_global(cx).preferred_completion_mode);
Self { Self {
id, id,
@ -1204,7 +1204,7 @@ impl Thread {
tools: Vec::new(), tools: Vec::new(),
tool_choice: None, tool_choice: None,
stop: Vec::new(), stop: Vec::new(),
temperature: AssistantSettings::temperature_for_model(&model, cx), temperature: AgentSettings::temperature_for_model(&model, cx),
}; };
let available_tools = self.available_tools(cx, model.clone()); let available_tools = self.available_tools(cx, model.clone());
@ -1363,7 +1363,7 @@ impl Thread {
tools: Vec::new(), tools: Vec::new(),
tool_choice: None, tool_choice: None,
stop: Vec::new(), stop: Vec::new(),
temperature: AssistantSettings::temperature_for_model(model, cx), temperature: AgentSettings::temperature_for_model(model, cx),
}; };
for message in &self.messages { for message in &self.messages {
@ -2039,7 +2039,7 @@ impl Thread {
for tool_use in pending_tool_uses.iter() { for tool_use in pending_tool_uses.iter() {
if let Some(tool) = self.tools.read(cx).tool(&tool_use.name, cx) { if let Some(tool) = self.tools.read(cx).tool(&tool_use.name, cx) {
if tool.needs_confirmation(&tool_use.input, cx) if tool.needs_confirmation(&tool_use.input, cx)
&& !AssistantSettings::get_global(cx).always_allow_tool_actions && !AgentSettings::get_global(cx).always_allow_tool_actions
{ {
self.tool_use.confirm_tool_use( self.tool_use.confirm_tool_use(
tool_use.id.clone(), tool_use.id.clone(),
@ -2835,7 +2835,7 @@ struct PendingCompletion {
mod tests { mod tests {
use super::*; use super::*;
use crate::{ThreadStore, context::load_context, context_store::ContextStore, thread_store}; use crate::{ThreadStore, context::load_context, context_store::ContextStore, thread_store};
use assistant_settings::{AssistantSettings, LanguageModelParameters}; use agent_settings::{AgentSettings, LanguageModelParameters};
use assistant_tool::ToolRegistry; use assistant_tool::ToolRegistry;
use editor::EditorSettings; use editor::EditorSettings;
use gpui::TestAppContext; use gpui::TestAppContext;
@ -3263,14 +3263,14 @@ fn main() {{
// Both model and provider // Both model and provider
cx.update(|cx| { cx.update(|cx| {
AssistantSettings::override_global( AgentSettings::override_global(
AssistantSettings { AgentSettings {
model_parameters: vec![LanguageModelParameters { model_parameters: vec![LanguageModelParameters {
provider: Some(model.provider_id().0.to_string().into()), provider: Some(model.provider_id().0.to_string().into()),
model: Some(model.id().0.clone()), model: Some(model.id().0.clone()),
temperature: Some(0.66), temperature: Some(0.66),
}], }],
..AssistantSettings::get_global(cx).clone() ..AgentSettings::get_global(cx).clone()
}, },
cx, cx,
); );
@ -3283,14 +3283,14 @@ fn main() {{
// Only model // Only model
cx.update(|cx| { cx.update(|cx| {
AssistantSettings::override_global( AgentSettings::override_global(
AssistantSettings { AgentSettings {
model_parameters: vec![LanguageModelParameters { model_parameters: vec![LanguageModelParameters {
provider: None, provider: None,
model: Some(model.id().0.clone()), model: Some(model.id().0.clone()),
temperature: Some(0.66), temperature: Some(0.66),
}], }],
..AssistantSettings::get_global(cx).clone() ..AgentSettings::get_global(cx).clone()
}, },
cx, cx,
); );
@ -3303,14 +3303,14 @@ fn main() {{
// Only provider // Only provider
cx.update(|cx| { cx.update(|cx| {
AssistantSettings::override_global( AgentSettings::override_global(
AssistantSettings { AgentSettings {
model_parameters: vec![LanguageModelParameters { model_parameters: vec![LanguageModelParameters {
provider: Some(model.provider_id().0.to_string().into()), provider: Some(model.provider_id().0.to_string().into()),
model: None, model: None,
temperature: Some(0.66), temperature: Some(0.66),
}], }],
..AssistantSettings::get_global(cx).clone() ..AgentSettings::get_global(cx).clone()
}, },
cx, cx,
); );
@ -3323,14 +3323,14 @@ fn main() {{
// Same model name, different provider // Same model name, different provider
cx.update(|cx| { cx.update(|cx| {
AssistantSettings::override_global( AgentSettings::override_global(
AssistantSettings { AgentSettings {
model_parameters: vec![LanguageModelParameters { model_parameters: vec![LanguageModelParameters {
provider: Some("anthropic".into()), provider: Some("anthropic".into()),
model: Some(model.id().0.clone()), model: Some(model.id().0.clone()),
temperature: Some(0.66), temperature: Some(0.66),
}], }],
..AssistantSettings::get_global(cx).clone() ..AgentSettings::get_global(cx).clone()
}, },
cx, cx,
); );
@ -3538,7 +3538,7 @@ fn main() {{
cx.set_global(settings_store); cx.set_global(settings_store);
language::init(cx); language::init(cx);
Project::init_settings(cx); Project::init_settings(cx);
AssistantSettings::register(cx); AgentSettings::register(cx);
prompt_store::init(cx); prompt_store::init(cx);
thread_store::init(cx); thread_store::init(cx);
workspace::init_settings(cx); workspace::init_settings(cx);

View file

@ -4,8 +4,8 @@ use std::path::{Path, PathBuf};
use std::rc::Rc; use std::rc::Rc;
use std::sync::Arc; use std::sync::Arc;
use agent_settings::{AgentProfile, AgentProfileId, AgentSettings, CompletionMode};
use anyhow::{Context as _, Result, anyhow}; use anyhow::{Context as _, Result, anyhow};
use assistant_settings::{AgentProfile, AgentProfileId, AssistantSettings, CompletionMode};
use assistant_tool::{ToolId, ToolSource, ToolWorkingSet}; use assistant_tool::{ToolId, ToolSource, ToolWorkingSet};
use chrono::{DateTime, Utc}; use chrono::{DateTime, Utc};
use collections::HashMap; use collections::HashMap;
@ -485,13 +485,13 @@ impl ThreadStore {
} }
fn load_default_profile(&self, cx: &mut Context<Self>) { fn load_default_profile(&self, cx: &mut Context<Self>) {
let assistant_settings = AssistantSettings::get_global(cx); let assistant_settings = AgentSettings::get_global(cx);
self.load_profile_by_id(assistant_settings.default_profile.clone(), cx); self.load_profile_by_id(assistant_settings.default_profile.clone(), cx);
} }
pub fn load_profile_by_id(&self, profile_id: AgentProfileId, cx: &mut Context<Self>) { pub fn load_profile_by_id(&self, profile_id: AgentProfileId, cx: &mut Context<Self>) {
let assistant_settings = AssistantSettings::get_global(cx); let assistant_settings = AgentSettings::get_global(cx);
if let Some(profile) = assistant_settings.profiles.get(&profile_id) { if let Some(profile) = assistant_settings.profiles.get(&profile_id) {
self.load_profile(profile.clone(), cx); self.load_profile(profile.clone(), cx);

View file

@ -1,5 +1,5 @@
[package] [package]
name = "assistant_settings" name = "agent_settings"
version = "0.1.0" version = "0.1.0"
edition.workspace = true edition.workspace = true
publish.workspace = true publish.workspace = true
@ -9,7 +9,7 @@ license = "GPL-3.0-or-later"
workspace = true workspace = true
[lib] [lib]
path = "src/assistant_settings.rs" path = "src/agent_settings.rs"
[dependencies] [dependencies]
anthropic = { workspace = true, features = ["schemars"] } anthropic = { workspace = true, features = ["schemars"] }

View file

@ -24,7 +24,7 @@ pub struct GroupedAgentProfiles {
} }
impl GroupedAgentProfiles { impl GroupedAgentProfiles {
pub fn from_settings(settings: &crate::AssistantSettings) -> Self { pub fn from_settings(settings: &crate::AgentSettings) -> Self {
let mut builtin = IndexMap::default(); let mut builtin = IndexMap::default();
let mut custom = IndexMap::default(); let mut custom = IndexMap::default();

View file

@ -19,12 +19,12 @@ use settings::{Settings, SettingsSources};
pub use crate::agent_profile::*; pub use crate::agent_profile::*;
pub fn init(cx: &mut App) { pub fn init(cx: &mut App) {
AssistantSettings::register(cx); AgentSettings::register(cx);
} }
#[derive(Copy, Clone, Default, Debug, Serialize, Deserialize, JsonSchema)] #[derive(Copy, Clone, Default, Debug, Serialize, Deserialize, JsonSchema)]
#[serde(rename_all = "snake_case")] #[serde(rename_all = "snake_case")]
pub enum AssistantDockPosition { pub enum AgentDockPosition {
Left, Left,
#[default] #[default]
Right, Right,
@ -51,7 +51,7 @@ pub enum NotifyWhenAgentWaiting {
#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq)] #[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq)]
#[serde(tag = "name", rename_all = "snake_case")] #[serde(tag = "name", rename_all = "snake_case")]
#[schemars(deny_unknown_fields)] #[schemars(deny_unknown_fields)]
pub enum AssistantProviderContentV1 { pub enum AgentProviderContentV1 {
#[serde(rename = "zed.dev")] #[serde(rename = "zed.dev")]
ZedDotDev { default_model: Option<String> }, ZedDotDev { default_model: Option<String> },
#[serde(rename = "openai")] #[serde(rename = "openai")]
@ -88,10 +88,10 @@ pub enum AssistantProviderContentV1 {
} }
#[derive(Default, Clone, Debug)] #[derive(Default, Clone, Debug)]
pub struct AssistantSettings { pub struct AgentSettings {
pub enabled: bool, pub enabled: bool,
pub button: bool, pub button: bool,
pub dock: AssistantDockPosition, pub dock: AgentDockPosition,
pub default_width: Pixels, pub default_width: Pixels,
pub default_height: Pixels, pub default_height: Pixels,
pub default_model: LanguageModelSelection, pub default_model: LanguageModelSelection,
@ -113,7 +113,7 @@ pub struct AssistantSettings {
pub enable_feedback: bool, pub enable_feedback: bool,
} }
impl AssistantSettings { impl AgentSettings {
pub fn temperature_for_model(model: &Arc<dyn LanguageModel>, cx: &App) -> Option<f32> { pub fn temperature_for_model(model: &Arc<dyn LanguageModel>, cx: &App) -> Option<f32> {
let settings = Self::get_global(cx); let settings = Self::get_global(cx);
settings settings
@ -168,58 +168,56 @@ impl LanguageModelParameters {
} }
} }
/// Assistant panel settings /// Agent panel settings
#[derive(Clone, Serialize, Deserialize, Debug, Default)] #[derive(Clone, Serialize, Deserialize, Debug, Default)]
pub struct AssistantSettingsContent { pub struct AgentSettingsContent {
#[serde(flatten)] #[serde(flatten)]
pub inner: Option<AssistantSettingsContentInner>, pub inner: Option<AgentSettingsContentInner>,
} }
#[derive(Clone, Serialize, Deserialize, Debug)] #[derive(Clone, Serialize, Deserialize, Debug)]
#[serde(untagged)] #[serde(untagged)]
pub enum AssistantSettingsContentInner { pub enum AgentSettingsContentInner {
Versioned(Box<VersionedAssistantSettingsContent>), Versioned(Box<VersionedAgentSettingsContent>),
Legacy(LegacyAssistantSettingsContent), Legacy(LegacyAgentSettingsContent),
} }
impl AssistantSettingsContentInner { impl AgentSettingsContentInner {
fn for_v2(content: AssistantSettingsContentV2) -> Self { fn for_v2(content: AgentSettingsContentV2) -> Self {
AssistantSettingsContentInner::Versioned(Box::new(VersionedAssistantSettingsContent::V2( AgentSettingsContentInner::Versioned(Box::new(VersionedAgentSettingsContent::V2(content)))
content,
)))
} }
} }
impl JsonSchema for AssistantSettingsContent { impl JsonSchema for AgentSettingsContent {
fn schema_name() -> String { fn schema_name() -> String {
VersionedAssistantSettingsContent::schema_name() VersionedAgentSettingsContent::schema_name()
} }
fn json_schema(r#gen: &mut schemars::r#gen::SchemaGenerator) -> Schema { fn json_schema(r#gen: &mut schemars::r#gen::SchemaGenerator) -> Schema {
VersionedAssistantSettingsContent::json_schema(r#gen) VersionedAgentSettingsContent::json_schema(r#gen)
} }
fn is_referenceable() -> bool { fn is_referenceable() -> bool {
VersionedAssistantSettingsContent::is_referenceable() VersionedAgentSettingsContent::is_referenceable()
} }
} }
impl AssistantSettingsContent { impl AgentSettingsContent {
pub fn is_version_outdated(&self) -> bool { pub fn is_version_outdated(&self) -> bool {
match &self.inner { match &self.inner {
Some(AssistantSettingsContentInner::Versioned(settings)) => match **settings { Some(AgentSettingsContentInner::Versioned(settings)) => match **settings {
VersionedAssistantSettingsContent::V1(_) => true, VersionedAgentSettingsContent::V1(_) => true,
VersionedAssistantSettingsContent::V2(_) => false, VersionedAgentSettingsContent::V2(_) => false,
}, },
Some(AssistantSettingsContentInner::Legacy(_)) => true, Some(AgentSettingsContentInner::Legacy(_)) => true,
None => false, None => false,
} }
} }
fn upgrade(&self) -> AssistantSettingsContentV2 { fn upgrade(&self) -> AgentSettingsContentV2 {
match &self.inner { match &self.inner {
Some(AssistantSettingsContentInner::Versioned(settings)) => match **settings { Some(AgentSettingsContentInner::Versioned(settings)) => match **settings {
VersionedAssistantSettingsContent::V1(ref settings) => AssistantSettingsContentV2 { VersionedAgentSettingsContent::V1(ref settings) => AgentSettingsContentV2 {
enabled: settings.enabled, enabled: settings.enabled,
button: settings.button, button: settings.button,
dock: settings.dock, dock: settings.dock,
@ -229,48 +227,42 @@ impl AssistantSettingsContent {
.provider .provider
.clone() .clone()
.and_then(|provider| match provider { .and_then(|provider| match provider {
AssistantProviderContentV1::ZedDotDev { default_model } => { AgentProviderContentV1::ZedDotDev { default_model } => default_model
default_model.map(|model| LanguageModelSelection { .map(|model| LanguageModelSelection {
provider: "zed.dev".into(), provider: "zed.dev".into(),
model, model,
}) }),
} AgentProviderContentV1::OpenAi { default_model, .. } => default_model
AssistantProviderContentV1::OpenAi { default_model, .. } => { .map(|model| LanguageModelSelection {
default_model.map(|model| LanguageModelSelection {
provider: "openai".into(), provider: "openai".into(),
model: model.id().to_string(), model: model.id().to_string(),
}) }),
} AgentProviderContentV1::Anthropic { default_model, .. } => {
AssistantProviderContentV1::Anthropic { default_model, .. } => {
default_model.map(|model| LanguageModelSelection { default_model.map(|model| LanguageModelSelection {
provider: "anthropic".into(), provider: "anthropic".into(),
model: model.id().to_string(), model: model.id().to_string(),
}) })
} }
AssistantProviderContentV1::Ollama { default_model, .. } => { AgentProviderContentV1::Ollama { default_model, .. } => default_model
default_model.map(|model| LanguageModelSelection { .map(|model| LanguageModelSelection {
provider: "ollama".into(), provider: "ollama".into(),
model: model.id().to_string(), model: model.id().to_string(),
}) }),
} AgentProviderContentV1::LmStudio { default_model, .. } => default_model
AssistantProviderContentV1::LmStudio { default_model, .. } => { .map(|model| LanguageModelSelection {
default_model.map(|model| LanguageModelSelection {
provider: "lmstudio".into(), provider: "lmstudio".into(),
model: model.id().to_string(), model: model.id().to_string(),
}) }),
} AgentProviderContentV1::DeepSeek { default_model, .. } => default_model
AssistantProviderContentV1::DeepSeek { default_model, .. } => { .map(|model| LanguageModelSelection {
default_model.map(|model| LanguageModelSelection {
provider: "deepseek".into(), provider: "deepseek".into(),
model: model.id().to_string(), model: model.id().to_string(),
}) }),
} AgentProviderContentV1::Mistral { default_model, .. } => default_model
AssistantProviderContentV1::Mistral { default_model, .. } => { .map(|model| LanguageModelSelection {
default_model.map(|model| LanguageModelSelection {
provider: "mistral".into(), provider: "mistral".into(),
model: model.id().to_string(), model: model.id().to_string(),
}) }),
}
}), }),
inline_assistant_model: None, inline_assistant_model: None,
commit_message_model: None, commit_message_model: None,
@ -288,9 +280,9 @@ impl AssistantSettingsContent {
enable_feedback: None, enable_feedback: None,
play_sound_when_agent_done: None, play_sound_when_agent_done: None,
}, },
VersionedAssistantSettingsContent::V2(ref settings) => settings.clone(), VersionedAgentSettingsContent::V2(ref settings) => settings.clone(),
}, },
Some(AssistantSettingsContentInner::Legacy(settings)) => AssistantSettingsContentV2 { Some(AgentSettingsContentInner::Legacy(settings)) => AgentSettingsContentV2 {
enabled: None, enabled: None,
button: settings.button, button: settings.button,
dock: settings.dock, dock: settings.dock,
@ -321,30 +313,28 @@ impl AssistantSettingsContent {
enable_feedback: None, enable_feedback: None,
play_sound_when_agent_done: None, play_sound_when_agent_done: None,
}, },
None => AssistantSettingsContentV2::default(), None => AgentSettingsContentV2::default(),
} }
} }
pub fn set_dock(&mut self, dock: AssistantDockPosition) { pub fn set_dock(&mut self, dock: AgentDockPosition) {
match &mut self.inner { match &mut self.inner {
Some(AssistantSettingsContentInner::Versioned(settings)) => match **settings { Some(AgentSettingsContentInner::Versioned(settings)) => match **settings {
VersionedAssistantSettingsContent::V1(ref mut settings) => { VersionedAgentSettingsContent::V1(ref mut settings) => {
settings.dock = Some(dock); settings.dock = Some(dock);
} }
VersionedAssistantSettingsContent::V2(ref mut settings) => { VersionedAgentSettingsContent::V2(ref mut settings) => {
settings.dock = Some(dock); settings.dock = Some(dock);
} }
}, },
Some(AssistantSettingsContentInner::Legacy(settings)) => { Some(AgentSettingsContentInner::Legacy(settings)) => {
settings.dock = Some(dock); settings.dock = Some(dock);
} }
None => { None => {
self.inner = Some(AssistantSettingsContentInner::for_v2( self.inner = Some(AgentSettingsContentInner::for_v2(AgentSettingsContentV2 {
AssistantSettingsContentV2 { dock: Some(dock),
dock: Some(dock), ..Default::default()
..Default::default() }))
},
))
} }
} }
} }
@ -354,107 +344,99 @@ impl AssistantSettingsContent {
let provider = language_model.provider_id().0.to_string(); let provider = language_model.provider_id().0.to_string();
match &mut self.inner { match &mut self.inner {
Some(AssistantSettingsContentInner::Versioned(settings)) => match **settings { Some(AgentSettingsContentInner::Versioned(settings)) => match **settings {
VersionedAssistantSettingsContent::V1(ref mut settings) => { VersionedAgentSettingsContent::V1(ref mut settings) => match provider.as_ref() {
match provider.as_ref() { "zed.dev" => {
"zed.dev" => { log::warn!("attempted to set zed.dev model on outdated settings");
log::warn!("attempted to set zed.dev model on outdated settings"); }
} "anthropic" => {
"anthropic" => { let api_url = match &settings.provider {
let api_url = match &settings.provider { Some(AgentProviderContentV1::Anthropic { api_url, .. }) => {
Some(AssistantProviderContentV1::Anthropic { api_url, .. }) => { api_url.clone()
api_url.clone() }
} _ => None,
_ => None, };
}; settings.provider = Some(AgentProviderContentV1::Anthropic {
settings.provider = Some(AssistantProviderContentV1::Anthropic { default_model: AnthropicModel::from_id(&model).ok(),
default_model: AnthropicModel::from_id(&model).ok(), api_url,
api_url, });
}); }
} "ollama" => {
"ollama" => { let api_url = match &settings.provider {
let api_url = match &settings.provider { Some(AgentProviderContentV1::Ollama { api_url, .. }) => api_url.clone(),
Some(AssistantProviderContentV1::Ollama { api_url, .. }) => { _ => None,
api_url.clone() };
} settings.provider = Some(AgentProviderContentV1::Ollama {
_ => None, default_model: Some(ollama::Model::new(
}; &model,
settings.provider = Some(AssistantProviderContentV1::Ollama { None,
default_model: Some(ollama::Model::new( None,
&model, Some(language_model.supports_tools()),
None, )),
None, api_url,
Some(language_model.supports_tools()), });
)), }
api_url, "lmstudio" => {
}); let api_url = match &settings.provider {
} Some(AgentProviderContentV1::LmStudio { api_url, .. }) => {
"lmstudio" => { api_url.clone()
let api_url = match &settings.provider { }
Some(AssistantProviderContentV1::LmStudio { api_url, .. }) => { _ => None,
api_url.clone() };
} settings.provider = Some(AgentProviderContentV1::LmStudio {
_ => None, default_model: Some(lmstudio::Model::new(&model, None, None, false)),
}; api_url,
settings.provider = Some(AssistantProviderContentV1::LmStudio { });
default_model: Some(lmstudio::Model::new( }
&model, None, None, false, "openai" => {
)), let (api_url, available_models) = match &settings.provider {
api_url, Some(AgentProviderContentV1::OpenAi {
});
}
"openai" => {
let (api_url, available_models) = match &settings.provider {
Some(AssistantProviderContentV1::OpenAi {
api_url,
available_models,
..
}) => (api_url.clone(), available_models.clone()),
_ => (None, None),
};
settings.provider = Some(AssistantProviderContentV1::OpenAi {
default_model: OpenAiModel::from_id(&model).ok(),
api_url, api_url,
available_models, available_models,
}); ..
} }) => (api_url.clone(), available_models.clone()),
"deepseek" => { _ => (None, None),
let api_url = match &settings.provider { };
Some(AssistantProviderContentV1::DeepSeek { api_url, .. }) => { settings.provider = Some(AgentProviderContentV1::OpenAi {
api_url.clone() default_model: OpenAiModel::from_id(&model).ok(),
} api_url,
_ => None, available_models,
}; });
settings.provider = Some(AssistantProviderContentV1::DeepSeek {
default_model: DeepseekModel::from_id(&model).ok(),
api_url,
});
}
_ => {}
} }
} "deepseek" => {
VersionedAssistantSettingsContent::V2(ref mut settings) => { let api_url = match &settings.provider {
Some(AgentProviderContentV1::DeepSeek { api_url, .. }) => {
api_url.clone()
}
_ => None,
};
settings.provider = Some(AgentProviderContentV1::DeepSeek {
default_model: DeepseekModel::from_id(&model).ok(),
api_url,
});
}
_ => {}
},
VersionedAgentSettingsContent::V2(ref mut settings) => {
settings.default_model = Some(LanguageModelSelection { settings.default_model = Some(LanguageModelSelection {
provider: provider.into(), provider: provider.into(),
model, model,
}); });
} }
}, },
Some(AssistantSettingsContentInner::Legacy(settings)) => { Some(AgentSettingsContentInner::Legacy(settings)) => {
if let Ok(model) = OpenAiModel::from_id(&language_model.id().0) { if let Ok(model) = OpenAiModel::from_id(&language_model.id().0) {
settings.default_open_ai_model = Some(model); settings.default_open_ai_model = Some(model);
} }
} }
None => { None => {
self.inner = Some(AssistantSettingsContentInner::for_v2( self.inner = Some(AgentSettingsContentInner::for_v2(AgentSettingsContentV2 {
AssistantSettingsContentV2 { default_model: Some(LanguageModelSelection {
default_model: Some(LanguageModelSelection { provider: provider.into(),
provider: provider.into(), model,
model, }),
}), ..Default::default()
..Default::default() }));
},
));
} }
} }
} }
@ -483,15 +465,15 @@ impl AssistantSettingsContent {
pub fn v2_setting( pub fn v2_setting(
&mut self, &mut self,
f: impl FnOnce(&mut AssistantSettingsContentV2) -> anyhow::Result<()>, f: impl FnOnce(&mut AgentSettingsContentV2) -> anyhow::Result<()>,
) -> anyhow::Result<()> { ) -> anyhow::Result<()> {
match self.inner.get_or_insert_with(|| { match self.inner.get_or_insert_with(|| {
AssistantSettingsContentInner::for_v2(AssistantSettingsContentV2 { AgentSettingsContentInner::for_v2(AgentSettingsContentV2 {
..Default::default() ..Default::default()
}) })
}) { }) {
AssistantSettingsContentInner::Versioned(boxed) => { AgentSettingsContentInner::Versioned(boxed) => {
if let VersionedAssistantSettingsContent::V2(ref mut settings) = **boxed { if let VersionedAgentSettingsContent::V2(ref mut settings) = **boxed {
f(settings) f(settings)
} else { } else {
Ok(()) Ok(())
@ -584,16 +566,16 @@ impl AssistantSettingsContent {
#[derive(Clone, Serialize, Deserialize, JsonSchema, Debug)] #[derive(Clone, Serialize, Deserialize, JsonSchema, Debug)]
#[serde(tag = "version")] #[serde(tag = "version")]
#[schemars(deny_unknown_fields)] #[schemars(deny_unknown_fields)]
pub enum VersionedAssistantSettingsContent { pub enum VersionedAgentSettingsContent {
#[serde(rename = "1")] #[serde(rename = "1")]
V1(AssistantSettingsContentV1), V1(AgentSettingsContentV1),
#[serde(rename = "2")] #[serde(rename = "2")]
V2(AssistantSettingsContentV2), V2(AgentSettingsContentV2),
} }
impl Default for VersionedAssistantSettingsContent { impl Default for VersionedAgentSettingsContent {
fn default() -> Self { fn default() -> Self {
Self::V2(AssistantSettingsContentV2 { Self::V2(AgentSettingsContentV2 {
enabled: None, enabled: None,
button: None, button: None,
dock: None, dock: None,
@ -621,8 +603,8 @@ impl Default for VersionedAssistantSettingsContent {
#[derive(Clone, Serialize, Deserialize, JsonSchema, Debug, Default)] #[derive(Clone, Serialize, Deserialize, JsonSchema, Debug, Default)]
#[schemars(deny_unknown_fields)] #[schemars(deny_unknown_fields)]
pub struct AssistantSettingsContentV2 { pub struct AgentSettingsContentV2 {
/// Whether the Assistant is enabled. /// Whether the Agent is enabled.
/// ///
/// Default: true /// Default: true
enabled: Option<bool>, enabled: Option<bool>,
@ -633,7 +615,7 @@ pub struct AssistantSettingsContentV2 {
/// Where to dock the agent panel. /// Where to dock the agent panel.
/// ///
/// Default: right /// Default: right
dock: Option<AssistantDockPosition>, dock: Option<AgentDockPosition>,
/// Default width in pixels when the agent panel is docked to the left or right. /// Default width in pixels when the agent panel is docked to the left or right.
/// ///
/// Default: 640 /// Default: 640
@ -792,50 +774,50 @@ pub struct ContextServerPresetContent {
#[derive(Clone, Serialize, Deserialize, JsonSchema, Debug)] #[derive(Clone, Serialize, Deserialize, JsonSchema, Debug)]
#[schemars(deny_unknown_fields)] #[schemars(deny_unknown_fields)]
pub struct AssistantSettingsContentV1 { pub struct AgentSettingsContentV1 {
/// Whether the Assistant is enabled. /// Whether the Agent is enabled.
/// ///
/// Default: true /// Default: true
enabled: Option<bool>, enabled: Option<bool>,
/// Whether to show the assistant panel button in the status bar. /// Whether to show the Agent panel button in the status bar.
/// ///
/// Default: true /// Default: true
button: Option<bool>, button: Option<bool>,
/// Where to dock the assistant. /// Where to dock the Agent.
/// ///
/// Default: right /// Default: right
dock: Option<AssistantDockPosition>, dock: Option<AgentDockPosition>,
/// Default width in pixels when the assistant is docked to the left or right. /// Default width in pixels when the Agent is docked to the left or right.
/// ///
/// Default: 640 /// Default: 640
default_width: Option<f32>, default_width: Option<f32>,
/// Default height in pixels when the assistant is docked to the bottom. /// Default height in pixels when the Agent is docked to the bottom.
/// ///
/// Default: 320 /// Default: 320
default_height: Option<f32>, default_height: Option<f32>,
/// The provider of the assistant service. /// The provider of the Agent service.
/// ///
/// This can be "openai", "anthropic", "ollama", "lmstudio", "deepseek", "zed.dev" /// This can be "openai", "anthropic", "ollama", "lmstudio", "deepseek", "zed.dev"
/// each with their respective default models and configurations. /// each with their respective default models and configurations.
provider: Option<AssistantProviderContentV1>, provider: Option<AgentProviderContentV1>,
} }
#[derive(Clone, Serialize, Deserialize, JsonSchema, Debug)] #[derive(Clone, Serialize, Deserialize, JsonSchema, Debug)]
#[schemars(deny_unknown_fields)] #[schemars(deny_unknown_fields)]
pub struct LegacyAssistantSettingsContent { pub struct LegacyAgentSettingsContent {
/// Whether to show the assistant panel button in the status bar. /// Whether to show the Agent panel button in the status bar.
/// ///
/// Default: true /// Default: true
pub button: Option<bool>, pub button: Option<bool>,
/// Where to dock the assistant. /// Where to dock the Agent.
/// ///
/// Default: right /// Default: right
pub dock: Option<AssistantDockPosition>, pub dock: Option<AgentDockPosition>,
/// Default width in pixels when the assistant is docked to the left or right. /// Default width in pixels when the Agent is docked to the left or right.
/// ///
/// Default: 640 /// Default: 640
pub default_width: Option<f32>, pub default_width: Option<f32>,
/// Default height in pixels when the assistant is docked to the bottom. /// Default height in pixels when the Agent is docked to the bottom.
/// ///
/// Default: 320 /// Default: 320
pub default_height: Option<f32>, pub default_height: Option<f32>,
@ -849,20 +831,20 @@ pub struct LegacyAssistantSettingsContent {
pub openai_api_url: Option<String>, pub openai_api_url: Option<String>,
} }
impl Settings for AssistantSettings { impl Settings for AgentSettings {
const KEY: Option<&'static str> = Some("agent"); const KEY: Option<&'static str> = Some("agent");
const FALLBACK_KEY: Option<&'static str> = Some("assistant"); const FALLBACK_KEY: Option<&'static str> = Some("assistant");
const PRESERVED_KEYS: Option<&'static [&'static str]> = Some(&["version"]); const PRESERVED_KEYS: Option<&'static [&'static str]> = Some(&["version"]);
type FileContent = AssistantSettingsContent; type FileContent = AgentSettingsContent;
fn load( fn load(
sources: SettingsSources<Self::FileContent>, sources: SettingsSources<Self::FileContent>,
_: &mut gpui::App, _: &mut gpui::App,
) -> anyhow::Result<Self> { ) -> anyhow::Result<Self> {
let mut settings = AssistantSettings::default(); let mut settings = AgentSettings::default();
for value in sources.defaults_and_customizations() { for value in sources.defaults_and_customizations() {
if value.is_version_outdated() { if value.is_version_outdated() {
@ -957,28 +939,25 @@ impl Settings for AssistantSettings {
.and_then(|b| b.as_bool()) .and_then(|b| b.as_bool())
{ {
match &mut current.inner { match &mut current.inner {
Some(AssistantSettingsContentInner::Versioned(versioned)) => { Some(AgentSettingsContentInner::Versioned(versioned)) => match versioned.as_mut() {
match versioned.as_mut() { VersionedAgentSettingsContent::V1(setting) => {
VersionedAssistantSettingsContent::V1(setting) => { setting.enabled = Some(b);
setting.enabled = Some(b); setting.button = Some(b);
setting.button = Some(b);
}
VersionedAssistantSettingsContent::V2(setting) => {
setting.enabled = Some(b);
setting.button = Some(b);
}
} }
}
Some(AssistantSettingsContentInner::Legacy(setting)) => setting.button = Some(b), VersionedAgentSettingsContent::V2(setting) => {
setting.enabled = Some(b);
setting.button = Some(b);
}
},
Some(AgentSettingsContentInner::Legacy(setting)) => setting.button = Some(b),
None => { None => {
current.inner = Some(AssistantSettingsContentInner::for_v2( current.inner =
AssistantSettingsContentV2 { Some(AgentSettingsContentInner::for_v2(AgentSettingsContentV2 {
enabled: Some(b), enabled: Some(b),
button: Some(b), button: Some(b),
..Default::default() ..Default::default()
}, }));
));
} }
} }
} }
@ -1000,7 +979,7 @@ mod tests {
use super::*; use super::*;
#[gpui::test] #[gpui::test]
async fn test_deserialize_assistant_settings_with_version(cx: &mut TestAppContext) { async fn test_deserialize_agent_settings_with_version(cx: &mut TestAppContext) {
let fs = fs::FakeFs::new(cx.executor().clone()); let fs = fs::FakeFs::new(cx.executor().clone());
fs.create_dir(paths::settings_file().parent().unwrap()) fs.create_dir(paths::settings_file().parent().unwrap())
.await .await
@ -1009,13 +988,13 @@ mod tests {
cx.update(|cx| { cx.update(|cx| {
let test_settings = settings::SettingsStore::test(cx); let test_settings = settings::SettingsStore::test(cx);
cx.set_global(test_settings); cx.set_global(test_settings);
AssistantSettings::register(cx); AgentSettings::register(cx);
}); });
cx.update(|cx| { cx.update(|cx| {
assert!(!AssistantSettings::get_global(cx).using_outdated_settings_version); assert!(!AgentSettings::get_global(cx).using_outdated_settings_version);
assert_eq!( assert_eq!(
AssistantSettings::get_global(cx).default_model, AgentSettings::get_global(cx).default_model,
LanguageModelSelection { LanguageModelSelection {
provider: "zed.dev".into(), provider: "zed.dev".into(),
model: "claude-sonnet-4".into(), model: "claude-sonnet-4".into(),
@ -1024,38 +1003,36 @@ mod tests {
}); });
cx.update(|cx| { cx.update(|cx| {
settings::SettingsStore::global(cx).update_settings_file::<AssistantSettings>( settings::SettingsStore::global(cx).update_settings_file::<AgentSettings>(
fs.clone(), fs.clone(),
|settings, _| { |settings, _| {
*settings = AssistantSettingsContent { *settings = AgentSettingsContent {
inner: Some(AssistantSettingsContentInner::for_v2( inner: Some(AgentSettingsContentInner::for_v2(AgentSettingsContentV2 {
AssistantSettingsContentV2 { default_model: Some(LanguageModelSelection {
default_model: Some(LanguageModelSelection { provider: "test-provider".into(),
provider: "test-provider".into(), model: "gpt-99".into(),
model: "gpt-99".into(), }),
}), inline_assistant_model: None,
inline_assistant_model: None, commit_message_model: None,
commit_message_model: None, thread_summary_model: None,
thread_summary_model: None, inline_alternatives: None,
inline_alternatives: None, enabled: None,
enabled: None, button: None,
button: None, dock: None,
dock: None, default_width: None,
default_width: None, default_height: None,
default_height: None, default_profile: None,
default_profile: None, default_view: None,
default_view: None, profiles: None,
profiles: None, always_allow_tool_actions: None,
always_allow_tool_actions: None, play_sound_when_agent_done: None,
play_sound_when_agent_done: None, notify_when_agent_waiting: None,
notify_when_agent_waiting: None, stream_edits: None,
stream_edits: None, single_file_review: None,
single_file_review: None, enable_feedback: None,
enable_feedback: None, model_parameters: Vec::new(),
model_parameters: Vec::new(), preferred_completion_mode: None,
preferred_completion_mode: None, })),
},
)),
} }
}, },
); );
@ -1067,14 +1044,14 @@ mod tests {
assert!(raw_settings_value.contains(r#""version": "2""#)); assert!(raw_settings_value.contains(r#""version": "2""#));
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
struct AssistantSettingsTest { struct AgentSettingsTest {
agent: AssistantSettingsContent, agent: AgentSettingsContent,
} }
let assistant_settings: AssistantSettingsTest = let agent_settings: AgentSettingsTest =
serde_json_lenient::from_str(&raw_settings_value).unwrap(); serde_json_lenient::from_str(&raw_settings_value).unwrap();
assert!(!assistant_settings.agent.is_version_outdated()); assert!(!agent_settings.agent.is_version_outdated());
} }
#[gpui::test] #[gpui::test]
@ -1099,29 +1076,27 @@ mod tests {
.set_user_settings(user_settings_content, cx) .set_user_settings(user_settings_content, cx)
.unwrap(); .unwrap();
cx.set_global(test_settings); cx.set_global(test_settings);
AssistantSettings::register(cx); AgentSettings::register(cx);
}); });
cx.run_until_parked(); cx.run_until_parked();
let assistant_settings = cx.update(|cx| AssistantSettings::get_global(cx).clone()); let agent_settings = cx.update(|cx| AgentSettings::get_global(cx).clone());
assert!(assistant_settings.enabled); assert!(agent_settings.enabled);
assert!(!assistant_settings.using_outdated_settings_version); assert!(!agent_settings.using_outdated_settings_version);
assert_eq!(assistant_settings.default_model.model, "gpt-99"); assert_eq!(agent_settings.default_model.model, "gpt-99");
cx.update_global::<SettingsStore, _>(|settings_store, cx| { cx.update_global::<SettingsStore, _>(|settings_store, cx| {
settings_store.update_user_settings::<AssistantSettings>(cx, |settings| { settings_store.update_user_settings::<AgentSettings>(cx, |settings| {
*settings = AssistantSettingsContent { *settings = AgentSettingsContent {
inner: Some(AssistantSettingsContentInner::for_v2( inner: Some(AgentSettingsContentInner::for_v2(AgentSettingsContentV2 {
AssistantSettingsContentV2 { enabled: Some(false),
enabled: Some(false), default_model: Some(LanguageModelSelection {
default_model: Some(LanguageModelSelection { provider: "xai".to_owned().into(),
provider: "xai".to_owned().into(), model: "grok".to_owned(),
model: "grok".to_owned(), }),
}), ..Default::default()
..Default::default() })),
},
)),
}; };
}); });
}); });
@ -1131,12 +1106,12 @@ mod tests {
let settings = cx.update(|cx| SettingsStore::global(cx).raw_user_settings().clone()); let settings = cx.update(|cx| SettingsStore::global(cx).raw_user_settings().clone());
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
struct AssistantSettingsTest { struct AgentSettingsTest {
assistant: AssistantSettingsContent, assistant: AgentSettingsContent,
agent: Option<serde_json_lenient::Value>, agent: Option<serde_json_lenient::Value>,
} }
let assistant_settings: AssistantSettingsTest = serde_json::from_value(settings).unwrap(); let agent_settings: AgentSettingsTest = serde_json::from_value(settings).unwrap();
assert!(assistant_settings.agent.is_none()); assert!(agent_settings.agent.is_none());
} }
} }

View file

@ -12,8 +12,8 @@ workspace = true
path = "src/assistant_context_editor.rs" path = "src/assistant_context_editor.rs"
[dependencies] [dependencies]
agent_settings.workspace = true
anyhow.workspace = true anyhow.workspace = true
assistant_settings.workspace = true
assistant_slash_command.workspace = true assistant_slash_command.workspace = true
assistant_slash_commands.workspace = true assistant_slash_commands.workspace = true
chrono.workspace = true chrono.workspace = true

View file

@ -1,8 +1,8 @@
#[cfg(test)] #[cfg(test)]
mod context_tests; mod context_tests;
use agent_settings::AgentSettings;
use anyhow::{Context as _, Result, bail}; use anyhow::{Context as _, Result, bail};
use assistant_settings::AssistantSettings;
use assistant_slash_command::{ use assistant_slash_command::{
SlashCommandContent, SlashCommandEvent, SlashCommandLine, SlashCommandOutputSection, SlashCommandContent, SlashCommandEvent, SlashCommandLine, SlashCommandOutputSection,
SlashCommandResult, SlashCommandWorkingSet, SlashCommandResult, SlashCommandWorkingSet,
@ -2266,8 +2266,7 @@ impl AssistantContext {
tools: Vec::new(), tools: Vec::new(),
tool_choice: None, tool_choice: None,
stop: Vec::new(), stop: Vec::new(),
temperature: model temperature: model.and_then(|model| AgentSettings::temperature_for_model(model, cx)),
.and_then(|model| AssistantSettings::temperature_for_model(model, cx)),
}; };
for message in self.messages(cx) { for message in self.messages(cx) {
if message.status != MessageStatus::Done { if message.status != MessageStatus::Done {

View file

@ -1386,7 +1386,7 @@ fn init_test(cx: &mut App) {
LanguageModelRegistry::test(cx); LanguageModelRegistry::test(cx);
cx.set_global(settings_store); cx.set_global(settings_store);
language::init(cx); language::init(cx);
assistant_settings::init(cx); agent_settings::init(cx);
Project::init_settings(cx); Project::init_settings(cx);
} }

View file

@ -1,8 +1,8 @@
use crate::language_model_selector::{ use crate::language_model_selector::{
LanguageModelSelector, LanguageModelSelectorPopoverMenu, ToggleModelSelector, LanguageModelSelector, LanguageModelSelectorPopoverMenu, ToggleModelSelector,
}; };
use agent_settings::AgentSettings;
use anyhow::Result; use anyhow::Result;
use assistant_settings::AssistantSettings;
use assistant_slash_command::{SlashCommand, SlashCommandOutputSection, SlashCommandWorkingSet}; use assistant_slash_command::{SlashCommand, SlashCommandOutputSection, SlashCommandWorkingSet};
use assistant_slash_commands::{ use assistant_slash_commands::{
DefaultSlashCommand, DocsSlashCommand, DocsSlashCommandArgs, FileSlashCommand, DefaultSlashCommand, DocsSlashCommand, DocsSlashCommandArgs, FileSlashCommand,
@ -283,7 +283,7 @@ impl ContextEditor {
LanguageModelSelector::new( LanguageModelSelector::new(
|cx| LanguageModelRegistry::read_global(cx).default_model(), |cx| LanguageModelRegistry::read_global(cx).default_model(),
move |model, cx| { move |model, cx| {
update_settings_file::<AssistantSettings>( update_settings_file::<AgentSettings>(
fs.clone(), fs.clone(),
cx, cx,
move |settings, _| settings.set_model(model.clone()), move |settings, _| settings.set_model(model.clone()),
@ -3366,7 +3366,7 @@ mod tests {
LanguageModelRegistry::test(cx); LanguageModelRegistry::test(cx);
cx.set_global(settings_store); cx.set_global(settings_store);
language::init(cx); language::init(cx);
assistant_settings::init(cx); agent_settings::init(cx);
Project::init_settings(cx); Project::init_settings(cx);
theme::init(theme::LoadThemes::JustBase, cx); theme::init(theme::LoadThemes::JustBase, cx);
workspace::init_settings(cx); workspace::init_settings(cx);

View file

@ -15,9 +15,9 @@ path = "src/assistant_tools.rs"
eval = [] eval = []
[dependencies] [dependencies]
agent_settings.workspace = true
aho-corasick.workspace = true aho-corasick.workspace = true
anyhow.workspace = true anyhow.workspace = true
assistant_settings.workspace = true
assistant_tool.workspace = true assistant_tool.workspace = true
buffer_diff.workspace = true buffer_diff.workspace = true
chrono.workspace = true chrono.workspace = true

View file

@ -96,7 +96,7 @@ fn register_web_search_tool(registry: &Entity<LanguageModelRegistry>, cx: &mut A
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use assistant_settings::AssistantSettings; use agent_settings::AgentSettings;
use client::Client; use client::Client;
use clock::FakeSystemClock; use clock::FakeSystemClock;
use http_client::FakeHttpClient; use http_client::FakeHttpClient;
@ -133,7 +133,7 @@ mod tests {
#[gpui::test] #[gpui::test]
fn test_builtin_tool_schema_compatibility(cx: &mut App) { fn test_builtin_tool_schema_compatibility(cx: &mut App) {
settings::init(cx); settings::init(cx);
AssistantSettings::register(cx); AgentSettings::register(cx);
let client = Client::new( let client = Client::new(
Arc::new(FakeSystemClock::new()), Arc::new(FakeSystemClock::new()),

View file

@ -76,8 +76,8 @@ workspace-hack.workspace = true
zed_llm_client.workspace = true zed_llm_client.workspace = true
[dev-dependencies] [dev-dependencies]
agent_settings.workspace = true
assistant_context_editor.workspace = true assistant_context_editor.workspace = true
assistant_settings.workspace = true
assistant_slash_command.workspace = true assistant_slash_command.workspace = true
assistant_tool.workspace = true assistant_tool.workspace = true
async-trait.workspace = true async-trait.workspace = true

View file

@ -312,7 +312,7 @@ impl TestServer {
); );
language_model::LanguageModelRegistry::test(cx); language_model::LanguageModelRegistry::test(cx);
assistant_context_editor::init(client.clone(), cx); assistant_context_editor::init(client.clone(), cx);
assistant_settings::init(cx); agent_settings::init(cx);
}); });
client client

View file

@ -19,8 +19,8 @@ path = "src/explorer.rs"
[dependencies] [dependencies]
agent.workspace = true agent.workspace = true
agent_settings.workspace = true
anyhow.workspace = true anyhow.workspace = true
assistant_settings.workspace = true
assistant_tool.workspace = true assistant_tool.workspace = true
assistant_tools.workspace = true assistant_tools.workspace = true
async-trait.workspace = true async-trait.workspace = true

View file

@ -11,8 +11,8 @@ use crate::{
assertions::{AssertionsReport, RanAssertion, RanAssertionResult}, assertions::{AssertionsReport, RanAssertion, RanAssertionResult},
}; };
use agent::{ContextLoadResult, Thread, ThreadEvent}; use agent::{ContextLoadResult, Thread, ThreadEvent};
use agent_settings::AgentProfileId;
use anyhow::{Result, anyhow}; use anyhow::{Result, anyhow};
use assistant_settings::AgentProfileId;
use async_trait::async_trait; use async_trait::async_trait;
use buffer_diff::DiffHunkStatus; use buffer_diff::DiffHunkStatus;
use collections::HashMap; use collections::HashMap;

View file

@ -1,7 +1,7 @@
use std::path::Path; use std::path::Path;
use agent_settings::AgentProfileId;
use anyhow::Result; use anyhow::Result;
use assistant_settings::AgentProfileId;
use async_trait::async_trait; use async_trait::async_trait;
use crate::example::{Example, ExampleContext, ExampleMetadata, JudgeAssertion, LanguageServer}; use crate::example::{Example, ExampleContext, ExampleMetadata, JudgeAssertion, LanguageServer};

View file

@ -1,5 +1,5 @@
use agent_settings::AgentProfileId;
use anyhow::Result; use anyhow::Result;
use assistant_settings::AgentProfileId;
use async_trait::async_trait; use async_trait::async_trait;
use markdown::PathWithRange; use markdown::PathWithRange;

View file

@ -1,6 +1,6 @@
use crate::example::{Example, ExampleContext, ExampleMetadata, JudgeAssertion}; use crate::example::{Example, ExampleContext, ExampleMetadata, JudgeAssertion};
use agent_settings::AgentProfileId;
use anyhow::Result; use anyhow::Result;
use assistant_settings::AgentProfileId;
use assistant_tools::{EditFileMode, EditFileToolInput}; use assistant_tools::{EditFileMode, EditFileToolInput};
use async_trait::async_trait; use async_trait::async_trait;

View file

@ -1,5 +1,5 @@
use agent_settings::AgentProfileId;
use anyhow::Result; use anyhow::Result;
use assistant_settings::AgentProfileId;
use assistant_tools::FindPathToolInput; use assistant_tools::FindPathToolInput;
use async_trait::async_trait; use async_trait::async_trait;
use regex::Regex; use regex::Regex;

View file

@ -1,5 +1,5 @@
use agent_settings::AgentProfileId;
use anyhow::Result; use anyhow::Result;
use assistant_settings::AgentProfileId;
use async_trait::async_trait; use async_trait::async_trait;
use serde::Deserialize; use serde::Deserialize;
use std::collections::BTreeMap; use std::collections::BTreeMap;

View file

@ -1,5 +1,5 @@
use agent_settings::AgentProfileId;
use anyhow::Result; use anyhow::Result;
use assistant_settings::AgentProfileId;
use assistant_tools::{EditFileMode, EditFileToolInput}; use assistant_tools::{EditFileMode, EditFileToolInput};
use async_trait::async_trait; use async_trait::async_trait;

View file

@ -1,5 +1,5 @@
use agent_settings::AgentProfileId;
use anyhow::Result; use anyhow::Result;
use assistant_settings::AgentProfileId;
use assistant_tool::Tool; use assistant_tool::Tool;
use assistant_tools::{OpenTool, TerminalTool}; use assistant_tools::{OpenTool, TerminalTool};
use async_trait::async_trait; use async_trait::async_trait;

View file

@ -17,9 +17,9 @@ default = []
test-support = ["multi_buffer/test-support"] test-support = ["multi_buffer/test-support"]
[dependencies] [dependencies]
agent_settings.workspace = true
anyhow.workspace = true anyhow.workspace = true
askpass.workspace = true askpass.workspace = true
assistant_settings.workspace = true
buffer_diff.workspace = true buffer_diff.workspace = true
chrono.workspace = true chrono.workspace = true
collections.workspace = true collections.workspace = true
@ -56,9 +56,9 @@ time.workspace = true
time_format.workspace = true time_format.workspace = true
ui.workspace = true ui.workspace = true
util.workspace = true util.workspace = true
workspace-hack.workspace = true
workspace.workspace = true workspace.workspace = true
zed_actions.workspace = true zed_actions.workspace = true
workspace-hack.workspace = true
[target.'cfg(windows)'.dependencies] [target.'cfg(windows)'.dependencies]
windows.workspace = true windows.workspace = true

View file

@ -9,9 +9,9 @@ use crate::{branch_picker, picker_prompt, render_remote_button};
use crate::{ use crate::{
git_panel_settings::GitPanelSettings, git_status_icon, repository_selector::RepositorySelector, git_panel_settings::GitPanelSettings, git_status_icon, repository_selector::RepositorySelector,
}; };
use agent_settings::AgentSettings;
use anyhow::Context as _; use anyhow::Context as _;
use askpass::AskPassDelegate; use askpass::AskPassDelegate;
use assistant_settings::AssistantSettings;
use db::kvp::KEY_VALUE_STORE; use db::kvp::KEY_VALUE_STORE;
use editor::{ use editor::{
@ -481,10 +481,10 @@ impl GitPanel {
hide_task: None, hide_task: None,
}; };
let mut assistant_enabled = AssistantSettings::get_global(cx).enabled; let mut assistant_enabled = AgentSettings::get_global(cx).enabled;
let _settings_subscription = cx.observe_global::<SettingsStore>(move |_, cx| { let _settings_subscription = cx.observe_global::<SettingsStore>(move |_, cx| {
if assistant_enabled != AssistantSettings::get_global(cx).enabled { if assistant_enabled != AgentSettings::get_global(cx).enabled {
assistant_enabled = AssistantSettings::get_global(cx).enabled; assistant_enabled = AgentSettings::get_global(cx).enabled;
cx.notify(); cx.notify();
} }
}); });
@ -1747,7 +1747,7 @@ impl GitPanel {
} }
}); });
let temperature = AssistantSettings::temperature_for_model(&model, cx); let temperature = AgentSettings::temperature_for_model(&model, cx);
self.generate_commit_message_task = Some(cx.spawn(async move |this, cx| { self.generate_commit_message_task = Some(cx.spawn(async move |this, cx| {
async move { async move {
@ -4061,7 +4061,7 @@ impl GitPanel {
} }
fn current_language_model(cx: &Context<'_, GitPanel>) -> Option<Arc<dyn LanguageModel>> { fn current_language_model(cx: &Context<'_, GitPanel>) -> Option<Arc<dyn LanguageModel>> {
assistant_settings::AssistantSettings::get_global(cx) agent_settings::AgentSettings::get_global(cx)
.enabled .enabled
.then(|| { .then(|| {
let ConfiguredModel { provider, model } = let ConfiguredModel { provider, model } =
@ -4784,7 +4784,7 @@ mod tests {
cx.update(|cx| { cx.update(|cx| {
let settings_store = SettingsStore::test(cx); let settings_store = SettingsStore::test(cx);
cx.set_global(settings_store); cx.set_global(settings_store);
AssistantSettings::register(cx); AgentSettings::register(cx);
WorktreeSettings::register(cx); WorktreeSettings::register(cx);
workspace::init_settings(cx); workspace::init_settings(cx);
theme::init(LoadThemes::JustBase, cx); theme::init(LoadThemes::JustBase, cx);

View file

@ -17,11 +17,11 @@ path = "src/main.rs"
[dependencies] [dependencies]
activity_indicator.workspace = true activity_indicator.workspace = true
agent.workspace = true agent.workspace = true
agent_settings.workspace = true
anyhow.workspace = true anyhow.workspace = true
askpass.workspace = true askpass.workspace = true
assets.workspace = true assets.workspace = true
assistant_context_editor.workspace = true assistant_context_editor.workspace = true
assistant_settings.workspace = true
assistant_tool.workspace = true assistant_tool.workspace = true
assistant_tools.workspace = true assistant_tools.workspace = true
async-watch.workspace = true async-watch.workspace = true
@ -42,10 +42,10 @@ command_palette.workspace = true
component.workspace = true component.workspace = true
copilot.workspace = true copilot.workspace = true
dap_adapters.workspace = true dap_adapters.workspace = true
debugger_ui.workspace = true
debugger_tools.workspace = true
db.workspace = true db.workspace = true
debug_adapter_extension.workspace = true debug_adapter_extension.workspace = true
debugger_tools.workspace = true
debugger_ui.workspace = true
diagnostics.workspace = true diagnostics.workspace = true
editor.workspace = true editor.workspace = true
env_logger.workspace = true env_logger.workspace = true
@ -80,8 +80,8 @@ language_tools.workspace = true
languages = { workspace = true, features = ["load-grammars"] } languages = { workspace = true, features = ["load-grammars"] }
libc.workspace = true libc.workspace = true
log.workspace = true log.workspace = true
markdown_preview.workspace = true
markdown.workspace = true markdown.workspace = true
markdown_preview.workspace = true
menu.workspace = true menu.workspace = true
migrator.workspace = true migrator.workspace = true
mimalloc = { version = "0.1", optional = true } mimalloc = { version = "0.1", optional = true }
@ -141,12 +141,12 @@ vim_mode_setting.workspace = true
web_search.workspace = true web_search.workspace = true
web_search_providers.workspace = true web_search_providers.workspace = true
welcome.workspace = true welcome.workspace = true
workspace-hack.workspace = true
workspace.workspace = true workspace.workspace = true
zed_actions.workspace = true zed_actions.workspace = true
zeta.workspace = true zeta.workspace = true
zlog.workspace = true zlog.workspace = true
zlog_settings.workspace = true zlog_settings.workspace = true
workspace-hack.workspace = true
[target.'cfg(target_os = "windows")'.dependencies] [target.'cfg(target_os = "windows")'.dependencies]
windows.workspace = true windows.workspace = true

View file

@ -1,6 +1,6 @@
mod markdown_preview; mod markdown_preview;
mod repl_menu; mod repl_menu;
use assistant_settings::AssistantSettings; use agent_settings::AgentSettings;
use editor::actions::{ use editor::actions::{
AddSelectionAbove, AddSelectionBelow, CodeActionSource, DuplicateLineDown, GoToDiagnostic, AddSelectionAbove, AddSelectionBelow, CodeActionSource, DuplicateLineDown, GoToDiagnostic,
GoToHunk, GoToPreviousDiagnostic, GoToPreviousHunk, MoveLineDown, MoveLineUp, SelectAll, GoToHunk, GoToPreviousDiagnostic, GoToPreviousHunk, MoveLineDown, MoveLineUp, SelectAll,
@ -558,8 +558,7 @@ impl Render for QuickActionBar {
.children(self.render_toggle_markdown_preview(self.workspace.clone(), cx)) .children(self.render_toggle_markdown_preview(self.workspace.clone(), cx))
.children(search_button) .children(search_button)
.when( .when(
AssistantSettings::get_global(cx).enabled AgentSettings::get_global(cx).enabled && AgentSettings::get_global(cx).button,
&& AssistantSettings::get_global(cx).button,
|bar| bar.child(assistant_button), |bar| bar.child(assistant_button),
) )
.children(code_actions_dropdown) .children(code_actions_dropdown)