mirror of
https://github.com/qingchencloud/clawpanel.git
synced 2026-06-09 17:50:00 +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"])
|
.args(["agents", "list", "--json"])
|
||||||
.output()
|
.output()
|
||||||
.await
|
.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() {
|
if !output.status.success() {
|
||||||
return Err("获取 Agent 列表失败".into());
|
return Err("获取 Agent 列表失败".into());
|
||||||
|
|||||||
Reference in New Issue
Block a user