feat: init

This commit is contained in:
zhenyi
2026-06-07 11:30:56 +08:00
commit 563381c1ca
361 changed files with 41327 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
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)
}
}