Skip to content

implement Nova chat attachments on the web side #1004

Open
ishaanxgupta wants to merge 12 commits into
mainfrom
ishaan/attach
Open

implement Nova chat attachments on the web side #1004
ishaanxgupta wants to merge 12 commits into
mainfrom
ishaan/attach

Conversation

@ishaanxgupta
Copy link
Copy Markdown
Contributor

@ishaanxgupta ishaanxgupta commented May 25, 2026

  • Added attachment draft/shared types and validation in components/chat/attachments.ts.
  • Added paperclip upload UI to Nova composer with file chips, size/status, remove, retry, and per-file Save / Chat only toggle.
  • Wired uploads before send to /chat/attachments, then sends returned attachment references in chat message metadata.
  • Preserved attachment metadata when loading threads and rendered attachment chips on user messages.
  • Added attachment support from the home composer into the full chat view.
  • Extended chat analytics with attachment counts.
image image image
  • ensured responsiveness

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 25, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
supermemory-mcp 5aad18e Jun 03 2026, 03:37 PM

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 25, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
supermemory-app 5aad18e Commit Preview URL

Branch Preview URL
Jun 03 2026, 03:38 PM

Remove unused useEffect dependencies (fallbackChatId, threadId) and apply
Biome formatting to chat attachment files.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@ishaanxgupta ishaanxgupta marked this pull request as ready for review May 26, 2026 16:50
@graphite-app graphite-app Bot requested a review from Dhravya May 26, 2026 16:50
@claude
Copy link
Copy Markdown

claude Bot commented May 26, 2026

Claude finished @ishaanxgupta's task in 3m 46s —— View job


PR Review Complete

  • Fetch PR diff and existing review comments
  • Analyze changed files for bugs and security issues
  • Submit review findings

Overview: Implements chat attachment functionality with file uploads, draft state management, save-to-memory toggle, and attachment rendering in messages.

Issues found:

Bug: Attachments from home composer never upload (apps/web/components/chat/index.tsx:745-747)

When attachments arrive via queuedAttachments prop from the home composer, they have status: "queued". The check at line 745-747 causes an early return, preventing the upload at line 755 from ever running:

const hasBusy = drafts.some(
  (d) => d.status === "uploading" || d.status === "queued",
)
if (hasBusy) return false

The user ends up with attachment chips stuck showing file size (queued state) with no way to trigger uploads — the retry button only appears for "error" status.

Reproduction:

  1. Add file in home composer
  2. Click send
  3. Chat opens, attachment shows but never uploads
  4. Cannot send — canSendMessage is false while attachments are queued

Suggested fix: Either:

  • Start uploads when setting attachmentDrafts from queuedAttachments (add upload calls in the effect at line 1203), OR
  • Change the check to only block on "uploading" (not "queued") and let queued drafts proceed to the upload call at line 755

Fix this →


What looks good:

  • File validation checks size (50MB limit) and type before accepting
  • Each attachment draft tracks its own upload state (queued → uploading → uploaded/error), enabling granular retry
  • uploadAttachmentDraft correctly skips already-uploaded drafts on retry
  • Error handling preserves draft state so users can retry or remove individual failures
  • React's automatic text escaping prevents XSS in filename rendering
  • Object URLs are properly cleaned up in useEffect return to prevent memory leaks
  • Abort controllers cancel in-flight uploads when attachments are removed
  • File cache uses IndexedDB with graceful fallback on storage errors

Score: 8/10

The implementation is solid for the main flow (adding files directly in chat), but the home-composer-to-chat path has a blocking bug that prevents attachments from uploading.

Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overview: Implements chat attachment functionality with file uploads, draft state management, save-to-memory toggle, and attachment rendering in messages.

Issues found: None — this looks good to ship.

The implementation is solid:

  • File validation checks size (50MB limit) and type before accepting
  • Each attachment draft tracks its own upload state (queued → uploading → uploaded/error), enabling granular retry
  • uploadAttachmentDraft correctly skips already-uploaded drafts on retry
  • State is only cleared on full success (both uploads and sendMessage complete)
  • Error handling preserves draft state so users can retry or remove individual failures
  • React's automatic text escaping prevents XSS in filename rendering
  • The canSend logic correctly blocks sending when uploads are in progress or have errors

Score: 9/10

Minor observations (not blocking):

  • Attachments upload sequentially rather than in parallel — likely intentional for server load control
  • handleRetryAttachment captures currentChatId at callback creation time, so if a user switches threads before clicking retry, the attachment uploads to the new thread. Edge case, but worth noting.

Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overview: Implements chat attachment functionality with file uploads, draft state management, save-to-memory toggle, and attachment rendering in messages.

Issues found: None — this looks good to ship.

The implementation is solid:

  • File validation checks size (50MB limit) and type before accepting
  • Each attachment draft tracks its own upload state (queued → uploading → uploaded/error), enabling granular retry
  • uploadAttachmentDraft correctly skips already-uploaded drafts on retry
  • State is only cleared on full success (both uploads and sendMessage complete)
  • Error handling preserves draft state so users can retry or remove individual failures
  • React's automatic text escaping prevents XSS in filename rendering
  • The canSend logic correctly blocks sending when uploads are in progress or have errors
  • Object URLs are properly cleaned up in useEffect return to prevent memory leaks

Score: 9/10

Minor observations (not blocking):

  • Attachments upload sequentially rather than in parallel — likely intentional for server load control
  • handleRetryAttachment captures currentChatId at callback creation time, so if a user switches threads before clicking retry, the attachment uploads to the new thread. Edge case, but worth noting.

Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overview: Implements chat attachment functionality with file uploads, draft state management, save-to-memory toggle, and attachment rendering in messages.

Issues found: None — this looks good to ship.

The implementation is solid:

  • File validation checks size (50MB limit) and type before accepting
  • Each attachment draft tracks its own upload state (queued → uploading → uploaded/error), enabling granular retry
  • uploadAttachmentDraft correctly skips already-uploaded drafts on retry
  • State is only cleared on full success (both uploads and sendMessage complete)
  • Error handling preserves draft state so users can retry or remove individual failures
  • React's automatic text escaping prevents XSS in filename rendering
  • The canSend logic correctly blocks sending when uploads are in progress or have errors
  • Object URLs are properly cleaned up in useEffect return to prevent memory leaks

Score: 9/10

Minor observations (not blocking):

  • Attachments upload sequentially rather than in parallel — likely intentional for server load control
  • handleRetryAttachment captures currentChatId at callback creation time, so if a user switches threads before clicking retry, the attachment uploads to the new thread. Edge case, but worth noting.

- Format Dialog import on single line
- Remove redundant onClick from div (button inside already handles preview)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@ved015 ved015 changed the title implement Nova chat attachments on the web side [DON'T MERGE] implement Nova chat attachments on the web side [DON'T MERGE] May 28, 2026
@ishaanxgupta ishaanxgupta changed the title [DON'T MERGE] implement Nova chat attachments on the web side [DON'T MERGE] implement Nova chat attachments on the web side Jun 1, 2026
ishaanxgupta and others added 5 commits June 1, 2026 14:18
Fixes formatting issues in user-message.tsx, index.tsx, and file-cache.ts.
Removes unused useCallback import from pdf.tsx.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

2 participants