v2 工作台:消息气泡不渲染附件条,附件与消息的归属关系在界面上消失
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 0
- Avg merge
- 1h 7m
- Merged PRs (30d)
- 969
Description
## 现象
v2 工作台的消息气泡**完全不渲染附件**。用户带附件发出一条消息后,消息旁边看不到自己发了什么文件,也没有点开预览的入口。旧屏(`chat-live-message-panel.tsx`)一直有这个能力。
## 取证(源码定位,非推断)
- 渲染附件条的组件是 `MessageAttachments`(`apps/web/components/chat/chat-composer-attachments.tsx:584`),产出 `data-testid="chat-message-attachment-"`,点击后打开 `ChatAttachmentPreviewModal`(内联 img / iframe / pptx + 下载)。
- 该组件在全仓的**唯一消费者**是旧屏:`apps/web/components/chat/chat-live-message-panel.tsx:1311`。
```
$ grep -rn "MessageAttachments" apps/web/components --include='*.tsx' | grep -v chat-composer-attachments.tsx
apps/web/components/chat/chat-live-message-panel.tsx:58: MessageAttachments,
apps/web/components/chat/chat-live-message-panel.tsx:1311:
```
- v2 的两个气泡 slot(`copilotkit-v2-assistant-message.tsx` / `copilotkit-v2-user-message.tsx`)都不渲染附件。
- 旧屏自 #2890(`d30ac48e8`)起已无可达路由(`/chat/legacy` 被 307 到 `/chat`),所以这条能力现在对用户是**彻底没有**,不是"换了个地方"。
## 用户会失去什么
1. 发完消息后无法确认这一轮到底带了哪个文件(附件从 composer 消失、气泡里也不出现)。
2. 想重看/下载自己发过的文件,只能去右栏「材料」页签——那是一个按线程聚合的列表,**丢掉了"哪条消息带的"这层归属信息**。
3. 多轮长对话里无法把文件和它所属的那一轮对上。
## 现存的部分替代
`ChatAttachmentPreviewModal` 本体在 v2 上是活的:右栏「材料」页签(`chat-task-inspector.tsx:317` → `ChatMaterialsPanel` → `chat-materials-panel.tsx:108`)点 `chat-material-` 会打开**同一个弹窗**。所以缺的是**气泡内的入口与归属信息**,不是预览能力本身。
## 相关
- issue #2997(`chat-read` 24 红的共因)。`chat-attachment-preview-download.spec.ts` 的三条用例已按人类裁决迁到材料页签入口;气泡入口那条断言**原文保留**为 `test.fixme`,见该文件。
- `chat-attachment-image-vision-extraction.spec.ts` 同样依赖这个锚点。
## 真栈实测(2026-09-08,SHA `94f6dda03`,`chat-read` 车道单跑一支临时探针)
深链 `/chat?projectId=&thread=` 上的锚点计数:
```
copilotkit-v2-input:1 copilotkit-v2-messages:1 copilotkit-v2-thread-sidebar:1
chat-message-row:0 chat-message-list:0 chat-message-input:0 chat-read-thread-list:0
chat-attachment-input:1 (composer 的「材料」入口还在)
chat-task-workbench-inspector-tab-materials:1
→ 点开「材料」页签后 chat-materials-panel:1 (预览弹窗入口在这里)
```
即:上传入口与预览弹窗都在,**消息气泡侧一个锚点都没有**。
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with apps/web/components/chat/copilotkit-v2-assistant-message.tsx and copilotkit-v2-user-message.tsx, then compare the existing MessageAttachments usage in chat-live-message-panel.tsx. Run chat-attachment-preview-download.spec.ts and chat-attachment-image-vision-extraction.spec.ts, including their attachment-anchor expectations. Done means v2 message bubbles show the attachment entry for the message and open the existing preview flow.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100