From 1b7c61e5aff40203ea5a40cfd8c9d7209726e810 Mon Sep 17 00:00:00 2001 From: xintaofei Date: Thu, 26 Mar 2026 22:37:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96agent=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src-tauri/src/commands/acp.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src-tauri/src/commands/acp.rs b/src-tauri/src/commands/acp.rs index 21b389b..72d71a4 100644 --- a/src-tauri/src/commands/acp.rs +++ b/src-tauri/src/commands/acp.rs @@ -1256,11 +1256,9 @@ pub async fn acp_list_agents( let meta = registry::get_agent_meta(agent_type); let (available, dist_type, local_installed_version) = match &meta.distribution { registry::AgentDistribution::Npx { .. } => { - // Detect NPX agent version dynamically, fall back to DB value - let detected = detect_local_version(agent_type).await.or_else(|| { - setting.and_then(|m| m.installed_version.clone()) - }); - (true, "npx", detected) + // Use DB cached version for fast loading; updated during install/upgrade + let cached = setting.and_then(|m| m.installed_version.clone()); + (true, "npx", cached) } registry::AgentDistribution::Binary { platforms, cmd, .. } => { let detected = binary_cache::detect_installed_version(agent_type, cmd) @@ -1303,13 +1301,15 @@ pub async fn acp_list_agents( } } let sort_order = setting.map(|m| m.sort_order).unwrap_or(idx as i32); - // Persist detected version to DB for both binary and npx agents - let _ = agent_setting_service::set_installed_version( - &db.conn, - agent_type, - local_installed_version.clone(), - ) - .await; + // Persist detected version to DB for binary agents (npx written during install/upgrade) + if dist_type == "binary" { + let _ = agent_setting_service::set_installed_version( + &db.conn, + agent_type, + local_installed_version.clone(), + ) + .await; + } let codex_auth_json = if agent_type == AgentType::Codex { load_codex_auth_json_raw() } else {