This commit is contained in:
Joe 2025-08-26 13:06:06 -04:00 committed by GitHub
commit f5445b7716
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 3789 additions and 0 deletions

View file

@ -10,10 +10,12 @@ use settings::{Settings, SettingsSources};
use crate::provider::{
self,
anthropic::AnthropicSettings,
anthropic_vertex::AnthropicVertexSettings,
bedrock::AmazonBedrockSettings,
cloud::{self, ZedDotDevSettings},
deepseek::DeepSeekSettings,
google::GoogleSettings,
google_vertex::GoogleVertexSettings,
lmstudio::LmStudioSettings,
mistral::MistralSettings,
ollama::OllamaSettings,
@ -35,6 +37,8 @@ pub struct AllLanguageModelSettings {
pub bedrock: AmazonBedrockSettings,
pub deepseek: DeepSeekSettings,
pub google: GoogleSettings,
pub google_vertex: GoogleVertexSettings,
pub anthropic_vertex: AnthropicVertexSettings,
pub lmstudio: LmStudioSettings,
pub mistral: MistralSettings,
pub ollama: OllamaSettings,
@ -52,6 +56,8 @@ pub struct AllLanguageModelSettingsContent {
pub bedrock: Option<AmazonBedrockSettingsContent>,
pub deepseek: Option<DeepseekSettingsContent>,
pub google: Option<GoogleSettingsContent>,
pub google_vertex: Option<GoogleVertexSettingsContent>,
pub anthropic_vertex: Option<AnthropicVertexSettingsContent>,
pub lmstudio: Option<LmStudioSettingsContent>,
pub mistral: Option<MistralSettingsContent>,
pub ollama: Option<OllamaSettingsContent>,
@ -127,6 +133,22 @@ pub struct GoogleSettingsContent {
pub available_models: Option<Vec<provider::google::AvailableModel>>,
}
#[derive(Default, Clone, Debug, Serialize, Deserialize, PartialEq, JsonSchema)]
pub struct GoogleVertexSettingsContent {
pub api_url: Option<String>,
pub project_id: Option<String>, // ADDED
pub location_id: Option<String>, // ADDED
pub available_models: Option<Vec<provider::google_vertex::AvailableModel>>,
}
#[derive(Default, Clone, Debug, Serialize, Deserialize, PartialEq, JsonSchema)]
pub struct AnthropicVertexSettingsContent {
pub api_url: Option<String>,
pub project_id: Option<String>, // ADDED
pub location_id: Option<String>, // ADDED
pub available_models: Option<Vec<provider::anthropic_vertex::AvailableModel>>,
}
#[derive(Default, Clone, Debug, Serialize, Deserialize, PartialEq, JsonSchema)]
pub struct XAiSettingsContent {
pub api_url: Option<String>,
@ -316,6 +338,49 @@ impl settings::Settings for AllLanguageModelSettings {
.as_ref()
.and_then(|s| s.available_models.clone()),
);
// Google Vertex AI
merge(
&mut settings.google_vertex.api_url,
value.google_vertex.as_ref().and_then(|s| s.api_url.clone()),
);
merge(
&mut settings.google_vertex.project_id,
value
.google_vertex
.as_ref()
.and_then(|s| s.project_id.clone()),
);
merge(
&mut settings.google_vertex.location_id,
value
.google_vertex
.as_ref()
.and_then(|s| s.location_id.clone()),
);
// Anthropic Vertex AI
merge(
&mut settings.anthropic_vertex.api_url,
value
.anthropic_vertex
.as_ref()
.and_then(|s| s.api_url.clone()),
);
merge(
&mut settings.anthropic_vertex.project_id,
value
.anthropic_vertex
.as_ref()
.and_then(|s| s.project_id.clone()),
);
merge(
&mut settings.anthropic_vertex.location_id,
value
.anthropic_vertex
.as_ref()
.and_then(|s| s.location_id.clone()),
);
}
Ok(settings)