assistant: Fix panic when using /project
(#20733)
This PR fixes a panic when using `/project` (which is staff-flagged). We weren't initializing the `SemanticDb` global if the `project-slash-command` feature flag was enabled. Closes #20563. Release Notes: - N/A
This commit is contained in:
parent
3420ebb428
commit
c491b75e07
1 changed files with 25 additions and 15 deletions
|
@ -18,6 +18,7 @@ mod terminal_inline_assistant;
|
||||||
mod tool_working_set;
|
mod tool_working_set;
|
||||||
mod tools;
|
mod tools;
|
||||||
|
|
||||||
|
use crate::slash_command::project_command::ProjectSlashCommandFeatureFlag;
|
||||||
pub use crate::slash_command_working_set::{SlashCommandId, SlashCommandWorkingSet};
|
pub use crate::slash_command_working_set::{SlashCommandId, SlashCommandWorkingSet};
|
||||||
pub use crate::tool_working_set::{ToolId, ToolWorkingSet};
|
pub use crate::tool_working_set::{ToolId, ToolWorkingSet};
|
||||||
pub use assistant_panel::{AssistantPanel, AssistantPanelEvent};
|
pub use assistant_panel::{AssistantPanel, AssistantPanelEvent};
|
||||||
|
@ -215,10 +216,20 @@ pub fn init(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if cx.has_flag::<SearchSlashCommandFeatureFlag>() {
|
|
||||||
cx.spawn(|mut cx| {
|
cx.spawn(|mut cx| {
|
||||||
let client = client.clone();
|
let client = client.clone();
|
||||||
async move {
|
async move {
|
||||||
|
let is_search_slash_command_enabled = cx
|
||||||
|
.update(|cx| cx.wait_for_flag::<SearchSlashCommandFeatureFlag>())?
|
||||||
|
.await;
|
||||||
|
let is_project_slash_command_enabled = cx
|
||||||
|
.update(|cx| cx.wait_for_flag::<ProjectSlashCommandFeatureFlag>())?
|
||||||
|
.await;
|
||||||
|
|
||||||
|
if !is_search_slash_command_enabled && !is_project_slash_command_enabled {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
let embedding_provider = CloudEmbeddingProvider::new(client.clone());
|
let embedding_provider = CloudEmbeddingProvider::new(client.clone());
|
||||||
let semantic_index = SemanticDb::new(
|
let semantic_index = SemanticDb::new(
|
||||||
paths::embeddings_dir().join("semantic-index-db.0.mdb"),
|
paths::embeddings_dir().join("semantic-index-db.0.mdb"),
|
||||||
|
@ -231,7 +242,6 @@ pub fn init(
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.detach();
|
.detach();
|
||||||
}
|
|
||||||
|
|
||||||
context_store::init(&client.clone().into());
|
context_store::init(&client.clone().into());
|
||||||
prompt_library::init(cx);
|
prompt_library::init(cx);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue