Files
gitks/config/embedaiprovider.rs
T
2026-06-07 11:30:56 +08:00

28 lines
834 B
Rust

use crate::config::AppConfig;
use crate::error::AppResult;
impl AppConfig {
pub fn embed_ai_provider_api_key(&self) -> AppResult<Option<String>> {
self.get_env::<String>("APP_EMBED_AI_PROVIDER_API_KEY")
}
pub fn embed_ai_provider_url(&self) -> AppResult<Option<String>> {
self.get_env::<String>("APP_EMBED_AI_PROVIDER_URL")
}
pub fn embed_ai_provider_model(&self) -> AppResult<String> {
self.get_env_or(
"APP_EMBED_AI_PROVIDER_MODEL",
"text-embedding-3-small".to_string(),
)
}
pub fn embed_ai_provider_dimensions(&self) -> AppResult<u32> {
self.get_env_or("APP_EMBED_AI_PROVIDER_DIMENSIONS", 1536)
}
pub fn embed_ai_provider_timeout(&self) -> AppResult<u64> {
self.get_env_or("APP_EMBED_AI_PROVIDER_TIMEOUT", 30)
}
}