diff --git a/desktop/src-tauri/src/intelligence/compactor.rs b/desktop/src-tauri/src/intelligence/compactor.rs index 6329a65..96699ac 100644 --- a/desktop/src-tauri/src/intelligence/compactor.rs +++ b/desktop/src-tauri/src/intelligence/compactor.rs @@ -306,20 +306,24 @@ impl ContextCompactor { fn extract_topic(&self, content: &str) -> Option { let trimmed = content.trim(); - // First sentence or first 50 chars + // Find sentence end markers (byte position) let sentence_end = trimmed.find(|c| c == '。' || c == '!' || c == '?' || c == '\n'); - if let Some(pos) = sentence_end { - if pos <= 80 { - return Some(trimmed[..=pos].to_string()); + if let Some(byte_pos) = sentence_end { + if byte_pos <= 80 { + // Find the char boundary after the sentence end marker + // The marker itself is a single char (1-3 bytes for Chinese) + let end_boundary = byte_pos + trimmed[byte_pos..].chars().next().map(|c| c.len_utf8()).unwrap_or(1); + return Some(trimmed[..end_boundary].to_string()); } } - if trimmed.len() <= 50 { + if trimmed.chars().count() <= 50 { return Some(trimmed.to_string()); } - Some(format!("{}...", &trimmed[..50])) + // Use chars() to safely handle UTF-8 boundaries + Some(format!("{}...", trimmed.chars().take(50).collect::())) } /// Extract key conclusions/decisions from assistant messages diff --git a/desktop/src-tauri/tauri.conf.json b/desktop/src-tauri/tauri.conf.json index ea43657..9183e74 100644 --- a/desktop/src-tauri/tauri.conf.json +++ b/desktop/src-tauri/tauri.conf.json @@ -26,13 +26,6 @@ "bundle": { "active": true, "targets": "nsis", - "useLocalToolsDir": true, - "resources": [ - "resources/openfang-runtime/" - ], - "externalBin": [ - "binaries/ov" - ], "icon": [ "icons/32x32.png", "icons/128x128.png",