36 lines
935 B
Rust
36 lines
935 B
Rust
// crates/nazarick/src/config.rs
|
|
|
|
use std::collections::HashMap;
|
|
use serde::Deserialize;
|
|
use crate::chat::types::AgentChatConfig;
|
|
|
|
#[derive(Debug, Deserialize)]
|
|
pub struct NazarickConfig {
|
|
pub chat: ChatConfig,
|
|
pub models: HashMap<String, ModelConfig>,
|
|
}
|
|
|
|
#[derive(Debug, Deserialize, Clone)]
|
|
pub struct ModelConfig {
|
|
pub provider: String,
|
|
pub url: String,
|
|
pub model: String,
|
|
pub api_key: Option<String>,
|
|
pub max_summary_tokens: Option<usize>,
|
|
/// "tool_use" | "xml" — default xml wenn nicht gesetzt
|
|
pub skill_format: Option<String>,
|
|
}
|
|
|
|
#[derive(Debug, Deserialize)]
|
|
pub struct ChatConfig {
|
|
pub listen_port: u16,
|
|
pub admin_user_id: u64,
|
|
pub admin_webhook_url: String,
|
|
pub agents: Vec<AgentChatConfig>,
|
|
}
|
|
|
|
pub fn load() -> anyhow::Result<NazarickConfig> {
|
|
let content = std::fs::read_to_string("config/config.toml")?;
|
|
let config = toml::from_str(&content)?;
|
|
Ok(config)
|
|
} |