MoonshotAI / MoonshotAI/kimi-code
Web: media preview panel shows "0 B" for uploaded image attachments
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 7.5k
- Forks
- 1.2k
- Avg merge
- 11h 53m
- Merged PRs (30d)
- 350
Description
Bug
In the web UI, clicking an image attachment in a user message opens the preview panel with 0 B as the file size, and the fallback title is "ReadMediaFile image" even though the media is a user upload, not a tool result.
Root cause
ChatPane.userAttachmentMedia() builds the ToolMedia for the preview with no bytes field (a TurnAttachment for image/video carries no size). In v2 sessions the image is rehydrated from the agent blob store as a bare data: URL with no size metadata either, so openMediaPreview falls back to size: 0 (useFilePreview.ts) and the header renders "0 B". The same fallback produces the misleading "ReadMediaFile image" label when the media has no path.
Expected
The preview header shows the real byte size, and a generic Image/Video label for unnamed uploads.
Where
apps/kimi-web/src/components/chat/ChatPane.vue(userAttachmentMedia)apps/kimi-web/src/composables/useFilePreview.ts(openMediaPreview)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read userAttachmentMedia in apps/kimi-web/src/components/chat/ChatPane.vue and openMediaPreview in apps/kimi-web/src/composables/useFilePreview.ts, then trace the image and video attachment data for both regular and v2 sessions. Verify the preview header reports the uploaded byte size and uses generic Image/Video labels when no path is available.
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
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100