vector_store_settings.rs

 1use anyhow;
 2use schemars::JsonSchema;
 3use serde::{Deserialize, Serialize};
 4use settings::Setting;
 5
 6#[derive(Deserialize, Debug)]
 7pub struct VectorStoreSettings {
 8    pub enable: bool,
 9    pub reindexing_delay_seconds: usize,
10    pub embedding_batch_size: usize,
11}
12
13#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug)]
14pub struct VectorStoreSettingsContent {
15    pub enable: Option<bool>,
16    pub reindexing_delay_seconds: Option<usize>,
17    pub embedding_batch_size: Option<usize>,
18}
19
20impl Setting for VectorStoreSettings {
21    const KEY: Option<&'static str> = Some("vector_store");
22
23    type FileContent = VectorStoreSettingsContent;
24
25    fn load(
26        default_value: &Self::FileContent,
27        user_values: &[&Self::FileContent],
28        _: &gpui::AppContext,
29    ) -> anyhow::Result<Self> {
30        Self::load_via_json_merge(default_value, user_values)
31    }
32}