mirror of
https://github.com/qingchencloud/clawpanel.git
synced 2026-05-28 03:40:09 +08:00
修复:记忆文件页面 openclaw 找不到时的友好错误提示
memory.rs 的 agent_workspace() 也调用 openclaw CLI, 同样需要处理 NotFound 错误,显示中文提示而非 os error 2
This commit is contained in:
@@ -20,7 +20,13 @@ async fn agent_workspace(agent_id: &str) -> Result<PathBuf, String> {
|
||||
.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());
|
||||
|
||||
Reference in New Issue
Block a user