feat(frontend): Enchante Agent 改为置灰开关 + 参考使用手册链接,停用 agent deeplink - #4
Merged
Conversation
Enchante 的 Agent deeplink(enchante://agent/install)在真机上验证不可靠 (即便 PR #3 补上了缺失的顶层 name 字段,deeplink 本身对 Enchanté 版本/环境的 依赖仍不稳定),改为引导用户直接看使用手册,避免继续给一个不可靠的安装入口。 改动范围仅 Enchante + agent 这一格: - 设置弹窗 Agent 分组、首次引导 2.2 结论页,Enchante 那一行都改成不可点的置灰 开关(视觉与 Hooks 分组里 Enchante 那行「平台原生不支持」的置灰渲染一致), 描述文字改为「参考使用手册」,旁边加一个「查看手册」链接。 - store.js: usesDeeplink() 收窄为仅 Enchante+MCP;新增 isEnchanteAgentManual() 判定 + openEnchanteAgentManual() 打开手册。 - desktop/main.js + preload.js: 新增独立的 open-manual IPC 通道,用 shell.openPath 打开手册文件。没有复用 open-external,因为那个通道专门 block 了 file: 前缀(避免渲染层任意打开本地文件/命令);手册路径由主进程硬编码, 渲染层不传参,同样是为了不给渲染层传任意本地路径的口子。 TODO(分发前必须替换,已在代码里标注):MANUAL_PATH 目前是本机开发路径占位, 正式版应指向打包进 app 资源目录的手册文件,并加入 electron-builder 的 extraResources / build-backend datas。 Enchante 的 MCP deeplink、其它平台的 Agent 配置均未改动。 测试:只跑了改动直接影响的静态结构测试(不含全局前端/浏览器测试套件): pytest tests/frontend/test_stage3.py::TestStage3StaticStructure # 16 passed pytest tests/frontend/test_stage3.py::TestStage3Build # 1 passed(对新 build 的 standalone 断言) 同时更新了这两类测试里跟 Agent deeplink 按钮相关的断言(按钮已移除、改为手册引导), 以及一个受影响的浏览器测试(TestStage3Browser,未在本地跑,留给 review/CI)。
真机测试反馈:引导页 2.2 结论页里 Enchante 那行只看到开关,看不到「参考使用 手册」文字。根因是文案 span 复用了 .guide-conclusion-row__action(flex:1), 跟同一行「需手动安装」那个 flex:1 元素抢空间,把新文案挤没了——只是 HTML 里 有这段文字,实际渲染不出来,静态文本断言测不出这类布局问题。 改法:去掉那个不可点的置灰开关(本身没有信息量,纯粹会让人以为能点),文案 换成独立的「配置 Agent 参考使用手册」,不复用会抢 flex 的类。设置页 Agent 分组 那处(置灰开关 + 「参考使用手册」)不受影响,本来就没有这个问题,未改动。 测试:仅跑改动直接覆盖的精准测试(不含全局前端/浏览器套件): pytest tests/frontend/test_stage3.py::TestStage3StaticStructure # 17 passed pytest tests/frontend/test_stage3.py::TestStage3Build # 1 passed 同步更新了 TestStage3Browser 里对应的断言(本地未跑,留给 review/CI)。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
Enchante 的 Agent deeplink(
enchante://agent/install)在真机上验证不可靠——即便 PR #3 补上了缺失的顶层name字段,deeplink 本身对 Enchanté 版本/环境的依赖仍不稳定。这个 PR 先停用这个不可靠的入口,改成引导用户直接看使用手册,避免继续给用户一个经常不生效的按钮。改动范围只有 Enchante + Agent 这一格,其它平台、Enchante 的 MCP deeplink 均未改动。
改动内容
两处 UI(视觉与 Hooks 分组里 Enchante 那行「平台原生不支持」的置灰渲染完全一致):
具体改法:
代码层面:
frontend/js/store.js:usesDeeplink()收窄为仅 Enchante+MCP;新增isEnchanteAgentManual()判定 +openEnchanteAgentManual()frontend/index.html:设置 modal 的 agent 分组模板 + guide-modal 2.2 结论页模板,各自加了 Enchante+Agent 的特殊分支frontend/css/components.css:新增.ai-platform-row__manual-link样式desktop/main.js+desktop/preload.js:新增独立的open-manualIPC 通道,用shell.openPath打开手册文件——没有复用现有的open-external通道,因为那个通道专门 block 了file:前缀(注释写的是"避免渲染层任意打开本地文件/命令");手册路径改由主进程硬编码、渲染层不传参,同样是不想给渲染层传任意本地路径的口子desktop/main.js里的MANUAL_PATH现在是我本机的微信文件路径占位(/Users/chenyida/Library/Containers/com.tencent.xinWeChat/...),代码里已经标了 TODO。分发前必须换成打包进 app 资源目录的手册文件路径,并把手册加入electron-builder的extraResources/build-backend.sh的 datas,否则装到别人机器上这个链接必然打不开。测试
按 mentor 的要求,只跑了改动直接影响的精准测试,没跑全局前端/浏览器测试套件:
同时更新了这两类测试里跟 Agent deeplink 按钮相关的断言(按钮已移除,改为手册引导文案 + 链接),以及
TestStage3Browser里一处相关的浏览器测试断言(Playwright,本地没跑,留给 review/CI 验证)。node --check过了main.js/preload.js/store.js,frontend/build.py重新打包 standalone 也过了。