Skip to content

feat(thread-chat): support text, code, and image attachments - #83

Merged
hifizz merged 10 commits into
mainfrom
feat-attachments-input
Sep 4, 2026
Merged

feat(thread-chat): support text, code, and image attachments#83
hifizz merged 10 commits into
mainfrom
feat-attachments-input

Conversation

@hifizz

@hifizz hifizz commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Summary

This PR delivers the first production-ready slice of the attachment roadmap tracked in #82.

  • upload attachments directly from the browser to private R2 through presigned URLs
  • persist stable /api/attachments/{id} references instead of base64, R2 keys, or expiring URLs
  • support pasted text plus common plaintext/source extensions, including Markdown, JavaScript/TypeScript, JSON, HTML/XML/SVG source, stylesheets, shell scripts, and other common languages
  • normalize source files to safe UTF-8 text/plain, preserve filenames/content/whitespace, and reject invalid UTF-8 during ingest
  • inject text attachments into model context under the shared character budget
  • support PNG/JPEG/WebP input for explicitly verified vision models and reject unsupported image sends before paid generation
  • constrain message image thumbnails to 288px and open images in an in-app lightbox
  • render non-image attachments as file cards instead of bare links
  • preview text/code attachments through the authenticated same-origin /api/attachments/{id}/content endpoint, with skeleton, empty, error/retry, and download states
  • force explicit downloads with Content-Disposition: attachment
  • preserve sent attachments after refresh and across edit/retry flows
  • record the accepted attachment workflow and UI preferences in project Command Code taste

Verified models

  • DeepSeek V4 Flash: reads text/code attachments; image input is rejected
  • Ark Kimi K2.6: image input verified
  • AIBerm Claude Opus 5: image input verified with Anthropic and OpenAI-compatible request formats
  • OpenRouter GPT-5.6 Sol: provider metadata confirms image support; end-to-end verification remains blocked by missing account credits

Attachment limits

  • at most 5 images per message
  • 10 MB per image
  • 2048px longest edge
  • oversized JPEG/WebP images become WebP at 80% quality
  • oversized PNG images remain lossless PNG
  • smaller images are not enlarged or recompressed

Validation

  • pnpm typecheck
  • node --import tsx e2e/thread-chat/text-attachment-slice.test.mjs
  • node --import tsx e2e/thread-chat/image-attachment-slice.test.mjs
  • node --import tsx e2e/thread-chat/ui-message-parts-rendering.test.mjs
  • pnpm test:thread-chat:gate2-pipeline
  • pnpm test:thread-chat:gate3-client
  • pnpm lint — 0 errors, 2 pre-existing warnings
  • pnpm build
  • manual acceptance: constrained image thumbnails, image lightbox, file cards, Markdown/code preview, skeleton loading state, and explicit download

Not included

  • PDF attachment support in the Thread Chat composer or OCR
  • CSV/Excel/PPT parsing
  • ZIP/video parsing
  • attachment-only messages
  • upload retry in place
  • unsent draft persistence
  • abandoned/orphan attachment cleanup
  • query-based retrieval for long text and multiple files

Tracking

Part of #82. This PR intentionally does not close the tracking issue.

hifizz and others added 2 commits September 3, 2026 19:06
Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
Connect composer attachments to R2 uploads, persisted message parts, and model context compilation. Add explicit vision capability checks, image preprocessing limits, and attachment pipeline tests.

Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
@coderabbitai

coderabbitai Bot commented Sep 4, 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: Team

Run ID: 98d4b9a3-6758-4c7f-876e-a5c874c2730f


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.

@vercel

vercel Bot commented Sep 4, 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 4, 2026 5:04pm UTC

Resolve Thread Chat project list and style-token changes while preserving attachment upload, model context, and retry behavior.

Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
Track the long-lived issue workflow for incremental PRs and allow project Command Code taste files to remain versioned.

Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
Support common text and source-code extensions as safe UTF-8 attachments. Add constrained image previews, file cards, authenticated in-app text previews, and explicit attachment downloads.

Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
@hifizz hifizz changed the title feat(thread-chat): support text and image attachment input feat(thread-chat): support text, code, and image attachments Sep 4, 2026
Update the evaluation contract expectation to match the ten explicitly declared smoke cases.

Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
Align the smoke count and committed CI, scheduled, and release fixture baselines with the current explicit evaluation manifests.

Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
@hifizz

hifizz commented Sep 4, 2026

Copy link
Copy Markdown
Owner Author

最新检查状态:

  • deterministic 已在提交 a1d69dc 转绿;同时显式刷新了 ci/scheduled/release fixture baselines,并在本地通过完整 eval-loop 与 CI baseline comparison。
  • Vercel 仍失败,但失败发生在 vercel-builddrizzle-kit migrate 阶段,尚未进入 next build
  • 本 PR 没有数据库 schema 或 migration 改动,本地 pnpm build 已通过。
  • Vercel 连续三次日志均停在共享数据库迁移,需要单独检查预览环境数据库连接/迁移执行状态;未通过跳过迁移或修改部署流水线规避。

Move upload and image preprocessing into the shared attachments domain and reduce repeated composer attachment state updates.

Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
hifizz and others added 2 commits September 5, 2026 00:46
Mark every UMAPIS model as supporting image input and cover the full model list in the attachment regression test.

Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
Keep pasted and voice-transcribed text at or below 4,000 characters in the composer, while preserving attachment upload for longer content.

Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
@hifizz
hifizz merged commit ae4dded into main Sep 4, 2026
4 of 5 checks passed
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