Remove assistant
crate (#30168)
This PR removes the `assistant` crate, as it is no longer used. Release Notes: - N/A
This commit is contained in:
parent
ee9040ad6e
commit
7bffd47e99
66
Cargo.lock
generated
66
Cargo.lock
generated
@ -56,6 +56,7 @@ dependencies = [
|
|||||||
"assistant_context_editor",
|
"assistant_context_editor",
|
||||||
"assistant_settings",
|
"assistant_settings",
|
||||||
"assistant_slash_command",
|
"assistant_slash_command",
|
||||||
|
"assistant_slash_commands",
|
||||||
"assistant_tool",
|
"assistant_tool",
|
||||||
"async-watch",
|
"async-watch",
|
||||||
"buffer_diff",
|
"buffer_diff",
|
||||||
@ -78,6 +79,7 @@ dependencies = [
|
|||||||
"heed",
|
"heed",
|
||||||
"html_to_markdown",
|
"html_to_markdown",
|
||||||
"http_client",
|
"http_client",
|
||||||
|
"indexed_docs",
|
||||||
"indoc",
|
"indoc",
|
||||||
"itertools 0.14.0",
|
"itertools 0.14.0",
|
||||||
"jsonschema",
|
"jsonschema",
|
||||||
@ -470,68 +472,6 @@ dependencies = [
|
|||||||
"workspace-hack",
|
"workspace-hack",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "assistant"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"anyhow",
|
|
||||||
"assistant_context_editor",
|
|
||||||
"assistant_settings",
|
|
||||||
"assistant_slash_command",
|
|
||||||
"assistant_slash_commands",
|
|
||||||
"assistant_tool",
|
|
||||||
"async-watch",
|
|
||||||
"client",
|
|
||||||
"collections",
|
|
||||||
"command_palette_hooks",
|
|
||||||
"ctor",
|
|
||||||
"db",
|
|
||||||
"editor",
|
|
||||||
"env_logger 0.11.8",
|
|
||||||
"feature_flags",
|
|
||||||
"fs",
|
|
||||||
"futures 0.3.31",
|
|
||||||
"gpui",
|
|
||||||
"indexed_docs",
|
|
||||||
"indoc",
|
|
||||||
"language",
|
|
||||||
"language_model",
|
|
||||||
"language_model_selector",
|
|
||||||
"languages",
|
|
||||||
"log",
|
|
||||||
"lsp",
|
|
||||||
"menu",
|
|
||||||
"multi_buffer",
|
|
||||||
"parking_lot",
|
|
||||||
"pretty_assertions",
|
|
||||||
"project",
|
|
||||||
"prompt_store",
|
|
||||||
"proto",
|
|
||||||
"rand 0.8.5",
|
|
||||||
"rope",
|
|
||||||
"rules_library",
|
|
||||||
"schemars",
|
|
||||||
"search",
|
|
||||||
"serde",
|
|
||||||
"serde_json_lenient",
|
|
||||||
"settings",
|
|
||||||
"smol",
|
|
||||||
"streaming_diff",
|
|
||||||
"telemetry",
|
|
||||||
"telemetry_events",
|
|
||||||
"terminal",
|
|
||||||
"terminal_view",
|
|
||||||
"text",
|
|
||||||
"theme",
|
|
||||||
"tree-sitter-md",
|
|
||||||
"ui",
|
|
||||||
"unindent",
|
|
||||||
"util",
|
|
||||||
"workspace",
|
|
||||||
"workspace-hack",
|
|
||||||
"zed_actions",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "assistant_context_editor"
|
name = "assistant_context_editor"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
@ -3002,7 +2942,6 @@ name = "collab"
|
|||||||
version = "0.44.0"
|
version = "0.44.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"assistant",
|
|
||||||
"assistant_context_editor",
|
"assistant_context_editor",
|
||||||
"assistant_settings",
|
"assistant_settings",
|
||||||
"assistant_slash_command",
|
"assistant_slash_command",
|
||||||
@ -18692,7 +18631,6 @@ dependencies = [
|
|||||||
"ashpd",
|
"ashpd",
|
||||||
"askpass",
|
"askpass",
|
||||||
"assets",
|
"assets",
|
||||||
"assistant",
|
|
||||||
"assistant_context_editor",
|
"assistant_context_editor",
|
||||||
"assistant_settings",
|
"assistant_settings",
|
||||||
"assistant_tools",
|
"assistant_tools",
|
||||||
|
@ -6,7 +6,6 @@ members = [
|
|||||||
"crates/anthropic",
|
"crates/anthropic",
|
||||||
"crates/askpass",
|
"crates/askpass",
|
||||||
"crates/assets",
|
"crates/assets",
|
||||||
"crates/assistant",
|
|
||||||
"crates/assistant_context_editor",
|
"crates/assistant_context_editor",
|
||||||
"crates/assistant_settings",
|
"crates/assistant_settings",
|
||||||
"crates/assistant_slash_command",
|
"crates/assistant_slash_command",
|
||||||
@ -214,7 +213,6 @@ 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 = { path = "crates/assistant" }
|
|
||||||
assistant_context_editor = { path = "crates/assistant_context_editor" }
|
assistant_context_editor = { path = "crates/assistant_context_editor" }
|
||||||
assistant_settings = { path = "crates/assistant_settings" }
|
assistant_settings = { path = "crates/assistant_settings" }
|
||||||
assistant_slash_command = { path = "crates/assistant_slash_command" }
|
assistant_slash_command = { path = "crates/assistant_slash_command" }
|
||||||
|
@ -213,21 +213,6 @@
|
|||||||
"ctrl-shift-n": "agent::RejectAll"
|
"ctrl-shift-n": "agent::RejectAll"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"context": "AssistantPanel",
|
|
||||||
"bindings": {
|
|
||||||
"ctrl-k c": "assistant::CopyCode",
|
|
||||||
"ctrl-shift-e": "project_panel::ToggleFocus",
|
|
||||||
"ctrl-g": "search::SelectNextMatch",
|
|
||||||
"ctrl-shift-g": "search::SelectPreviousMatch",
|
|
||||||
"ctrl-alt-/": "agent::ToggleModelSelector",
|
|
||||||
"ctrl-k h": "assistant::DeployHistory",
|
|
||||||
"ctrl-k l": "agent::OpenRulesLibrary",
|
|
||||||
"new": "assistant::NewChat",
|
|
||||||
"ctrl-t": "assistant::NewChat",
|
|
||||||
"ctrl-n": "assistant::NewChat"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"context": "ContextEditor > Editor",
|
"context": "ContextEditor > Editor",
|
||||||
"bindings": {
|
"bindings": {
|
||||||
@ -713,8 +698,8 @@
|
|||||||
{
|
{
|
||||||
"context": "PromptEditor",
|
"context": "PromptEditor",
|
||||||
"bindings": {
|
"bindings": {
|
||||||
"ctrl-[": "assistant::CyclePreviousInlineAssist",
|
"ctrl-[": "agent::CyclePreviousInlineAssist",
|
||||||
"ctrl-]": "assistant::CycleNextInlineAssist",
|
"ctrl-]": "agent::CycleNextInlineAssist",
|
||||||
"ctrl-alt-e": "agent::RemoveAllContext"
|
"ctrl-alt-e": "agent::RemoveAllContext"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -258,21 +258,6 @@
|
|||||||
"shift-ctrl-r": "agent::OpenAgentDiff"
|
"shift-ctrl-r": "agent::OpenAgentDiff"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"context": "AssistantPanel",
|
|
||||||
"use_key_equivalents": true,
|
|
||||||
"bindings": {
|
|
||||||
"cmd-k c": "assistant::CopyCode",
|
|
||||||
"cmd-shift-e": "project_panel::ToggleFocus",
|
|
||||||
"cmd-g": "search::SelectNextMatch",
|
|
||||||
"cmd-shift-g": "search::SelectPreviousMatch",
|
|
||||||
"cmd-alt-/": "agent::ToggleModelSelector",
|
|
||||||
"cmd-k h": "assistant::DeployHistory",
|
|
||||||
"cmd-k l": "agent::OpenRulesLibrary",
|
|
||||||
"cmd-t": "assistant::NewChat",
|
|
||||||
"cmd-n": "assistant::NewChat"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"context": "ContextEditor > Editor",
|
"context": "ContextEditor > Editor",
|
||||||
"use_key_equivalents": true,
|
"use_key_equivalents": true,
|
||||||
@ -780,8 +765,8 @@
|
|||||||
"cmd-shift-a": "agent::ToggleContextPicker",
|
"cmd-shift-a": "agent::ToggleContextPicker",
|
||||||
"cmd-alt-/": "agent::ToggleModelSelector",
|
"cmd-alt-/": "agent::ToggleModelSelector",
|
||||||
"cmd-alt-e": "agent::RemoveAllContext",
|
"cmd-alt-e": "agent::RemoveAllContext",
|
||||||
"ctrl-[": "assistant::CyclePreviousInlineAssist",
|
"ctrl-[": "agent::CyclePreviousInlineAssist",
|
||||||
"ctrl-]": "assistant::CycleNextInlineAssist"
|
"ctrl-]": "agent::CycleNextInlineAssist"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -23,6 +23,7 @@ anyhow.workspace = true
|
|||||||
assistant_context_editor.workspace = true
|
assistant_context_editor.workspace = true
|
||||||
assistant_settings.workspace = true
|
assistant_settings.workspace = true
|
||||||
assistant_slash_command.workspace = true
|
assistant_slash_command.workspace = true
|
||||||
|
assistant_slash_commands.workspace = true
|
||||||
assistant_tool.workspace = true
|
assistant_tool.workspace = true
|
||||||
async-watch.workspace = true
|
async-watch.workspace = true
|
||||||
buffer_diff.workspace = true
|
buffer_diff.workspace = true
|
||||||
@ -45,6 +46,7 @@ gpui.workspace = true
|
|||||||
heed.workspace = true
|
heed.workspace = true
|
||||||
html_to_markdown.workspace = true
|
html_to_markdown.workspace = true
|
||||||
http_client.workspace = true
|
http_client.workspace = true
|
||||||
|
indexed_docs.workspace = true
|
||||||
itertools.workspace = true
|
itertools.workspace = true
|
||||||
jsonschema.workspace = true
|
jsonschema.workspace = true
|
||||||
language.workspace = true
|
language.workspace = true
|
||||||
|
@ -16,6 +16,7 @@ mod inline_assistant;
|
|||||||
mod inline_prompt_editor;
|
mod inline_prompt_editor;
|
||||||
mod message_editor;
|
mod message_editor;
|
||||||
mod profile_selector;
|
mod profile_selector;
|
||||||
|
mod slash_command_settings;
|
||||||
mod terminal_codegen;
|
mod terminal_codegen;
|
||||||
mod terminal_inline_assistant;
|
mod terminal_inline_assistant;
|
||||||
mod thread;
|
mod thread;
|
||||||
@ -27,15 +28,18 @@ mod ui;
|
|||||||
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use assistant_settings::{AgentProfileId, AssistantSettings};
|
use assistant_settings::{AgentProfileId, AssistantSettings, LanguageModelSelection};
|
||||||
|
use assistant_slash_command::SlashCommandRegistry;
|
||||||
use client::Client;
|
use client::Client;
|
||||||
|
use feature_flags::FeatureFlagAppExt as _;
|
||||||
use fs::Fs;
|
use fs::Fs;
|
||||||
use gpui::{App, actions, impl_actions};
|
use gpui::{App, actions, impl_actions};
|
||||||
use language::LanguageRegistry;
|
use language::LanguageRegistry;
|
||||||
|
use language_model::{LanguageModelId, LanguageModelProviderId, LanguageModelRegistry};
|
||||||
use prompt_store::PromptBuilder;
|
use prompt_store::PromptBuilder;
|
||||||
use schemars::JsonSchema;
|
use schemars::JsonSchema;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use settings::Settings as _;
|
use settings::{Settings as _, SettingsStore};
|
||||||
use thread::ThreadId;
|
use thread::ThreadId;
|
||||||
|
|
||||||
pub use crate::active_thread::ActiveThread;
|
pub use crate::active_thread::ActiveThread;
|
||||||
@ -43,6 +47,7 @@ use crate::assistant_configuration::{AddContextServerModal, ManageProfilesModal}
|
|||||||
pub use crate::assistant_panel::{AssistantPanel, ConcreteAssistantPanelDelegate};
|
pub use crate::assistant_panel::{AssistantPanel, ConcreteAssistantPanelDelegate};
|
||||||
pub use crate::context::{ContextLoadResult, LoadedContext};
|
pub use crate::context::{ContextLoadResult, LoadedContext};
|
||||||
pub use crate::inline_assistant::InlineAssistant;
|
pub use crate::inline_assistant::InlineAssistant;
|
||||||
|
use crate::slash_command_settings::SlashCommandSettings;
|
||||||
pub use crate::thread::{Message, MessageSegment, Thread, ThreadEvent};
|
pub use crate::thread::{Message, MessageSegment, Thread, ThreadEvent};
|
||||||
pub use crate::thread_store::{TextThreadStore, ThreadStore};
|
pub use crate::thread_store::{TextThreadStore, ThreadStore};
|
||||||
pub use agent_diff::{AgentDiffPane, AgentDiffToolbar};
|
pub use agent_diff::{AgentDiffPane, AgentDiffToolbar};
|
||||||
@ -114,10 +119,17 @@ pub fn init(
|
|||||||
cx: &mut App,
|
cx: &mut App,
|
||||||
) {
|
) {
|
||||||
AssistantSettings::register(cx);
|
AssistantSettings::register(cx);
|
||||||
|
SlashCommandSettings::register(cx);
|
||||||
|
|
||||||
|
assistant_context_editor::init(client.clone(), cx);
|
||||||
|
rules_library::init(cx);
|
||||||
|
init_language_model_settings(cx);
|
||||||
|
assistant_slash_command::init(cx);
|
||||||
thread_store::init(cx);
|
thread_store::init(cx);
|
||||||
assistant_panel::init(cx);
|
assistant_panel::init(cx);
|
||||||
context_server_configuration::init(language_registry, cx);
|
context_server_configuration::init(language_registry, cx);
|
||||||
|
|
||||||
|
register_slash_commands(cx);
|
||||||
inline_assistant::init(
|
inline_assistant::init(
|
||||||
fs.clone(),
|
fs.clone(),
|
||||||
prompt_builder.clone(),
|
prompt_builder.clone(),
|
||||||
@ -130,6 +142,119 @@ pub fn init(
|
|||||||
client.telemetry().clone(),
|
client.telemetry().clone(),
|
||||||
cx,
|
cx,
|
||||||
);
|
);
|
||||||
|
indexed_docs::init(cx);
|
||||||
cx.observe_new(AddContextServerModal::register).detach();
|
cx.observe_new(AddContextServerModal::register).detach();
|
||||||
cx.observe_new(ManageProfilesModal::register).detach();
|
cx.observe_new(ManageProfilesModal::register).detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn init_language_model_settings(cx: &mut App) {
|
||||||
|
update_active_language_model_from_settings(cx);
|
||||||
|
|
||||||
|
cx.observe_global::<SettingsStore>(update_active_language_model_from_settings)
|
||||||
|
.detach();
|
||||||
|
cx.subscribe(
|
||||||
|
&LanguageModelRegistry::global(cx),
|
||||||
|
|_, event: &language_model::Event, cx| match event {
|
||||||
|
language_model::Event::ProviderStateChanged
|
||||||
|
| language_model::Event::AddedProvider(_)
|
||||||
|
| language_model::Event::RemovedProvider(_) => {
|
||||||
|
update_active_language_model_from_settings(cx);
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.detach();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn update_active_language_model_from_settings(cx: &mut App) {
|
||||||
|
let settings = AssistantSettings::get_global(cx);
|
||||||
|
|
||||||
|
fn to_selected_model(selection: &LanguageModelSelection) -> language_model::SelectedModel {
|
||||||
|
language_model::SelectedModel {
|
||||||
|
provider: LanguageModelProviderId::from(selection.provider.0.clone()),
|
||||||
|
model: LanguageModelId::from(selection.model.clone()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let default = to_selected_model(&settings.default_model);
|
||||||
|
let inline_assistant = settings
|
||||||
|
.inline_assistant_model
|
||||||
|
.as_ref()
|
||||||
|
.map(to_selected_model);
|
||||||
|
let commit_message = settings
|
||||||
|
.commit_message_model
|
||||||
|
.as_ref()
|
||||||
|
.map(to_selected_model);
|
||||||
|
let thread_summary = settings
|
||||||
|
.thread_summary_model
|
||||||
|
.as_ref()
|
||||||
|
.map(to_selected_model);
|
||||||
|
let inline_alternatives = settings
|
||||||
|
.inline_alternatives
|
||||||
|
.iter()
|
||||||
|
.map(to_selected_model)
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
|
LanguageModelRegistry::global(cx).update(cx, |registry, cx| {
|
||||||
|
registry.select_default_model(Some(&default), cx);
|
||||||
|
registry.select_inline_assistant_model(inline_assistant.as_ref(), cx);
|
||||||
|
registry.select_commit_message_model(commit_message.as_ref(), cx);
|
||||||
|
registry.select_thread_summary_model(thread_summary.as_ref(), cx);
|
||||||
|
registry.select_inline_alternative_models(inline_alternatives, cx);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
fn register_slash_commands(cx: &mut App) {
|
||||||
|
let slash_command_registry = SlashCommandRegistry::global(cx);
|
||||||
|
|
||||||
|
slash_command_registry.register_command(assistant_slash_commands::FileSlashCommand, true);
|
||||||
|
slash_command_registry.register_command(assistant_slash_commands::DeltaSlashCommand, true);
|
||||||
|
slash_command_registry.register_command(assistant_slash_commands::OutlineSlashCommand, true);
|
||||||
|
slash_command_registry.register_command(assistant_slash_commands::TabSlashCommand, true);
|
||||||
|
slash_command_registry
|
||||||
|
.register_command(assistant_slash_commands::CargoWorkspaceSlashCommand, true);
|
||||||
|
slash_command_registry.register_command(assistant_slash_commands::PromptSlashCommand, true);
|
||||||
|
slash_command_registry.register_command(assistant_slash_commands::SelectionCommand, true);
|
||||||
|
slash_command_registry.register_command(assistant_slash_commands::DefaultSlashCommand, false);
|
||||||
|
slash_command_registry.register_command(assistant_slash_commands::TerminalSlashCommand, true);
|
||||||
|
slash_command_registry.register_command(assistant_slash_commands::NowSlashCommand, false);
|
||||||
|
slash_command_registry
|
||||||
|
.register_command(assistant_slash_commands::DiagnosticsSlashCommand, true);
|
||||||
|
slash_command_registry.register_command(assistant_slash_commands::FetchSlashCommand, true);
|
||||||
|
|
||||||
|
cx.observe_flag::<assistant_slash_commands::StreamingExampleSlashCommandFeatureFlag, _>({
|
||||||
|
let slash_command_registry = slash_command_registry.clone();
|
||||||
|
move |is_enabled, _cx| {
|
||||||
|
if is_enabled {
|
||||||
|
slash_command_registry.register_command(
|
||||||
|
assistant_slash_commands::StreamingExampleSlashCommand,
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.detach();
|
||||||
|
|
||||||
|
update_slash_commands_from_settings(cx);
|
||||||
|
cx.observe_global::<SettingsStore>(update_slash_commands_from_settings)
|
||||||
|
.detach();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn update_slash_commands_from_settings(cx: &mut App) {
|
||||||
|
let slash_command_registry = SlashCommandRegistry::global(cx);
|
||||||
|
let settings = SlashCommandSettings::get_global(cx);
|
||||||
|
|
||||||
|
if settings.docs.enabled {
|
||||||
|
slash_command_registry.register_command(assistant_slash_commands::DocsSlashCommand, true);
|
||||||
|
} else {
|
||||||
|
slash_command_registry.unregister_command(assistant_slash_commands::DocsSlashCommand);
|
||||||
|
}
|
||||||
|
|
||||||
|
if settings.cargo_workspace.enabled {
|
||||||
|
slash_command_registry
|
||||||
|
.register_command(assistant_slash_commands::CargoWorkspaceSlashCommand, true);
|
||||||
|
} else {
|
||||||
|
slash_command_registry
|
||||||
|
.unregister_command(assistant_slash_commands::CargoWorkspaceSlashCommand);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,88 +0,0 @@
|
|||||||
[package]
|
|
||||||
name = "assistant"
|
|
||||||
version = "0.1.0"
|
|
||||||
edition.workspace = true
|
|
||||||
publish.workspace = true
|
|
||||||
license = "GPL-3.0-or-later"
|
|
||||||
|
|
||||||
[lints]
|
|
||||||
workspace = true
|
|
||||||
|
|
||||||
[lib]
|
|
||||||
path = "src/assistant.rs"
|
|
||||||
doctest = false
|
|
||||||
|
|
||||||
[features]
|
|
||||||
test-support = [
|
|
||||||
"editor/test-support",
|
|
||||||
"language/test-support",
|
|
||||||
"project/test-support",
|
|
||||||
"text/test-support",
|
|
||||||
]
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
anyhow.workspace = true
|
|
||||||
assistant_context_editor.workspace = true
|
|
||||||
assistant_settings.workspace = true
|
|
||||||
assistant_slash_command.workspace = true
|
|
||||||
assistant_slash_commands.workspace = true
|
|
||||||
assistant_tool.workspace = true
|
|
||||||
async-watch.workspace = true
|
|
||||||
client.workspace = true
|
|
||||||
collections.workspace = true
|
|
||||||
command_palette_hooks.workspace = true
|
|
||||||
db.workspace = true
|
|
||||||
editor.workspace = true
|
|
||||||
feature_flags.workspace = true
|
|
||||||
fs.workspace = true
|
|
||||||
futures.workspace = true
|
|
||||||
gpui.workspace = true
|
|
||||||
indexed_docs.workspace = true
|
|
||||||
indoc.workspace = true
|
|
||||||
language.workspace = true
|
|
||||||
language_model.workspace = true
|
|
||||||
language_model_selector.workspace = true
|
|
||||||
log.workspace = true
|
|
||||||
lsp.workspace = true
|
|
||||||
menu.workspace = true
|
|
||||||
multi_buffer.workspace = true
|
|
||||||
parking_lot.workspace = true
|
|
||||||
project.workspace = true
|
|
||||||
rules_library.workspace = true
|
|
||||||
prompt_store.workspace = true
|
|
||||||
proto.workspace = true
|
|
||||||
rope.workspace = true
|
|
||||||
schemars.workspace = true
|
|
||||||
search.workspace = true
|
|
||||||
serde.workspace = true
|
|
||||||
settings.workspace = true
|
|
||||||
smol.workspace = true
|
|
||||||
streaming_diff.workspace = true
|
|
||||||
telemetry.workspace = true
|
|
||||||
telemetry_events.workspace = true
|
|
||||||
terminal.workspace = true
|
|
||||||
terminal_view.workspace = true
|
|
||||||
text.workspace = true
|
|
||||||
theme.workspace = true
|
|
||||||
ui.workspace = true
|
|
||||||
util.workspace = true
|
|
||||||
workspace.workspace = true
|
|
||||||
zed_actions.workspace = true
|
|
||||||
workspace-hack.workspace = true
|
|
||||||
|
|
||||||
[dev-dependencies]
|
|
||||||
ctor.workspace = true
|
|
||||||
editor = { workspace = true, features = ["test-support"] }
|
|
||||||
env_logger.workspace = true
|
|
||||||
language = { workspace = true, features = ["test-support"] }
|
|
||||||
language_model = { workspace = true, features = ["test-support"] }
|
|
||||||
languages = { workspace = true, features = ["test-support"] }
|
|
||||||
log.workspace = true
|
|
||||||
pretty_assertions.workspace = true
|
|
||||||
project = { workspace = true, features = ["test-support"] }
|
|
||||||
rand.workspace = true
|
|
||||||
serde_json_lenient.workspace = true
|
|
||||||
terminal_view = { workspace = true, features = ["test-support"] }
|
|
||||||
text = { workspace = true, features = ["test-support"] }
|
|
||||||
tree-sitter-md.workspace = true
|
|
||||||
unindent.workspace = true
|
|
@ -1 +0,0 @@
|
|||||||
../../LICENSE-GPL
|
|
@ -1,260 +0,0 @@
|
|||||||
#![cfg_attr(target_os = "windows", allow(unused, dead_code))]
|
|
||||||
|
|
||||||
mod assistant_configuration;
|
|
||||||
pub mod assistant_panel;
|
|
||||||
mod inline_assistant;
|
|
||||||
pub mod slash_command_settings;
|
|
||||||
mod terminal_inline_assistant;
|
|
||||||
|
|
||||||
use std::sync::Arc;
|
|
||||||
|
|
||||||
use assistant_settings::{AssistantSettings, LanguageModelSelection};
|
|
||||||
use assistant_slash_command::SlashCommandRegistry;
|
|
||||||
use client::Client;
|
|
||||||
use command_palette_hooks::CommandPaletteFilter;
|
|
||||||
use feature_flags::FeatureFlagAppExt;
|
|
||||||
use fs::Fs;
|
|
||||||
use gpui::{App, Global, ReadGlobal, UpdateGlobal, actions};
|
|
||||||
use language_model::{
|
|
||||||
LanguageModelId, LanguageModelProviderId, LanguageModelRegistry, LanguageModelResponseMessage,
|
|
||||||
};
|
|
||||||
use prompt_store::PromptBuilder;
|
|
||||||
use serde::Deserialize;
|
|
||||||
use settings::{Settings, SettingsStore};
|
|
||||||
|
|
||||||
pub use crate::assistant_panel::{AssistantPanel, AssistantPanelEvent};
|
|
||||||
pub(crate) use crate::inline_assistant::*;
|
|
||||||
use crate::slash_command_settings::SlashCommandSettings;
|
|
||||||
|
|
||||||
actions!(
|
|
||||||
assistant,
|
|
||||||
[
|
|
||||||
InsertActivePrompt,
|
|
||||||
DeployHistory,
|
|
||||||
NewChat,
|
|
||||||
CycleNextInlineAssist,
|
|
||||||
CyclePreviousInlineAssist
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
const DEFAULT_CONTEXT_LINES: usize = 50;
|
|
||||||
|
|
||||||
#[derive(Deserialize, Debug)]
|
|
||||||
pub struct LanguageModelUsage {
|
|
||||||
pub prompt_tokens: u32,
|
|
||||||
pub completion_tokens: u32,
|
|
||||||
pub total_tokens: u32,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Deserialize, Debug)]
|
|
||||||
pub struct LanguageModelChoiceDelta {
|
|
||||||
pub index: u32,
|
|
||||||
pub delta: LanguageModelResponseMessage,
|
|
||||||
pub finish_reason: Option<String>,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The state pertaining to the Assistant.
|
|
||||||
#[derive(Default)]
|
|
||||||
struct Assistant {
|
|
||||||
/// Whether the Assistant is enabled.
|
|
||||||
enabled: bool,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Global for Assistant {}
|
|
||||||
|
|
||||||
impl Assistant {
|
|
||||||
const NAMESPACE: &'static str = "assistant";
|
|
||||||
|
|
||||||
fn set_enabled(&mut self, enabled: bool, cx: &mut App) {
|
|
||||||
if self.enabled == enabled {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
self.enabled = enabled;
|
|
||||||
|
|
||||||
if !enabled {
|
|
||||||
CommandPaletteFilter::update_global(cx, |filter, _cx| {
|
|
||||||
filter.hide_namespace(Self::NAMESPACE);
|
|
||||||
});
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CommandPaletteFilter::update_global(cx, |filter, _cx| {
|
|
||||||
filter.show_namespace(Self::NAMESPACE);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn enabled(cx: &App) -> bool {
|
|
||||||
Self::global(cx).enabled
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn init(
|
|
||||||
fs: Arc<dyn Fs>,
|
|
||||||
client: Arc<Client>,
|
|
||||||
prompt_builder: Arc<PromptBuilder>,
|
|
||||||
cx: &mut App,
|
|
||||||
) {
|
|
||||||
cx.set_global(Assistant::default());
|
|
||||||
AssistantSettings::register(cx);
|
|
||||||
SlashCommandSettings::register(cx);
|
|
||||||
|
|
||||||
assistant_context_editor::init(client.clone(), cx);
|
|
||||||
rules_library::init(cx);
|
|
||||||
init_language_model_settings(cx);
|
|
||||||
assistant_slash_command::init(cx);
|
|
||||||
assistant_tool::init(cx);
|
|
||||||
assistant_panel::init(cx);
|
|
||||||
|
|
||||||
register_slash_commands(cx);
|
|
||||||
inline_assistant::init(
|
|
||||||
fs.clone(),
|
|
||||||
prompt_builder.clone(),
|
|
||||||
client.telemetry().clone(),
|
|
||||||
cx,
|
|
||||||
);
|
|
||||||
terminal_inline_assistant::init(
|
|
||||||
fs.clone(),
|
|
||||||
prompt_builder.clone(),
|
|
||||||
client.telemetry().clone(),
|
|
||||||
cx,
|
|
||||||
);
|
|
||||||
indexed_docs::init(cx);
|
|
||||||
|
|
||||||
CommandPaletteFilter::update_global(cx, |filter, _cx| {
|
|
||||||
filter.hide_namespace(Assistant::NAMESPACE);
|
|
||||||
});
|
|
||||||
Assistant::update_global(cx, |assistant, cx| {
|
|
||||||
let settings = AssistantSettings::get_global(cx);
|
|
||||||
|
|
||||||
assistant.set_enabled(settings.enabled, cx);
|
|
||||||
});
|
|
||||||
cx.observe_global::<SettingsStore>(|cx| {
|
|
||||||
Assistant::update_global(cx, |assistant, cx| {
|
|
||||||
let settings = AssistantSettings::get_global(cx);
|
|
||||||
assistant.set_enabled(settings.enabled, cx);
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.detach();
|
|
||||||
}
|
|
||||||
|
|
||||||
fn init_language_model_settings(cx: &mut App) {
|
|
||||||
update_active_language_model_from_settings(cx);
|
|
||||||
|
|
||||||
cx.observe_global::<SettingsStore>(update_active_language_model_from_settings)
|
|
||||||
.detach();
|
|
||||||
cx.subscribe(
|
|
||||||
&LanguageModelRegistry::global(cx),
|
|
||||||
|_, event: &language_model::Event, cx| match event {
|
|
||||||
language_model::Event::ProviderStateChanged
|
|
||||||
| language_model::Event::AddedProvider(_)
|
|
||||||
| language_model::Event::RemovedProvider(_) => {
|
|
||||||
update_active_language_model_from_settings(cx);
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
},
|
|
||||||
)
|
|
||||||
.detach();
|
|
||||||
}
|
|
||||||
|
|
||||||
fn update_active_language_model_from_settings(cx: &mut App) {
|
|
||||||
let settings = AssistantSettings::get_global(cx);
|
|
||||||
|
|
||||||
fn to_selected_model(selection: &LanguageModelSelection) -> language_model::SelectedModel {
|
|
||||||
language_model::SelectedModel {
|
|
||||||
provider: LanguageModelProviderId::from(selection.provider.0.clone()),
|
|
||||||
model: LanguageModelId::from(selection.model.clone()),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let default = to_selected_model(&settings.default_model);
|
|
||||||
let inline_assistant = settings
|
|
||||||
.inline_assistant_model
|
|
||||||
.as_ref()
|
|
||||||
.map(to_selected_model);
|
|
||||||
let commit_message = settings
|
|
||||||
.commit_message_model
|
|
||||||
.as_ref()
|
|
||||||
.map(to_selected_model);
|
|
||||||
let thread_summary = settings
|
|
||||||
.thread_summary_model
|
|
||||||
.as_ref()
|
|
||||||
.map(to_selected_model);
|
|
||||||
let inline_alternatives = settings
|
|
||||||
.inline_alternatives
|
|
||||||
.iter()
|
|
||||||
.map(to_selected_model)
|
|
||||||
.collect::<Vec<_>>();
|
|
||||||
|
|
||||||
LanguageModelRegistry::global(cx).update(cx, |registry, cx| {
|
|
||||||
registry.select_default_model(Some(&default), cx);
|
|
||||||
registry.select_inline_assistant_model(inline_assistant.as_ref(), cx);
|
|
||||||
registry.select_commit_message_model(commit_message.as_ref(), cx);
|
|
||||||
registry.select_thread_summary_model(thread_summary.as_ref(), cx);
|
|
||||||
registry.select_inline_alternative_models(inline_alternatives, cx);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
fn register_slash_commands(cx: &mut App) {
|
|
||||||
let slash_command_registry = SlashCommandRegistry::global(cx);
|
|
||||||
|
|
||||||
slash_command_registry.register_command(assistant_slash_commands::FileSlashCommand, true);
|
|
||||||
slash_command_registry.register_command(assistant_slash_commands::DeltaSlashCommand, true);
|
|
||||||
slash_command_registry.register_command(assistant_slash_commands::OutlineSlashCommand, true);
|
|
||||||
slash_command_registry.register_command(assistant_slash_commands::TabSlashCommand, true);
|
|
||||||
slash_command_registry
|
|
||||||
.register_command(assistant_slash_commands::CargoWorkspaceSlashCommand, true);
|
|
||||||
slash_command_registry.register_command(assistant_slash_commands::PromptSlashCommand, true);
|
|
||||||
slash_command_registry.register_command(assistant_slash_commands::SelectionCommand, true);
|
|
||||||
slash_command_registry.register_command(assistant_slash_commands::DefaultSlashCommand, false);
|
|
||||||
slash_command_registry.register_command(assistant_slash_commands::TerminalSlashCommand, true);
|
|
||||||
slash_command_registry.register_command(assistant_slash_commands::NowSlashCommand, false);
|
|
||||||
slash_command_registry
|
|
||||||
.register_command(assistant_slash_commands::DiagnosticsSlashCommand, true);
|
|
||||||
slash_command_registry.register_command(assistant_slash_commands::FetchSlashCommand, true);
|
|
||||||
|
|
||||||
cx.observe_flag::<assistant_slash_commands::StreamingExampleSlashCommandFeatureFlag, _>({
|
|
||||||
let slash_command_registry = slash_command_registry.clone();
|
|
||||||
move |is_enabled, _cx| {
|
|
||||||
if is_enabled {
|
|
||||||
slash_command_registry.register_command(
|
|
||||||
assistant_slash_commands::StreamingExampleSlashCommand,
|
|
||||||
false,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.detach();
|
|
||||||
|
|
||||||
update_slash_commands_from_settings(cx);
|
|
||||||
cx.observe_global::<SettingsStore>(update_slash_commands_from_settings)
|
|
||||||
.detach();
|
|
||||||
}
|
|
||||||
|
|
||||||
fn update_slash_commands_from_settings(cx: &mut App) {
|
|
||||||
let slash_command_registry = SlashCommandRegistry::global(cx);
|
|
||||||
let settings = SlashCommandSettings::get_global(cx);
|
|
||||||
|
|
||||||
if settings.docs.enabled {
|
|
||||||
slash_command_registry.register_command(assistant_slash_commands::DocsSlashCommand, true);
|
|
||||||
} else {
|
|
||||||
slash_command_registry.unregister_command(assistant_slash_commands::DocsSlashCommand);
|
|
||||||
}
|
|
||||||
|
|
||||||
if settings.cargo_workspace.enabled {
|
|
||||||
slash_command_registry
|
|
||||||
.register_command(assistant_slash_commands::CargoWorkspaceSlashCommand, true);
|
|
||||||
} else {
|
|
||||||
slash_command_registry
|
|
||||||
.unregister_command(assistant_slash_commands::CargoWorkspaceSlashCommand);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
#[ctor::ctor]
|
|
||||||
fn init_logger() {
|
|
||||||
if std::env::var("RUST_LOG").is_ok() {
|
|
||||||
env_logger::init();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,199 +0,0 @@
|
|||||||
use std::sync::Arc;
|
|
||||||
|
|
||||||
use collections::HashMap;
|
|
||||||
use gpui::{AnyView, App, EventEmitter, FocusHandle, Focusable, Subscription, canvas};
|
|
||||||
use language_model::{LanguageModelProvider, LanguageModelProviderId, LanguageModelRegistry};
|
|
||||||
use ui::{ElevationIndex, prelude::*};
|
|
||||||
use workspace::Item;
|
|
||||||
|
|
||||||
pub struct ConfigurationView {
|
|
||||||
focus_handle: FocusHandle,
|
|
||||||
configuration_views: HashMap<LanguageModelProviderId, AnyView>,
|
|
||||||
_registry_subscription: Subscription,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ConfigurationView {
|
|
||||||
pub fn new(window: &mut Window, cx: &mut Context<Self>) -> Self {
|
|
||||||
let focus_handle = cx.focus_handle();
|
|
||||||
|
|
||||||
let registry_subscription = cx.subscribe_in(
|
|
||||||
&LanguageModelRegistry::global(cx),
|
|
||||||
window,
|
|
||||||
|this, _, event: &language_model::Event, window, cx| match event {
|
|
||||||
language_model::Event::AddedProvider(provider_id) => {
|
|
||||||
let provider = LanguageModelRegistry::read_global(cx).provider(provider_id);
|
|
||||||
if let Some(provider) = provider {
|
|
||||||
this.add_configuration_view(&provider, window, cx);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
language_model::Event::RemovedProvider(provider_id) => {
|
|
||||||
this.remove_configuration_view(provider_id);
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
let mut this = Self {
|
|
||||||
focus_handle,
|
|
||||||
configuration_views: HashMap::default(),
|
|
||||||
_registry_subscription: registry_subscription,
|
|
||||||
};
|
|
||||||
this.build_configuration_views(window, cx);
|
|
||||||
this
|
|
||||||
}
|
|
||||||
|
|
||||||
fn build_configuration_views(&mut self, window: &mut Window, cx: &mut Context<Self>) {
|
|
||||||
let providers = LanguageModelRegistry::read_global(cx).providers();
|
|
||||||
for provider in providers {
|
|
||||||
self.add_configuration_view(&provider, window, cx);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn remove_configuration_view(&mut self, provider_id: &LanguageModelProviderId) {
|
|
||||||
self.configuration_views.remove(provider_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn add_configuration_view(
|
|
||||||
&mut self,
|
|
||||||
provider: &Arc<dyn LanguageModelProvider>,
|
|
||||||
window: &mut Window,
|
|
||||||
cx: &mut Context<Self>,
|
|
||||||
) {
|
|
||||||
let configuration_view = provider.configuration_view(window, cx);
|
|
||||||
self.configuration_views
|
|
||||||
.insert(provider.id(), configuration_view);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn render_provider_view(
|
|
||||||
&mut self,
|
|
||||||
provider: &Arc<dyn LanguageModelProvider>,
|
|
||||||
cx: &mut Context<Self>,
|
|
||||||
) -> Div {
|
|
||||||
let provider_id = provider.id().0.clone();
|
|
||||||
let provider_name = provider.name().0.clone();
|
|
||||||
let configuration_view = self.configuration_views.get(&provider.id()).cloned();
|
|
||||||
|
|
||||||
let open_new_context = cx.listener({
|
|
||||||
let provider = provider.clone();
|
|
||||||
move |_, _, _window, cx| {
|
|
||||||
cx.emit(ConfigurationViewEvent::NewProviderContextEditor(
|
|
||||||
provider.clone(),
|
|
||||||
))
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
v_flex()
|
|
||||||
.gap_2()
|
|
||||||
.child(
|
|
||||||
h_flex()
|
|
||||||
.justify_between()
|
|
||||||
.child(Headline::new(provider_name.clone()).size(HeadlineSize::Small))
|
|
||||||
.when(provider.is_authenticated(cx), move |this| {
|
|
||||||
this.child(
|
|
||||||
h_flex().justify_end().child(
|
|
||||||
Button::new(
|
|
||||||
SharedString::from(format!("new-context-{provider_id}")),
|
|
||||||
"Open New Chat",
|
|
||||||
)
|
|
||||||
.icon_position(IconPosition::Start)
|
|
||||||
.icon(IconName::Plus)
|
|
||||||
.style(ButtonStyle::Filled)
|
|
||||||
.layer(ElevationIndex::ModalSurface)
|
|
||||||
.on_click(open_new_context),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
.child(
|
|
||||||
div()
|
|
||||||
.p(DynamicSpacing::Base08.rems(cx))
|
|
||||||
.bg(cx.theme().colors().surface_background)
|
|
||||||
.border_1()
|
|
||||||
.border_color(cx.theme().colors().border_variant)
|
|
||||||
.rounded_sm()
|
|
||||||
.when(configuration_view.is_none(), |this| {
|
|
||||||
this.child(div().child(Label::new(format!(
|
|
||||||
"No configuration view for {}",
|
|
||||||
provider_name
|
|
||||||
))))
|
|
||||||
})
|
|
||||||
.when_some(configuration_view, |this, configuration_view| {
|
|
||||||
this.child(configuration_view)
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Render for ConfigurationView {
|
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
|
||||||
let providers = LanguageModelRegistry::read_global(cx).providers();
|
|
||||||
let provider_views = providers
|
|
||||||
.into_iter()
|
|
||||||
.map(|provider| self.render_provider_view(&provider, cx))
|
|
||||||
.collect::<Vec<_>>();
|
|
||||||
|
|
||||||
let mut element = v_flex()
|
|
||||||
.id("assistant-configuration-view")
|
|
||||||
.track_focus(&self.focus_handle(cx))
|
|
||||||
.bg(cx.theme().colors().editor_background)
|
|
||||||
.size_full()
|
|
||||||
.overflow_y_scroll()
|
|
||||||
.child(
|
|
||||||
v_flex()
|
|
||||||
.p(DynamicSpacing::Base16.rems(cx))
|
|
||||||
.border_b_1()
|
|
||||||
.border_color(cx.theme().colors().border)
|
|
||||||
.gap_1()
|
|
||||||
.child(Headline::new("Configure your Assistant").size(HeadlineSize::Medium))
|
|
||||||
.child(
|
|
||||||
Label::new(
|
|
||||||
"At least one LLM provider must be configured to use the Assistant.",
|
|
||||||
)
|
|
||||||
.color(Color::Muted),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.child(
|
|
||||||
v_flex()
|
|
||||||
.p(DynamicSpacing::Base16.rems(cx))
|
|
||||||
.mt_1()
|
|
||||||
.gap_6()
|
|
||||||
.flex_1()
|
|
||||||
.children(provider_views),
|
|
||||||
)
|
|
||||||
.into_any();
|
|
||||||
|
|
||||||
// We use a canvas here to get scrolling to work in the ConfigurationView. It's a workaround
|
|
||||||
// because we couldn't the element to take up the size of the parent.
|
|
||||||
canvas(
|
|
||||||
move |bounds, window, cx| {
|
|
||||||
element.prepaint_as_root(bounds.origin, bounds.size.into(), window, cx);
|
|
||||||
element
|
|
||||||
},
|
|
||||||
|_, mut element, window, cx| {
|
|
||||||
element.paint(window, cx);
|
|
||||||
},
|
|
||||||
)
|
|
||||||
.flex_1()
|
|
||||||
.w_full()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub enum ConfigurationViewEvent {
|
|
||||||
NewProviderContextEditor(Arc<dyn LanguageModelProvider>),
|
|
||||||
}
|
|
||||||
|
|
||||||
impl EventEmitter<ConfigurationViewEvent> for ConfigurationView {}
|
|
||||||
|
|
||||||
impl Focusable for ConfigurationView {
|
|
||||||
fn focus_handle(&self, _: &App) -> FocusHandle {
|
|
||||||
self.focus_handle.clone()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Item for ConfigurationView {
|
|
||||||
type Event = ConfigurationViewEvent;
|
|
||||||
|
|
||||||
fn tab_content_text(&self, _detail: usize, _cx: &App) -> SharedString {
|
|
||||||
"Configuration".into()
|
|
||||||
}
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -76,7 +76,6 @@ workspace-hack.workspace = true
|
|||||||
zed_llm_client.workspace = true
|
zed_llm_client.workspace = true
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
assistant = { workspace = true, features = ["test-support"] }
|
|
||||||
assistant_context_editor.workspace = true
|
assistant_context_editor.workspace = true
|
||||||
assistant_settings.workspace = true
|
assistant_settings.workspace = true
|
||||||
assistant_slash_command.workspace = true
|
assistant_slash_command.workspace = true
|
||||||
|
@ -20,7 +20,6 @@ agent.workspace = true
|
|||||||
anyhow.workspace = true
|
anyhow.workspace = true
|
||||||
askpass.workspace = true
|
askpass.workspace = true
|
||||||
assets.workspace = true
|
assets.workspace = true
|
||||||
assistant.workspace = true
|
|
||||||
assistant_context_editor.workspace = true
|
assistant_context_editor.workspace = true
|
||||||
assistant_settings.workspace = true
|
assistant_settings.workspace = true
|
||||||
assistant_tools.workspace = true
|
assistant_tools.workspace = true
|
||||||
|
@ -503,12 +503,6 @@ fn main() {
|
|||||||
cx,
|
cx,
|
||||||
);
|
);
|
||||||
let prompt_builder = PromptBuilder::load(app_state.fs.clone(), stdout_is_a_pty(), cx);
|
let prompt_builder = PromptBuilder::load(app_state.fs.clone(), stdout_is_a_pty(), cx);
|
||||||
assistant::init(
|
|
||||||
app_state.fs.clone(),
|
|
||||||
app_state.client.clone(),
|
|
||||||
prompt_builder.clone(),
|
|
||||||
cx,
|
|
||||||
);
|
|
||||||
agent::init(
|
agent::init(
|
||||||
app_state.fs.clone(),
|
app_state.fs.clone(),
|
||||||
app_state.client.clone(),
|
app_state.client.clone(),
|
||||||
|
@ -433,31 +433,19 @@ fn initialize_panels(
|
|||||||
})?;
|
})?;
|
||||||
|
|
||||||
let is_assistant2_enabled = !cfg!(test);
|
let is_assistant2_enabled = !cfg!(test);
|
||||||
|
let agent_panel = if is_assistant2_enabled {
|
||||||
let (assistant_panel, assistant2_panel) = if is_assistant2_enabled {
|
let agent_panel =
|
||||||
let assistant2_panel =
|
|
||||||
agent::AssistantPanel::load(workspace_handle.clone(), prompt_builder, cx.clone())
|
agent::AssistantPanel::load(workspace_handle.clone(), prompt_builder, cx.clone())
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
(None, Some(assistant2_panel))
|
Some(agent_panel)
|
||||||
} else {
|
} else {
|
||||||
let assistant_panel = assistant::AssistantPanel::load(
|
None
|
||||||
workspace_handle.clone(),
|
|
||||||
prompt_builder.clone(),
|
|
||||||
cx.clone(),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
(Some(assistant_panel), None)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
workspace_handle.update_in(cx, |workspace, window, cx| {
|
workspace_handle.update_in(cx, |workspace, window, cx| {
|
||||||
if let Some(assistant2_panel) = assistant2_panel {
|
if let Some(agent_panel) = agent_panel {
|
||||||
workspace.add_panel(assistant2_panel, window, cx);
|
workspace.add_panel(agent_panel, window, cx);
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(assistant_panel) = assistant_panel {
|
|
||||||
workspace.add_panel(assistant_panel, window, cx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register the actions that are shared between `assistant` and `assistant2`.
|
// Register the actions that are shared between `assistant` and `assistant2`.
|
||||||
@ -475,15 +463,6 @@ fn initialize_panels(
|
|||||||
workspace
|
workspace
|
||||||
.register_action(agent::AssistantPanel::toggle_focus)
|
.register_action(agent::AssistantPanel::toggle_focus)
|
||||||
.register_action(agent::InlineAssistant::inline_assist);
|
.register_action(agent::InlineAssistant::inline_assist);
|
||||||
} else {
|
|
||||||
<dyn AssistantPanelDelegate>::set_global(
|
|
||||||
Arc::new(assistant::assistant_panel::ConcreteAssistantPanelDelegate),
|
|
||||||
cx,
|
|
||||||
);
|
|
||||||
|
|
||||||
workspace
|
|
||||||
.register_action(assistant::AssistantPanel::toggle_focus)
|
|
||||||
.register_action(assistant::AssistantPanel::inline_assist);
|
|
||||||
}
|
}
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
@ -4241,10 +4220,11 @@ mod tests {
|
|||||||
web_search::init(cx);
|
web_search::init(cx);
|
||||||
web_search_providers::init(app_state.client.clone(), cx);
|
web_search_providers::init(app_state.client.clone(), cx);
|
||||||
let prompt_builder = PromptBuilder::load(app_state.fs.clone(), false, cx);
|
let prompt_builder = PromptBuilder::load(app_state.fs.clone(), false, cx);
|
||||||
assistant::init(
|
agent::init(
|
||||||
app_state.fs.clone(),
|
app_state.fs.clone(),
|
||||||
app_state.client.clone(),
|
app_state.client.clone(),
|
||||||
prompt_builder.clone(),
|
prompt_builder.clone(),
|
||||||
|
app_state.languages.clone(),
|
||||||
cx,
|
cx,
|
||||||
);
|
);
|
||||||
repl::init(app_state.fs.clone(), cx);
|
repl::init(app_state.fs.clone(), cx);
|
||||||
|
Loading…
Reference in New Issue
Block a user