fix: load DeepSeek config from browser runtime
This commit is contained in:
@@ -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}")]
|
||||
|
||||
Reference in New Issue
Block a user