Define semantic search action regardless of whether the feature is enabled

This commit is contained in:
Max Brunsfeld 2023-07-11 15:02:43 -07:00
parent 4a4dd39875
commit 4b3bb2c661

View file

@ -44,14 +44,7 @@ pub fn init(
language_registry: Arc<LanguageRegistry>,
cx: &mut AppContext,
) {
if *RELEASE_CHANNEL == ReleaseChannel::Stable {
return;
}
settings::register::<VectorStoreSettings>(cx);
if !settings::get::<VectorStoreSettings>(cx).enable {
return;
}
let db_file_path = EMBEDDINGS_DIR
.join(Path::new(RELEASE_CHANNEL_NAME.as_str()))
@ -60,8 +53,6 @@ pub fn init(
SemanticSearch::init(cx);
cx.add_action(
|workspace: &mut Workspace, _: &Toggle, cx: &mut ViewContext<Workspace>| {
eprintln!("semantic_search::Toggle action");
if cx.has_global::<ModelHandle<VectorStore>>() {
let vector_store = cx.global::<ModelHandle<VectorStore>>().clone();
workspace.toggle_modal(cx, |workspace, cx| {
@ -78,6 +69,12 @@ pub fn init(
},
);
if *RELEASE_CHANNEL == ReleaseChannel::Stable
|| !settings::get::<VectorStoreSettings>(cx).enable
{
return;
}
cx.spawn(move |mut cx| async move {
let vector_store = VectorStore::new(
fs,