From e99479fbebba9cc54da35f661fdf0eecb676deba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=99=B4=E5=A4=A9?= Date: Thu, 5 Mar 2026 23:20:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E8=AE=B0=E5=BF=86?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E9=A1=B5=E9=9D=A2=20openclaw=20=E6=89=BE?= =?UTF-8?q?=E4=B8=8D=E5=88=B0=E6=97=B6=E7=9A=84=E5=8F=8B=E5=A5=BD=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit memory.rs 的 agent_workspace() 也调用 openclaw CLI, 同样需要处理 NotFound 错误,显示中文提示而非 os error 2 --- src-tauri/src/commands/memory.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src-tauri/src/commands/memory.rs b/src-tauri/src/commands/memory.rs index dc46bf1..837fa8f 100644 --- a/src-tauri/src/commands/memory.rs +++ b/src-tauri/src/commands/memory.rs @@ -20,7 +20,13 @@ async fn agent_workspace(agent_id: &str) -> Result { .args(["agents", "list", "--json"]) .output() .await - .map_err(|e| format!("执行 openclaw 失败: {e}"))?; + .map_err(|e| { + if e.kind() == std::io::ErrorKind::NotFound { + "OpenClaw CLI 未找到,请确认已安装并重启 ClawPanel。\n如果使用 nvm 安装,请从终端启动 ClawPanel。".to_string() + } else { + format!("执行 openclaw 失败: {e}") + } + })?; if !output.status.success() { return Err("获取 Agent 列表失败".into());