feat: add document file upload support for spec creation and project expansion#227
Merged
leonvanzyl merged 1 commit intomasterfrom Mar 25, 2026
Merged
feat: add document file upload support for spec creation and project expansion#227leonvanzyl merged 1 commit intomasterfrom
leonvanzyl merged 1 commit intomasterfrom
Conversation
…expansion Add support for uploading Markdown, Text, Word (.docx), CSV, Excel (.xlsx), PDF, and PowerPoint (.pptx) files in addition to existing JPEG/PNG image uploads in the spec creation and project expansion chat interfaces. Backend changes: - New server/utils/document_extraction.py: in-memory text extraction for all document formats using python-docx, openpyxl, PyPDF2, python-pptx (no disk persistence) - Rename ImageAttachment to FileAttachment across schemas, routers, and chat session services - Add build_attachment_content_blocks() helper in chat_constants.py to route images as image content blocks and documents as extracted text blocks - Separate size limits: 5MB for images, 20MB for documents - Handle extraction errors (corrupt files, encrypted PDFs) gracefully Frontend changes: - Widen accepted MIME types and file extensions in both chat components - Add resolveMimeType() fallback for browsers that don't set MIME on .md files - Document attachments display with FileText icon instead of image thumbnail - ChatMessage renders documents as compact pills with filename and size - Update help text from "attach images" to "attach files" Dependencies added: python-docx, openpyxl, PyPDF2, python-pptx Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ImageAttachmenttoFileAttachmentacross the full stack (backend schemas, routers, services, frontend types, hooks, components)Changes
Backend:
server/utils/document_extraction.py— in-memory text extraction usingpython-docx,openpyxl,PyPDF2,python-pptxbuild_attachment_content_blocks()helper inchat_constants.pyto dispatch images vs documentsFrontend:
resolveMimeType()for browsers that don't set MIME on.mdfilesFileTexticon instead of image thumbnailChatMessagerenders documents as compact pills with filename and sizeTest plan
ruff check .passespython test_security.pypasses (169 tests)npm run lintpasses (0 errors)npm run buildpasses🤖 Generated with Claude Code