Skip to content

fix(thread-chat): 文档工具时序轨迹 + 结果卡对齐 Artifact 视觉 + gate-3 演示 - #158

Open
hifizz wants to merge 5 commits into
feat-project-panelfrom
fix/document-trace-ux
Open

hifizz wants to merge 5 commits into
feat-project-panelfrom
fix/document-trace-ux

Conversation

@hifizz

@hifizz hifizz commented Sep 16, 2026

Copy link
Copy Markdown
Owner

Summary

修复文档工具调用的展示问题(#155 后续反馈),并把结果卡统一到 Artifact 视觉语言,附 gate-3 演示。

1. 工具调用流程展示(commit 1)

此前 find/read/update 三个文档工具 part 各自渲染为无图标的裸文本状态行,update 结果卡片突兀出现,看不出"查找→读取→思考→提交"的关联与时序。

  • assistant-part-render-plan.ts:连续的文档工具 part 合并为一个 document 渲染项(documents[]),被 reasoning 等分隔的调用拆为独立块,保持真实时序。
  • thinking-trace.tsx:新增 DocumentTrace——复用 ThinkingState,每行按工具类型给图标(find=search / read=book-open / update=file-pen)、进行中 spinner、失败警示色;折叠态标题汇总各步结果。
  • ThinkingStateRow.icon 扩展 "file-pen"(lucide FilePenLine)。

2. 修订版本 artifact 落到 action toolbar 下方(commit 1)

updateProjectDocument 每次提交都写入一条修订版本 artifact(sourceMessageId = 本条消息),但气泡后的 MessageArtifacts 兜底区只排除 createMarkdownArtifact 的产出,导致更新产物重复出现。现在 committed 更新的 artifactId 同样被排除——详情由结果卡片承载。

3. 结果卡对齐 .acard 视觉语言 + 中间结果抑制(commit 2)

  • document-update-tool.tsx 重写:committed → 可点击 .acard(缩略图 + 文档标题 + 「已更新到 V{n}」+ 变更摘要 + 「查看差异」,整卡打开版本视图,支持 fc-* 深度配色);unchanged / conflict / rejected / output-error → 同形态静态收据,未保存类走 acard-failed 警示配色,不再向用户暴露原始 errorText
  • anchored-assistant-body.tsx:同文档被后续提交覆盖的中间未保存结果不再出卡(只留在轨迹行),避免「未保存」与最终成功卡并存;未落定消息中进行中提交计入后续尝试,落定后只认终态尝试。
  • DocumentTrace 行内信息补全:find 显示「找到『标题』/未找到/N 份候选」,read 标注 V{n} · 非最新,update 执行中露出 changeSummary、完成显示「已保存 N 处修改」。
  • markdown-artifact-card.tsx 导出 ArtifactThumbartifact-card.css 新增 .acard .s 摘要行(两行截断)。

4. Gate 3 harness 文档演示(commit 2)

  • mock-v1-runtime.ts:seed 一份 5 版本演示文档 + 6 组覆盖全部终态的演示对话;新增 6 个 document-* 场景(成功保存 / 冲突重试 / 无需修改 / 版本冲突 / 修改被拒 / 保存报错),fetchStream 按节奏逐 chunk 发 tool-input-availabletool-output-*,轨迹行可见真实 spinner 推进;commit/retry/conflict 场景真实写新版本(含并发提交模拟),版本号持续递增;bootstrap/listDocuments/getDocumentHistory 接入文档目录。
  • normalized-harness.tsx:场景下拉新增 6 项。

访问:/thread-chat-gate-3-harness/{uuid}(dev only)。

Test plan

  • pnpm typecheck
  • e2e/thread-chat/ui-message-parts-rendering.test.mjs / message-artifacts.test.mjs / normalized-client-store.test.mjs / normalized-stream-session.test.mjs
  • 真实会话实测:V2/V3 提交成功卡、冲突行标红、查看差异打开版本视图、no-op 不重复写
  • harness 实测:加载即见 6 组终态演示;「文档·冲突重试」流式走到 V7 且冲突中间态被抑制;「文档·保存报错」出通用失败卡

注:chat-tool-set.test.mjs 在干净 main 上已失败(route 工具集新增 webSearch,断言未更新),与本次改动无关。仓库另有既有 lint 报错 lib/axiom/server.ts(prefer-const),不在本 diff。

Generated with Devin

hifizz and others added 4 commits September 16, 2026 19:05
fix: 修复 Markdown Artifact 划选提问瞬闪与高亮缺失
两个展示层问题:

1. 文档工具调用以裸文本状态行散落正文流("找到 N 份候选文档"无图标、
   无关联感),update 结果卡片突兀出现。现在连续的
   find/read/update part 合并为一个 ThinkingState 时序块,每行带
   步骤图标(search/book-open/file-pen)、运行中 spinner、失败警示色;
   折叠标题汇总各步结果("找到 1 份候选文档 · 已读取「X」V1 · 已保存
   修改")。update 提交完成后仍渲染 DocumentUpdateTool 结果卡片,
   保留"查看本次版本与差异"入口。被思考/reasoning 分隔的调用拆为
   独立块,保持真实时序。

2. updateProjectDocument 每次提交都写入一条修订版本 artifact
   (sourceMessageId = 本条消息),但气泡后的 MessageArtifacts 兜底
   区只排除 createMarkdownArtifact 产出的 artifact,导致更新产物
   在 action toolbar 下方重复出现一张下载卡片。现在 committed 更新
   的 artifactId 同样被排除——详情由结果卡片承载。

ThinkingState Row.icon 扩展 "file-pen"(FilePenLine)供提交行使用。

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@vercel

vercel Bot commented Sep 16, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
thread-chatbot Error Error Sep 18, 2026 3:03pm UTC

@coderabbitai

coderabbitai Bot commented Sep 16, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 22730aad-1a30-4d57-8272-1506e691f68d


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@hifizz
hifizz changed the base branch from main to feat-project-panel September 16, 2026 12:15
展示层:
- updateProjectDocument 终态改为与正文 artifact 一致的 .acard 卡片:
  committed 可点击(文档标题 + 已更新到 V{n} + 变更摘要 + 查看差异);
  unchanged/conflict/rejected/output-error 为静态收据,失败态走
  acard-failed 警示配色,不再向用户暴露 errorText。
- 同文档被后续提交覆盖的中间未保存结果不再出卡(只留在时序轨迹行),
  避免「未保存」与最终成功卡并存造成误读;未落定消息中进行中的提交
  计入后续尝试,落定后只认终态尝试。
- DocumentTrace 轨迹行补全结果摘要:找到标题/候选数、非最新标记、
  update 执行中显示 changeSummary、完成后显示已保存处数。
- markdown-artifact-card 导出 ArtifactThumb 供结果卡复用;
  artifact-card.css 增加 .s 变更摘要行样式。

Gate 3 harness:
- seed 一份 5 版本演示文档 + 6 组覆盖全部终态(committed / 冲突重试 /
  unchanged / 终态 conflict / rejected / output-error)的演示对话;
- 场景下拉新增 6 个 document-* 场景,流式逐 chunk 演示轨迹推进,
  committed/retry/conflict 真实写新版本(版本号持续递增);
- bootstrap/listDocuments/getDocumentHistory 接入文档目录。

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@hifizz hifizz changed the title fix(thread-chat): 文档工具时序轨迹 + 修订版本 artifact 不再落到气泡底部 fix(thread-chat): 文档工具时序轨迹 + 结果卡对齐 Artifact 视觉 + gate-3 演示 Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant