Files
appks/config/channelaiprovider.rs
2026-06-07 11:30:56 +08:00

33 lines
1.1 KiB
Rust

use crate::config::AppConfig;
use crate::error::AppResult;
impl AppConfig {
pub fn channel_ai_provider_api_key(&self) -> AppResult<Option<String>> {
self.get_env::<String>("APP_CHANNEL_AI_PROVIDER_API_KEY")
}
pub fn channel_ai_provider_url(&self) -> AppResult<Option<String>> {
self.get_env::<String>("APP_CHANNEL_AI_PROVIDER_URL")
}
pub fn channel_ai_provider_model(&self) -> AppResult<String> {
self.get_env_or("APP_CHANNEL_AI_PROVIDER_MODEL", "gpt-4o".to_string())
}
pub fn channel_ai_provider_temperature(&self) -> AppResult<f64> {
self.get_env_or("APP_CHANNEL_AI_PROVIDER_TEMPERATURE", 0.7)
}
pub fn channel_ai_provider_max_tokens(&self) -> AppResult<u32> {
self.get_env_or("APP_CHANNEL_AI_PROVIDER_MAX_TOKENS", 4096)
}
pub fn channel_ai_provider_top_p(&self) -> AppResult<f64> {
self.get_env_or("APP_CHANNEL_AI_PROVIDER_TOP_P", 1.0)
}
pub fn channel_ai_provider_timeout(&self) -> AppResult<u64> {
self.get_env_or("APP_CHANNEL_AI_PROVIDER_TIMEOUT", 60)
}
}