aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src-tauri/src/core/config.rs
diff options
context:
space:
mode:
authorHsiangNianian <i@jyunko.cn>2026-01-16 14:18:04 +0800
committerHsiangNianian <i@jyunko.cn>2026-01-16 14:18:22 +0800
commit73ddf24b04bf94ee7fa76974e1af55eb94112b93 (patch)
tree421bd2e8af7e720ed5b2fb23e92601cfeecd25ad /src-tauri/src/core/config.rs
parenta38e61c30798efa3ab2231f99537828be5d5637b (diff)
downloadDropOut-73ddf24b04bf94ee7fa76974e1af55eb94112b93.tar.gz
DropOut-73ddf24b04bf94ee7fa76974e1af55eb94112b93.zip
feat: integrate AI assistant functionality and configuration management
Implemented new commands for managing the AI assistant, including health checks, chat interactions, and model listings for both Ollama and OpenAI. Enhanced the configuration system to support raw JSON editing and added a dedicated AssistantConfig structure for better management of assistant settings. This update significantly improves the user experience by providing comprehensive control over AI interactions and configurations.
Diffstat (limited to 'src-tauri/src/core/config.rs')
-rw-r--r--src-tauri/src/core/config.rs40
1 files changed, 40 insertions, 0 deletions
diff --git a/src-tauri/src/core/config.rs b/src-tauri/src/core/config.rs
index 43c8145..4c4acad 100644
--- a/src-tauri/src/core/config.rs
+++ b/src-tauri/src/core/config.rs
@@ -6,6 +6,44 @@ use tauri::{AppHandle, Manager};
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(default)]
+pub struct AssistantConfig {
+ pub enabled: bool,
+ pub llm_provider: String, // "ollama" or "openai"
+ // Ollama settings
+ pub ollama_endpoint: String,
+ pub ollama_model: String,
+ // OpenAI settings
+ pub openai_api_key: Option<String>,
+ pub openai_endpoint: String,
+ pub openai_model: String,
+ // Common settings
+ pub system_prompt: String,
+ pub response_language: String,
+ // TTS settings
+ pub tts_enabled: bool,
+ pub tts_provider: String, // "disabled", "piper", "edge"
+}
+
+impl Default for AssistantConfig {
+ fn default() -> Self {
+ Self {
+ enabled: true,
+ llm_provider: "ollama".to_string(),
+ ollama_endpoint: "http://localhost:11434".to_string(),
+ ollama_model: "llama3".to_string(),
+ openai_api_key: None,
+ openai_endpoint: "https://api.openai.com/v1".to_string(),
+ openai_model: "gpt-3.5-turbo".to_string(),
+ system_prompt: "You are a helpful Minecraft expert assistant. You help players with game issues, mod installation, performance optimization, and gameplay tips. Analyze any game logs provided and give concise, actionable advice.".to_string(),
+ response_language: "auto".to_string(),
+ tts_enabled: false,
+ tts_provider: "disabled".to_string(),
+ }
+ }
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(default)]
pub struct LauncherConfig {
pub min_memory: u32, // in MB
pub max_memory: u32, // in MB
@@ -20,6 +58,7 @@ pub struct LauncherConfig {
pub theme: String,
pub log_upload_service: String, // "paste.rs" or "pastebin.com"
pub pastebin_api_key: Option<String>,
+ pub assistant: AssistantConfig,
}
impl Default for LauncherConfig {
@@ -38,6 +77,7 @@ impl Default for LauncherConfig {
theme: "dark".to_string(),
log_upload_service: "paste.rs".to_string(),
pastebin_api_key: None,
+ assistant: AssistantConfig::default(),
}
}
}