Support base_api in the settings

This commit is contained in:
Clément Renault 2025-05-15 18:28:02 +02:00
parent 564f85280c
commit b9716ec346
No known key found for this signature in database
GPG Key ID: F250A4C4E3AE5F5F
2 changed files with 8 additions and 10 deletions

View File

@ -186,10 +186,9 @@ async fn non_streamed_chat(
if let Some(api_key) = chat_settings.api_key.as_ref() { if let Some(api_key) = chat_settings.api_key.as_ref() {
config = config.with_api_key(api_key); config = config.with_api_key(api_key);
} }
// We cannot change the endpoint if let Some(base_api) = chat_settings.base_api.as_ref() {
// if let Some(endpoint) = chat_settings.endpoint.as_ref() { config = config.with_api_base(base_api);
// config.with_api_base(&endpoint); }
// }
let client = Client::with_config(config); let client = Client::with_config(config);
setup_search_tool(&mut chat_completion, &chat_settings.prompts); setup_search_tool(&mut chat_completion, &chat_settings.prompts);
@ -257,10 +256,9 @@ async fn streamed_chat(
if let Some(api_key) = chat_settings.api_key.as_ref() { if let Some(api_key) = chat_settings.api_key.as_ref() {
config = config.with_api_key(api_key); config = config.with_api_key(api_key);
} }
// We cannot change the endpoint if let Some(base_api) = chat_settings.base_api.as_ref() {
// if let Some(endpoint) = chat_settings.endpoint.as_ref() { config = config.with_api_base(base_api);
// config.with_api_base(&endpoint); }
// }
setup_search_tool(&mut chat_completion, &chat_settings.prompts); setup_search_tool(&mut chat_completion, &chat_settings.prompts);

View File

@ -48,7 +48,7 @@ async fn patch_settings(
#[serde(deny_unknown_fields, rename_all = "camelCase")] #[serde(deny_unknown_fields, rename_all = "camelCase")]
pub struct ChatSettings { pub struct ChatSettings {
pub source: String, pub source: String,
pub endpoint: Option<String>, pub base_api: Option<String>,
pub api_key: Option<String>, pub api_key: Option<String>,
pub prompts: ChatPrompts, pub prompts: ChatPrompts,
pub indexes: BTreeMap<String, ChatIndexSettings>, pub indexes: BTreeMap<String, ChatIndexSettings>,
@ -95,7 +95,7 @@ impl Default for ChatSettings {
fn default() -> Self { fn default() -> Self {
ChatSettings { ChatSettings {
source: "openai".to_string(), source: "openai".to_string(),
endpoint: None, base_api: None,
api_key: None, api_key: None,
prompts: ChatPrompts { prompts: ChatPrompts {
system: DEFAULT_SYSTEM_MESSAGE.to_string(), system: DEFAULT_SYSTEM_MESSAGE.to_string(),