diff options
| author | 2026-02-28 09:03:19 +0800 | |
|---|---|---|
| committer | 2026-02-28 09:03:19 +0800 | |
| commit | cc53b1cf260e1c67939e50608ef18764da616d55 (patch) | |
| tree | 119109c62331d4d26612e2df7726cee82d1871f5 /src-tauri/src/core/assistant.rs | |
| parent | ee37d044e473217daadd9ce26c7e2e2ad39a0490 (diff) | |
| parent | 81a62402ef6f8900ff092366121a9b7a4263ba52 (diff) | |
| download | DropOut-cc53b1cf260e1c67939e50608ef18764da616d55.tar.gz DropOut-cc53b1cf260e1c67939e50608ef18764da616d55.zip | |
Merge remote-tracking branch 'upstream/main'
Diffstat (limited to 'src-tauri/src/core/assistant.rs')
| -rw-r--r-- | src-tauri/src/core/assistant.rs | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/src-tauri/src/core/assistant.rs b/src-tauri/src/core/assistant.rs index 9a8f7bf..5663007 100644 --- a/src-tauri/src/core/assistant.rs +++ b/src-tauri/src/core/assistant.rs @@ -4,8 +4,11 @@ use serde::{Deserialize, Serialize}; use std::collections::VecDeque; use std::sync::{Arc, Mutex}; use tauri::{Emitter, Window}; +use ts_rs::TS; -#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[serde(rename_all = "camelCase")] +#[ts(export, export_to = "assistant.ts")] pub struct Message { pub role: String, pub content: String, @@ -51,7 +54,9 @@ pub struct OllamaTagsResponse { } // Simplified model info for frontend -#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[serde(rename_all = "camelCase")] +#[ts(export, export_to = "assistant.ts")] pub struct ModelInfo { pub id: String, pub name: String, @@ -102,7 +107,9 @@ pub struct OpenAIModelsResponse { } // Streaming response structures -#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[serde(rename_all = "camelCase")] +#[ts(export, export_to = "assistant.ts")] pub struct GenerationStats { pub total_duration: u64, pub load_duration: u64, @@ -112,7 +119,9 @@ pub struct GenerationStats { pub eval_duration: u64, } -#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[serde(rename_all = "camelCase")] +#[ts(export, export_to = "assistant.ts")] pub struct StreamChunk { pub content: String, pub done: bool, @@ -223,7 +232,10 @@ impl GameAssistant { // Add language instruction if not auto if config.response_language != "auto" { - system_content = format!("{}\n\nIMPORTANT: Respond in {}. Do not include Pinyin or English translations unless explicitly requested.", system_content, config.response_language); + system_content = format!( + "{}\n\nIMPORTANT: Respond in {}. Do not include Pinyin or English translations unless explicitly requested.", + system_content, config.response_language + ); } // Add log context if available @@ -435,7 +447,10 @@ impl GameAssistant { let mut system_content = config.system_prompt.clone(); if config.response_language != "auto" { - system_content = format!("{}\n\nIMPORTANT: Respond in {}. Do not include Pinyin or English translations unless explicitly requested.", system_content, config.response_language); + system_content = format!( + "{}\n\nIMPORTANT: Respond in {}. Do not include Pinyin or English translations unless explicitly requested.", + system_content, config.response_language + ); } if !context.is_empty() { |