From e5de543c740af5afa2dec9e5d6a61b5d1cc3d10e Mon Sep 17 00:00:00 2001 From: chenyida7-prog Date: Wed, 26 Aug 2026 19:44:53 +0800 Subject: [PATCH] =?UTF-8?q?chore(frontend):=20=E7=A7=BB=E9=99=A4=20Enchant?= =?UTF-8?q?e=20Agent=20=E7=9A=84=E4=BD=BF=E7=94=A8=E6=89=8B=E5=86=8C?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=EF=BC=8C=E5=8F=AA=E7=95=99=E7=BA=AF=E6=96=87?= =?UTF-8?q?=E5=AD=97=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 不打包手册了,彻底去掉之前那个占位用的本机微信文件路径 (file:///Users/chenyida/Library/Containers/com.tencent.xinWeChat/...), 避免正式包里残留任何本机路径依赖。 设置页 Agent 分组行 + 引导页结论页,Enchante 的 Agent 项现在都只剩「参考使用 手册」/「配置 Agent 参考使用手册」纯文字,不带任何链接、不带开关。 清理范围: - frontend/js/store.js:删掉 openEnchanteAgentManual() - frontend/index.html:两处都去掉 - frontend/css/components.css:删掉现在没人用的 .ai-platform-row__manual-link - desktop/main.js:删掉 open-manual IPC handler + MANUAL_PATH 常量 - desktop/preload.js:删掉 __mykOpenManual__ 桥 isEnchanteAgentManual() 判定保留(还要用来渲染置灰开关 + 对应文案), Enchante 的 MCP deeplink 完全没动。 测试:只跑改动直接覆盖的精准测试(不含全局前端/浏览器套件): pytest tests/frontend/test_stage3.py::TestStage3StaticStructure # 17 passed pytest tests/frontend/test_stage3.py::TestStage3Build # 1 passed 同步更新了 TestStage3Browser 里对应断言(本地未跑,留给 review/CI)。 node --check 过了 main.js/preload.js/store.js,frontend/build.py 重新打包也过了。 --- desktop/main.js | 22 ---------------------- desktop/preload.js | 5 ----- frontend/css/components.css | 13 ------------- frontend/index.html | 13 ++++--------- frontend/js/store.js | 21 ++------------------- tests/frontend/test_stage3.py | 22 +++++++++++++--------- 6 files changed, 19 insertions(+), 77 deletions(-) diff --git a/desktop/main.js b/desktop/main.js index 93abc3b..902f750 100644 --- a/desktop/main.js +++ b/desktop/main.js @@ -477,28 +477,6 @@ app.whenReady().then(async () => { } }); - // ── 使用手册系统级打开(IPC)────────────────────────────── - // Enchante 的 Agent deeplink 在真机验证不可靠(2026-08-26),改为引导用户看使用 - // 手册。手册是本地文件,open-external 专门 block 了 file: 前缀(避免渲染层任意打 - // 开本地文件/命令),所以走独立的、路径由主进程硬编码(渲染层不传路径)的 IPC 通 - // 道,用 shell.openPath 交给系统默认程序(.html → 默认浏览器)打开。 - // - // TODO(分发前替换):MANUAL_PATH 目前是本机开发路径占位,正式版应改为打包进 app - // 资源目录的手册文件(如 path.join(process.resourcesPath, "docs", "MyKnowledge使用手册.html")), - // 并把手册一并加入 electron-builder 的 extraResources / build-backend datas。 - const MANUAL_PATH = - "/Users/chenyida/Library/Containers/com.tencent.xinWeChat/Data/Documents/xwechat_files/wxid_6qcy1jhgv90312_a764/msg/file/2026-08/MyKnowledge使用手册3_2.html"; - ipcMain.handle("open-manual", async () => { - try { - const err = await shell.openPath(MANUAL_PATH); - // shell.openPath 失败时返回非空错误字符串(不像 openExternal 那样 reject) - if (err) return { ok: false, error: err }; - return { ok: true }; - } catch (err) { - return { ok: false, error: String(err) }; - } - }); - try { if (DEV_BACKEND_URL) { // 开发模式:直接连开发者后端 diff --git a/desktop/preload.js b/desktop/preload.js index 5dc339e..10d7a87 100644 --- a/desktop/preload.js +++ b/desktop/preload.js @@ -58,8 +58,3 @@ contextBridge.exposeInMainWorld("__mykOnCloseChoice__", (payload) => { contextBridge.exposeInMainWorld("__mykOpenExternal__", (url) => { return ipcRenderer.invoke("open-external", url); }); - -// 使用手册系统级打开(本地文件,路径由主进程硬编码,渲染层不传参,避免任意路径注入) -contextBridge.exposeInMainWorld("__mykOpenManual__", () => { - return ipcRenderer.invoke("open-manual"); -}); diff --git a/frontend/css/components.css b/frontend/css/components.css index ca797e1..aeeba51 100644 --- a/frontend/css/components.css +++ b/frontend/css/components.css @@ -2561,19 +2561,6 @@ color: var(--text-secondary); font-style: italic; } -/* Enchante Agent「参考使用手册」行内链接:与置灰状态文字同级,不额外抢视觉焦点 */ -.ai-platform-row__manual-link { - margin-left: 6px; - font-size: 12px; - color: var(--accent); - text-decoration: underline; - text-underline-offset: 2px; - cursor: pointer; -} -.ai-platform-row__manual-link:hover { - color: var(--accent-hover, var(--accent)); -} - /* ── 连接态(MCP 卡平台行右,平台级四态:not_connected/connected/inactive/lost;置灰仅 !installed) ── */ .ai-platform-row__connection { display: inline-flex; diff --git a/frontend/index.html b/frontend/index.html index 0382dc4..758057d 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -47,7 +47,7 @@ - + @@ -69,7 +69,7 @@ - + @@ -1759,8 +1759,6 @@ : ($store.app.deeplinkClickedFor('mcp') ? 'MCP 已生成 · 可再次点击' : '⚡ 生成 MCP 链接')"> 配置 Agent 参考使用手册 - 查看手册 请先安装 Enchanté @@ -2037,11 +2035,8 @@

? ($store.app.clientStatus(plat.key, kind.key) ? '请在安装 ' + plat.label + ' 后使用' : '请先安装 ' + plat.label) : ($store.app.clientStatus(plat.key, kind.key) ? '已配置' : ($store.app.usesDeeplink(plat.key, kind.key) ? '生成专属链接' : '未配置 · 点击开关开启'))"> - - 查看手册 +