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}")]

View File

@@ -15,7 +15,8 @@ use zeroclaw::providers::traits::{
};
use crate::compat::browser_tool_adapter::{ZeroClawBrowserTool, BROWSER_ACTION_TOOL_NAME};
use crate::compat::config_adapter::build_zeroclaw_config;
use crate::compat::config_adapter::build_zeroclaw_config_from_settings;
use crate::config::DeepSeekSettings;
use crate::compat::event_bridge::log_entry_for_turn_event;
use crate::compat::memory_adapter::build_memory;
use crate::pipe::{BrowserPipeTool, PipeError, Transport};
@@ -25,9 +26,9 @@ pub fn execute_task<T: Transport + 'static>(
browser_tool: BrowserPipeTool<T>,
instruction: &str,
workspace_root: &Path,
settings: &DeepSeekSettings,
) -> Result<String, PipeError> {
let config = build_zeroclaw_config(workspace_root)
.map_err(|err| PipeError::Protocol(err.to_string()))?;
let config = build_zeroclaw_config_from_settings(workspace_root, settings);
let provider = build_provider(&config)?;
let runtime = tokio::runtime::Runtime::new()
.map_err(|err| PipeError::Protocol(format!("failed to create tokio runtime: {err}")))?;