fix: load DeepSeek config from browser runtime

This commit is contained in:
zyl
2026-03-27 00:34:14 +08:00
parent 11c0b0fc70
commit 0e3af5a391
8 changed files with 531 additions and 52 deletions

View File

@@ -80,7 +80,8 @@ impl<T: Transport + 'static> Tool for ZeroClawBrowserTool<T> {
Ok(ToolResult {
success: result.success,
output,
error: (!result.success).then(|| "browser action returned success=false".to_string()),
error: (!result.success)
.then(|| format_browser_action_error(&result.data)),
})
}
}
@@ -145,6 +146,21 @@ fn failed_tool_result(error: String) -> ToolResult {
}
}
fn format_browser_action_error(data: &Value) -> String {
if let Some(error) = data.get("error") {
if let Some(message) = error.get("message").and_then(Value::as_str) {
return message.to_string();
}
return format!("browser action failed: {error}");
}
if data.is_null() {
return "browser action returned success=false".to_string();
}
format!("browser action failed: {data}")
}
#[derive(Debug, thiserror::Error)]
enum BrowserActionAdapterError {
#[error("unsupported action: {0}")]