41 lines
1.0 KiB
Rust
41 lines
1.0 KiB
Rust
|
|
use serde::{Deserialize, Serialize};
|
||
|
|
use std::path::PathBuf;
|
||
|
|
use std::sync::{Arc, Mutex};
|
||
|
|
|
||
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||
|
|
pub struct ProviderConfig {
|
||
|
|
pub name: String,
|
||
|
|
pub api_url: String,
|
||
|
|
pub api_key: String,
|
||
|
|
pub model: String,
|
||
|
|
}
|
||
|
|
|
||
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||
|
|
pub struct AppSettings {
|
||
|
|
pub theme: String,
|
||
|
|
pub ai_providers: Vec<ProviderConfig>,
|
||
|
|
pub active_provider: Option<String>,
|
||
|
|
pub default_provider: String,
|
||
|
|
pub default_model: String,
|
||
|
|
pub ollama_url: String,
|
||
|
|
}
|
||
|
|
|
||
|
|
impl Default for AppSettings {
|
||
|
|
fn default() -> Self {
|
||
|
|
AppSettings {
|
||
|
|
theme: "dark".to_string(),
|
||
|
|
ai_providers: vec![],
|
||
|
|
active_provider: None,
|
||
|
|
default_provider: "ollama".to_string(),
|
||
|
|
default_model: "llama3.2:3b".to_string(),
|
||
|
|
ollama_url: "http://localhost:11434".to_string(),
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
pub struct AppState {
|
||
|
|
pub db: Arc<Mutex<rusqlite::Connection>>,
|
||
|
|
pub settings: Arc<Mutex<AppSettings>>,
|
||
|
|
pub app_data_dir: PathBuf,
|
||
|
|
}
|