Repository navigation
feat(web): 用户消息原位编辑,保存与重试平滑定位 - #1665
Conversation
- 编辑已发送的提问时,气泡原地变成输入框:盒子、字形、底色与气泡一致, 只多出输入框边框(Textarea engage="hover" + surface="brand-tint"); 下方操作行原地换成「取消」「保存」,旁边用 InfoHint 说明保存会重跑本轮 - 保存后编辑后的提问沿用原组件(渲染 key 借用),输入框直接折回气泡 - 保存与重试时本轮先保持原高度、平滑滚到固定位置,落定后再收回预留高度, 修复在页面底部保存/重试时页面一帧硬跳 - 提问正文统一走 .chat-user-text,气泡与编辑框字形一致 - packages/ui 指向 felinics/ui 的 Textarea / InfoHint 改动 Refs: MEMOH-214, MEMOH-222
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a3bc2ccb61
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| throw error | ||
| }) | ||
| // A failed start restores the old reply; put the view back with it. | ||
| if (!(result.ok || result.stage === 'stream')) rollbackPin?.() |
There was a problem hiding this comment.
Invalidate restart rollbacks after switching sessions
When a reusable preview tab is repointed to session B while session A's retry/edit is still awaiting output, a no-output failure reaches this rollback after the switch. The sessionId watcher in useChatScroll.ts:673-689 clears the pin but does not advance pinAttemptId, so armPin accepts the stale closure and restores A's saved follow mode, reserves, and scrollTop into B; the store already exercises these late-failure flows in chat-list.test.ts:2896-2916 and 3083-3109. Capture/compare the session ID or invalidate the attempt when the pane changes sessions.
AGENTS.md reference: apps/web/AGENTS.md:L330-L332
Useful? React with 👍 / 👎.
| watch([isVisible, toRef(props, 'isScrolling'), () => props.message.id], () => { | ||
| emit('active', isVisible.value, { id: props.message.id, top: ((messageEl.value?.getBoundingClientRect().top ?? 0) - 48) }) |
There was a problem hiding this comment.
Remove the prior ID from the active-anchor map
When an edit reuses this MessageItem under a replacement ID, the watcher emits an active event only for the new ID, leaving the old ID in useChatScroll's elId map. After the new row later becomes inactive, the stale old entry can remain the closest anchor; on KeepAlive activation onActivatedRestoreScroll selects it, fails to find its removed DOM node, and skips restoring a valid live anchor, so returning to the chat can lose the reading position. Emit an inactive event for the previous ID (or delete it explicitly) when the ID changes.
AGENTS.md reference: apps/web/AGENTS.md:L330-L332
Useful? React with 👍 / 👎.
- 触屏设备长按用户消息弹出复制/编辑菜单,悬停才出现的操作行在触屏上无法使用 - 保存旁直接显示"保存后会替换之后的回复",不再藏在触屏打不开的悬停提示里 - 输入法选词时 Enter/Esc 交给输入法,不再提交或取消编辑 - 更正两处已过时的注释
- 长按改用下拉菜单,贴着气泡下沿、按气泡一侧对齐弹出,不再从手指位置弹出挡住消息 - 新增 useLongPress:按住约半秒触发,移动超过 10px(开始滚动)即取消 - 保存旁恢复提示图标,去掉单独的提示小字
|
在当前 head 的本地开发环境验证时,复现了保存失败后丢失草稿的问题:
预期行为是:请求未能开始输出时,恢复旧轮次,并重新打开带有本次草稿的编辑框,让用户可以直接重试。建议补一个覆盖“编辑 → 保存失败 → 旧轮次恢复 → 草稿仍在编辑框中”的回归测试,并用真实 UI 复验。 |
…ce-user-edit # Conflicts: # packages/ui
Author
Type
Summary
问题
改动后
useUserEditDraft),不只存在消息组件里:聊天记录刷新会给消息换 id 并重建组件,之前保存失败后的那次刷新会把重新打开的编辑框和草稿一起丢掉。.chat-user-text规则(<textarea>不能按文字类型分段设字重,改由字体本身承担拉丁字母的补偿),进入编辑不改变任何字形;用户自定义 UI 字体时跟随自定义字体。@felinic/ui(Textarearest="bare"/surface="brand-tint",新组件InfoHint,触屏轻点可打开),Memoh 侧不再有自定义颜色或手写 Tooltip。packages/ui指向 feat(ui): Textarea 增加原位编辑与品牌色底选项,新增 InfoHint ui#38 合并后的 main 提交598f229。Related Issues
Validation
自动检查(agent 本地执行)
pnpm --filter @memohai/web typecheck通过;packages/ui的vue-tsc --build通过node scripts/check-ui-contract.mjs通过useChatScroll、message-item、chat-pane-send、typography四个测试文件 61 例全部通过。message-item.test.ts的@felinic/ui替身补了InfoHint(新组件,原替身里没有)ui-icon-contract×2、model-setting×2、chat-user-input-form×1)另有 2 个文件加载失败,在干净的origin/main上同样失败,与本 PR 无关。本机 Node 25 需加NODE_OPTIONS=--no-experimental-webstorage,否则 Node 自带的localStorage会遮住 jsdom 的实现浏览器实测(agent 用浏览器操作,不是 Human QA)
http://127.0.0.1:8083)连本地 OSS 开发后端;后端跑的是较旧的提交,本 PR 不改后端oklch(0 0 0 / 0.78)、深色为oklch(0.72 0.16 290);ⓘ 悬停向上弹出说明rest="bare")、ⓘ 14px 与触屏轻点打开,只跑了 typecheck 和 eslint本轮修复与复测(agent 用浏览器操作,不是 Human QA;环境:本 PR 分支 web
http://localhost:8214连本地 OSS 开发后端)pnpm --filter @memohai/web typecheck、改动文件 eslint、useChatScroll/message-item/chat-pane相关测试(47 例)通过。合并提交因 pre-commit 的 Go lint 对 main 带入的全部 Go 包超时(180s)而用--no-verify提交,Go 改动均来自 mainScreenshots / Recordings
以下截图来自较早的版本(ⓘ 为 12px,尚无长按菜单)。
浅色:编辑框聚焦(与气泡同位置、同字形)
ⓘ 向上弹出说明
保存编辑后:提问平滑停在固定位置,新回复从下方开始
页面底部点重试后:提问平滑停在同一位置
Human QA
Agent QA follow-up — 2026-10-30
本地真实浏览器验收结论:未通过完整验收,存在失败保存后丢草稿的问题。这是 Agent QA,不是 Human QA。
memoh-pr1665-qa,Webhttp://localhost:18082,Server18080,Channel18081。Server/Web 均运行本 PR head41f58f2;UI 子模块637a311,独立数据库。mimo-v2.6-pro),真实服务生成,正常流程未使用 mock 回复。chat model mimo-v2.6-pro is disabled。旧提问与旧回复恢复,但编辑框未重新打开;再次点击编辑只出现原提问,新草稿已丢失。测试后模型已重新启用。预期应恢复带草稿的编辑框。相关路径:message-item.vue的submitEdit/ 回调与chat-pane.vue的handleEditMessage/ 渲染 key 复用。useChatScroll、message-item、chat-pane-send、typography四个测试文件,共 61 例通过。Cannot read properties of undefined (reading 'global')初始化错误,本次未归因于该 PR。以下附件均为本次当前 head 的新截图;失败截图展示旧消息已恢复、错误提示出现而编辑框缺失,随后重开编辑只有旧文本。