From ac903f84b41b843aca31e6650244f5f500111e01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=99=B4=E5=A4=A9?= Date: Thu, 26 Mar 2026 06:36:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B1=89=E5=8C=96=E7=89=88=E6=A3=80?= =?UTF-8?q?=E6=B5=8B=E5=85=9C=E5=BA=95=E2=80=94=E2=80=94=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=B7=E5=90=AB=20-zh=20=E6=97=B6=E5=BC=BA=E5=88=B6=E5=88=A4?= =?UTF-8?q?=E5=AE=9A=E4=B8=BA=E6=B1=89=E5=8C=96=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rust get_version_info + Web dev-api.js get_version_info: 如果检测到的版本号包含 "-zh" 后缀,直接覆盖 source 为 "chinese", 不再依赖文件系统路径检测(Windows .cmd shim 路径不含包名信息) --- scripts/dev-api.js | 4 +++- src-tauri/src/commands/config.rs | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/dev-api.js b/scripts/dev-api.js index 62b9f32..5f6aff8 100644 --- a/scripts/dev-api.js +++ b/scripts/dev-api.js @@ -2983,8 +2983,10 @@ const handlers = { // 版本信息 async get_version_info() { - const source = detectInstalledSource() + let source = detectInstalledSource() const current = getLocalOpenclawVersion() + // 兜底:版本号含 -zh 则一定是汉化版 + if (current && current.includes('-zh') && source !== 'chinese') source = 'chinese' const latest = await getLatestVersionFor(source) const recommended = recommendedVersionFor(source) diff --git a/src-tauri/src/commands/config.rs b/src-tauri/src/commands/config.rs index cf0168c..2eb6a8e 100644 --- a/src-tauri/src/commands/config.rs +++ b/src-tauri/src/commands/config.rs @@ -1390,7 +1390,13 @@ fn detect_installed_source() -> String { #[tauri::command] pub async fn get_version_info() -> Result { let current = get_local_version().await; - let source = detect_installed_source(); + let mut source = detect_installed_source(); + // 兜底:版本号含 -zh 则一定是汉化版(文件系统检测可能误判) + if let Some(ref ver) = current { + if ver.contains("-zh") && source != "chinese" { + source = "chinese".to_string(); + } + } let latest = get_latest_version_for(&source).await; let recommended = recommended_version_for(&source); let update_available = match (¤t, &recommended) {