diff --git a/desktop/main.js b/desktop/main.js index 902f750..93abc3b 100644 --- a/desktop/main.js +++ b/desktop/main.js @@ -477,6 +477,28 @@ 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 10d7a87..5dc339e 100644 --- a/desktop/preload.js +++ b/desktop/preload.js @@ -58,3 +58,8 @@ 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 c826976..ca797e1 100644 --- a/frontend/css/components.css +++ b/frontend/css/components.css @@ -2561,6 +2561,18 @@ 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 { diff --git a/frontend/index.html b/frontend/index.html index 6f43d58..0382dc4 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -47,7 +47,7 @@ - + @@ -69,7 +69,7 @@ - + @@ -1743,7 +1743,12 @@