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 enabled: bool,
 9    pub reindexing_delay_seconds: usize,
10}
11
12#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug)]
13pub struct VectorStoreSettingsContent {
14    pub enabled: Option<bool>,
15    pub reindexing_delay_seconds: Option<usize>,
16}
17
18impl Setting for VectorStoreSettings {
19    const KEY: Option<&'static str> = Some("vector_store");
20
21    type FileContent = VectorStoreSettingsContent;
22
23    fn load(
24        default_value: &Self::FileContent,
25        user_values: &[&Self::FileContent],
26        _: &gpui::AppContext,
27    ) -> anyhow::Result<Self> {
28        Self::load_via_json_merge(default_value, user_values)
29    }
30}