Repository navigation
Conversation
BigPizzaV3
requested changes
Oct 16, 2026
BigPizzaV3
left a comment
Owner
There was a problem hiding this comment.
复审当前 head f07b2b88:后端协议/默认关闭/密钥遮蔽8项Rust回归、原提示词增强前端流程及设置/导航测试通过,当前双平台CI也通过。仍有一个确认写回边界需要修改。
[P2] 替换前重新检查当前草稿是否已经出现文件或技能节点。
位置:assets/inject/renderer-inject/93-prompt-enhance.js:103-104。
target.rich 只记录点击增强时的结构,确认替换时又只比较 textBetween() 得到的纯文本。生成期间用户把普通文字 @App.tsx 转成同样显示为 @App.tsx 的真实文件引用节点时,当前文档已是 rich,但文本仍与原稿一致,这两个检查都会放行。随后 replaceWith(0, end, nodes) 会删除用户刚加入的文件引用及其关联元数据,与“生成期间改稿、含 @文件时不允许整段替换”的约定不符。
使用本 PR 的 ProseMirror fixture 已复现:开始时纯文本,生成期间变为 mention 节点(label 不变);读取结果 rich=true、text 与 original 相同,apply("replace", ...) 实际返回 true,并执行了整段替换。仅在独立测试提取的源码中增加“当前 read.rich”检查后,该回归通过,未修改生产源码。
请在确认写回时重新读取并检查当前文档结构,必要时比较文档结构或事务版本;仅比较投影后的文本无法保护文件、技能、附件等非文本状态。补生成期间新增/转换引用节点的回归。
请修复后补上该真实结构变化回归,并对新 head 重跑前端、协议及双平台 CI。
This branch has not been deployed
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.
功能
新增提示词增强:读取 Codex 输入框里的草稿,调用模型优化后显示在可编辑的预览框中。用户点「替换」或「插入到末尾」才写回输入框;点「取消」或按 Esc 时输入框不变。
改动
promptEnhance设置,默认关闭,受enhancementsEnabled总开关控制。连接默认沿用下一步建议的 Base URL、API Key、协议和模型,也可单独配置;改写规则和超时(5–300 秒,默认 60 秒)可自定义。管理器 Codex 增强页新增「提示词增强」标签,保存后无需重启 Codex。93-prompt-enhance.js,复用语音输入的输入框定位逻辑,开关关闭时不挂载 DOM。写回 ProseMirror 用一次事务完成,可 Ctrl+Z 撤销;textarea 通过原型 setter 写入并派发input。prompt_enhance.rs与/prompt-enhance/generate路由,复用stepwise.rs的协议工具(相关函数改为pub(crate)),支持 Chat Completions、Responses、Anthropic Messages 和自动回退。API Key 不下发到页面,错误信息中会遮蔽 Key。以下情况不允许整段替换,只能插入到末尾或复制:草稿含 @文件、技能、附件等非文本节点;生成期间草稿被修改;输入框或会话已变化(此时插入也会被拒绝)。
验证
基于上游
42feefdd,Windows 本地隔离 worktree:cargo test --workspace --no-fail-fast:2371 passed,20 项既有 ignored。npm test:625 passed,1 项既有 skipped;npm run check、npm run vite:build、cargo check --workspace、renderer 组装与git diff --check通过。cargo fmt --all --check被上游既有格式差异阻断,新增代码已按 rustfmt 格式化。未在真实 Codex 桌面端点击验证,未请求真实模型服务,也未做 macOS/Linux 原生运行验证。