diff --git a/Cargo.lock b/Cargo.lock index c1ad88e6d023d59990da210ab5d80121723c2d9d..10223e5bef39c95f79f1509a676372e99afe7ed6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -472,6 +472,7 @@ dependencies = [ "heed", "html_to_markdown", "http_client", + "indexmap", "indoc", "itertools 0.14.0", "language", @@ -608,11 +609,11 @@ version = "0.1.0" dependencies = [ "anthropic", "anyhow", - "collections", "deepseek", "feature_flags", "fs", "gpui", + "indexmap", "language_model", "lmstudio", "log", diff --git a/crates/assistant2/Cargo.toml b/crates/assistant2/Cargo.toml index 66663c7a2316f44daadba776e5b9733148b77887..07b214bed0b1be847370c1d0c6be51df066c7bad 100644 --- a/crates/assistant2/Cargo.toml +++ b/crates/assistant2/Cargo.toml @@ -44,6 +44,7 @@ gpui.workspace = true heed.workspace = true html_to_markdown.workspace = true http_client.workspace = true +indexmap.workspace = true itertools.workspace = true language.workspace = true language_model.workspace = true diff --git a/crates/assistant2/src/tool_selector.rs b/crates/assistant2/src/tool_selector.rs index efb141b9336b7a7d14a93b00675726276a942f0e..1c0aae33fa32f0400aa2edd10beba0c669464b13 100644 --- a/crates/assistant2/src/tool_selector.rs +++ b/crates/assistant2/src/tool_selector.rs @@ -2,14 +2,14 @@ use std::sync::Arc; use assistant_settings::{AgentProfile, AssistantSettings}; use assistant_tool::{ToolSource, ToolWorkingSet}; -use collections::BTreeMap; use gpui::{Entity, Subscription}; +use indexmap::IndexMap; use scripting_tool::ScriptingTool; use settings::{Settings as _, SettingsStore}; use ui::{prelude::*, ContextMenu, PopoverMenu, Tooltip}; pub struct ToolSelector { - profiles: BTreeMap, AgentProfile>, + profiles: IndexMap, AgentProfile>, tools: Arc, _subscriptions: Vec, } @@ -21,7 +21,7 @@ impl ToolSelector { }); let mut this = Self { - profiles: BTreeMap::default(), + profiles: IndexMap::default(), tools, _subscriptions: vec![settings_subscription], }; @@ -33,7 +33,7 @@ impl ToolSelector { fn refresh_profiles(&mut self, cx: &mut Context) { let settings = AssistantSettings::get_global(cx); - self.profiles = BTreeMap::from_iter(settings.profiles.clone()); + self.profiles = settings.profiles.clone(); } fn build_context_menu( diff --git a/crates/assistant_settings/Cargo.toml b/crates/assistant_settings/Cargo.toml index 96e3f606c0815361b6dde4bbf90d1f1e333f8a2e..8886f394dd7a30b17de251753eb40c9635081c6a 100644 --- a/crates/assistant_settings/Cargo.toml +++ b/crates/assistant_settings/Cargo.toml @@ -14,9 +14,9 @@ path = "src/assistant_settings.rs" [dependencies] anthropic = { workspace = true, features = ["schemars"] } anyhow.workspace = true -collections.workspace = true feature_flags.workspace = true gpui.workspace = true +indexmap.workspace = true language_model.workspace = true lmstudio = { workspace = true, features = ["schemars"] } log.workspace = true diff --git a/crates/assistant_settings/src/agent_profile.rs b/crates/assistant_settings/src/agent_profile.rs index a6887498e14442a336321311610205cabbc1551e..f2085689163a764ec8730d39cd08b7745516800e 100644 --- a/crates/assistant_settings/src/agent_profile.rs +++ b/crates/assistant_settings/src/agent_profile.rs @@ -1,20 +1,20 @@ use std::sync::Arc; -use collections::HashMap; use gpui::SharedString; +use indexmap::IndexMap; /// A profile for the Zed Agent that controls its behavior. #[derive(Debug, Clone)] pub struct AgentProfile { /// The name of the profile. pub name: SharedString, - pub tools: HashMap, bool>, + pub tools: IndexMap, bool>, #[allow(dead_code)] - pub context_servers: HashMap, ContextServerPreset>, + pub context_servers: IndexMap, ContextServerPreset>, } #[derive(Debug, Clone)] pub struct ContextServerPreset { #[allow(dead_code)] - pub tools: HashMap, bool>, + pub tools: IndexMap, bool>, } diff --git a/crates/assistant_settings/src/assistant_settings.rs b/crates/assistant_settings/src/assistant_settings.rs index 30972e32ea80687c44457d77f6f351f001669109..48607f888c310823f5311b946a45efdec61c174d 100644 --- a/crates/assistant_settings/src/assistant_settings.rs +++ b/crates/assistant_settings/src/assistant_settings.rs @@ -4,10 +4,10 @@ use std::sync::Arc; use ::open_ai::Model as OpenAiModel; use anthropic::Model as AnthropicModel; -use collections::HashMap; use deepseek::Model as DeepseekModel; use feature_flags::FeatureFlagAppExt; use gpui::{App, Pixels}; +use indexmap::IndexMap; use language_model::{CloudModel, LanguageModel}; use lmstudio::Model as LmStudioModel; use ollama::Model as OllamaModel; @@ -71,7 +71,7 @@ pub struct AssistantSettings { pub inline_alternatives: Vec, pub using_outdated_settings_version: bool, pub enable_experimental_live_diffs: bool, - pub profiles: HashMap, AgentProfile>, + pub profiles: IndexMap, AgentProfile>, } impl AssistantSettings { @@ -362,7 +362,7 @@ pub struct AssistantSettingsContentV2 { /// Default: false enable_experimental_live_diffs: Option, #[schemars(skip)] - profiles: Option, AgentProfileContent>>, + profiles: Option, AgentProfileContent>>, } #[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq)] @@ -402,7 +402,7 @@ impl Default for LanguageModelSelection { #[derive(Debug, PartialEq, Clone, Serialize, Deserialize, JsonSchema)] pub struct AgentProfileContent { pub name: Arc, - pub tools: HashMap, bool>, + pub tools: IndexMap, bool>, } #[derive(Clone, Serialize, Deserialize, JsonSchema, Debug)] @@ -509,7 +509,7 @@ impl Settings for AssistantSettings { AgentProfile { name: profile.name.into(), tools: profile.tools, - context_servers: HashMap::default(), + context_servers: IndexMap::default(), }, ) }));