From 0fe43d67df9677fa2d51a96ddb579bf19c8d3c9a Mon Sep 17 00:00:00 2001 From: doubao Date: Wed, 14 Oct 2026 17:38:06 +0800 Subject: [PATCH] =?UTF-8?q?AI=20=E7=95=8C=E9=9D=A2=EF=BC=9A=E6=94=AF?= =?UTF-8?q?=E6=8C=81=20JS=20+=20=E9=A1=B5=E9=9D=A2=E9=93=BE=E6=8E=A5?= =?UTF-8?q?=E5=8F=AF=E7=82=B9=E8=BF=9B=E5=8E=BB=20(v2.0.36)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 用户要求:"弹出的网页可再点进去。支持js"。 ## JS 开了 `javaScriptEnabled = true`。模型可以在 show_ui 的 HTML 里写 +""" + +print("=== 弹「桥可见性测试」页面 ===") +res = call("/api/tools/run", { + "name": "show_ui", + "args": {"title": "桥测试", "html": HTML}, + "conversationId": "c_main", +}) +print(json.dumps(res, ensure_ascii=False)[:200]) +print(""" +接下来手动做(脚本没法点屏幕): + 1. 截图 —— 应显示 "typeof Doubao = object | pick 可用: true" + 2. 点链接导航到 example.com + 3. 点顶部返回键回到我们那一页 + 4. 再截图 —— 回来之后应该**还是 object**(onPageFinished 里重新挂上了) +""") diff --git a/scripts/probe-show-ui-js.py b/scripts/probe-show-ui-js.py new file mode 100644 index 0000000..59fd301 --- /dev/null +++ b/scripts/probe-show-ui-js.py @@ -0,0 +1,84 @@ +"""测 JS 支持和"点进去"。 + +一段同时用这两个能力的页面: + · +""" + +print("=== 弹一个用 JS + 带链接的界面 ===") +res = call("/api/tools/run", { + "name": "show_ui", + "args": {"title": "JS 测试", "html": HTML}, + "conversationId": CONV, +}) +print(json.dumps(res, ensure_ascii=False)[:300]) diff --git a/scripts/verify-ai-webview.py b/scripts/verify-ai-webview.py new file mode 100644 index 0000000..56bac7d --- /dev/null +++ b/scripts/verify-ai-webview.py @@ -0,0 +1,167 @@ +"""守 AI 界面 WebView 的几条硬性质。 + +这个文件的**时序**我改了三版才对,每一版都对应一个只能实测发现的坑, +所以必须用脚本钉住 —— 光看代码看不出"桥什么时候挂上"。 + +改过的三版(记在这儿,别再走回头路): + + 第一版:`loadDataWithBaseURL` 之前 add 桥,导航到 http(s) 时 remove。 + **问题**:外部页面在 `onPageStarted` 摘桥之前有个"已经开始加载、 + 桥还在"的窗口期。 + + 第二版:只在 `onPageFinished` 里判 url 是不是 `about:blank` 才 add。 + **问题**:实测页面报 `Uncaught ReferenceError: Doubao is not defined` + —— `onPageFinished` 的回调**比页面内联