fix: pass expected_domain to wrapped browser scripts
The `expected_domain` was removed from args for normalization but never re-inserted, causing JS scripts to receive empty expected_domain and report "missing_expected_domain" errors. 🤖 Generated with [Qoder][https://qoder.com]
This commit is contained in:
@@ -207,6 +207,7 @@ fn execute_browser_script_impl(
|
||||
}
|
||||
};
|
||||
eprintln!("[execute_browser_script_impl] expected_domain: {}", expected_domain);
|
||||
args.insert("expected_domain".to_string(), Value::String(expected_domain.clone()));
|
||||
|
||||
for required_arg in tool.args.keys() {
|
||||
if !args.contains_key(required_arg) {
|
||||
@@ -233,6 +234,8 @@ fn execute_browser_script_impl(
|
||||
|
||||
let wrapped_script = wrap_browser_script(&script_body, &Value::Object(args.clone()));
|
||||
eprintln!("[execute_browser_script_impl] 包装后脚本长度: {} 字节", wrapped_script.len());
|
||||
eprintln!("[execute_browser_script_impl] 包装后脚本前500字符: {}",
|
||||
if wrapped_script.len() > 500 { &wrapped_script[..500] } else { &wrapped_script });
|
||||
eprintln!("[execute_browser_script_impl] 调用 browser_tool.invoke(Action::Eval)...");
|
||||
|
||||
let target_url = format!("http://{}", expected_domain);
|
||||
|
||||
Reference in New Issue
Block a user