Expose a well defined set of sources

This commit is contained in:
Clément Renault 2025-05-22 10:42:36 +02:00 committed by Kerollmops
parent 1e67a47a8f
commit bf3286ba41
No known key found for this signature in database
GPG Key ID: F250A4C4E3AE5F5F

View File

@ -68,11 +68,17 @@ async fn patch_settings(
Ok(HttpResponse::Ok().finish())
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(deny_unknown_fields, rename_all = "camelCase")]
pub enum ChatSource {
OpenAi,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(deny_unknown_fields, rename_all = "camelCase")]
pub struct GlobalChatSettings {
#[serde(default, skip_serializing_if = "Setting::is_not_set")]
pub source: Setting<String>,
pub source: Setting<ChatSource>,
#[serde(default, skip_serializing_if = "Setting::is_not_set")]
pub base_api: Setting<String>,
#[serde(default, skip_serializing_if = "Setting::is_not_set")]
@ -146,7 +152,7 @@ Selecting the right index ensures the most relevant results for the user query";
impl Default for GlobalChatSettings {
fn default() -> Self {
GlobalChatSettings {
source: Setting::Set("openAi".to_string()),
source: Setting::NotSet,
base_api: Setting::NotSet,
api_key: Setting::NotSet,
prompts: Setting::Set(ChatPrompts::default()),