use serde::{Deserialize, Serialize}; use std::collections::HashMap; use std::path::PathBuf; use std::sync::{Arc, Mutex}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ProviderConfig { pub name: String, #[serde(default)] pub provider_type: String, pub api_url: String, pub api_key: String, pub model: String, /// Optional: Maximum tokens for response #[serde(skip_serializing_if = "Option::is_none")] pub max_tokens: Option, /// Optional: Temperature (0.0-2.0) - controls randomness #[serde(skip_serializing_if = "Option::is_none")] pub temperature: Option, /// Optional: Custom endpoint path (e.g., "" for no path, "/v1/chat" for custom path) /// If None, defaults to "/chat/completions" for OpenAI compatibility #[serde(skip_serializing_if = "Option::is_none")] pub custom_endpoint_path: Option, /// Optional: Custom auth header name (e.g., "x-msi-genai-api-key") /// If None, defaults to "Authorization" #[serde(skip_serializing_if = "Option::is_none")] pub custom_auth_header: Option, /// Optional: Custom auth value prefix (e.g., "" for no prefix, "Bearer " for OpenAI) /// If None, defaults to "Bearer " #[serde(skip_serializing_if = "Option::is_none")] pub custom_auth_prefix: Option, /// Optional: API format ("openai" or "custom_rest") /// If None, defaults to "openai" #[serde(skip_serializing_if = "Option::is_none")] pub api_format: Option, /// Optional: Session ID for stateful custom REST APIs #[serde(skip_serializing_if = "Option::is_none")] pub session_id: Option, /// Optional: User ID for custom REST API cost tracking (CORE ID email) #[serde(skip_serializing_if = "Option::is_none")] pub user_id: Option, } #[derive(Debug, Clone, Serialize, Deserialize)] pub struct AppSettings { pub theme: String, pub ai_providers: Vec, pub active_provider: Option, 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>, pub settings: Arc>, pub app_data_dir: PathBuf, /// Track open integration webview windows by service name -> window label /// These windows stay open for the user to browse and for fresh cookie extraction pub integration_webviews: Arc>>, }