diff --git a/src-tauri/src/commands/config.rs b/src-tauri/src/commands/config.rs index f7f92be..398c84d 100644 --- a/src-tauri/src/commands/config.rs +++ b/src-tauri/src/commands/config.rs @@ -4191,6 +4191,10 @@ async fn uninstall_openclaw_inner( } let _ = app.emit("upgrade-progress", 100); + // #Compat-4: 卸载后刷缓存,否则 is_cli_installed(60s TTL)/ enhanced_path + // 仍是旧快照,UI 会在 60 秒内继续显示「CLI 已安装」或 Gateway 还在运行。 + super::refresh_enhanced_path(); + crate::commands::service::invalidate_cli_detection_cache(); let msg = if clean_config { "✅ OpenClaw 已完全卸载(包括配置文件)" } else { diff --git a/src/lib/tauri-api.js b/src/lib/tauri-api.js index ae33de9..80aefdc 100644 --- a/src/lib/tauri-api.js +++ b/src/lib/tauri-api.js @@ -210,10 +210,18 @@ export const api = { doctorCheck: () => invoke('doctor_check'), doctorFix: () => invoke('doctor_fix'), listOpenclawVersions: (source = 'chinese') => invoke('list_openclaw_versions', { source }), - upgradeOpenclaw: (source = 'chinese', version = null, method = 'auto') => invoke('upgrade_openclaw', { source, version, method }), - uninstallOpenclaw: (cleanConfig = false) => invoke('uninstall_openclaw', { cleanConfig }), - installGateway: () => invoke('install_gateway'), - uninstallGateway: () => invoke('uninstall_gateway'), + // #Compat-4: 升级/卸载后 CLI 路径/版本/服务状态都可能变,一次性清掉相关前端缓存; + // Rust 端已经在命令内部调用 refresh_enhanced_path + invalidate_cli_detection_cache。 + upgradeOpenclaw: (source = 'chinese', version = null, method = 'auto') => { + invalidate('check_installation', 'check_node', 'check_git', 'get_services_status', 'get_status_summary', 'get_version_info') + return invoke('upgrade_openclaw', { source, version, method }) + }, + uninstallOpenclaw: (cleanConfig = false) => { + invalidate('check_installation', 'check_node', 'check_git', 'get_services_status', 'get_status_summary', 'get_version_info') + return invoke('uninstall_openclaw', { cleanConfig }) + }, + installGateway: () => { invalidate('get_services_status', 'get_status_summary'); return invoke('install_gateway') }, + uninstallGateway: () => { invalidate('get_services_status', 'get_status_summary'); return invoke('uninstall_gateway') }, getNpmRegistry: () => cachedInvoke('get_npm_registry', {}, 30000), setNpmRegistry: (registry) => { invalidate('get_npm_registry'); return invoke('set_npm_registry', { registry }) }, testModel: (baseUrl, apiKey, modelId, apiType = null) => invoke('test_model', { baseUrl, apiKey, modelId, apiType }),