feat: implement unified resource gallery and industrial-grade attachm…#28
Open
muhammad-bassiouni wants to merge 4 commits intoownpilot:mainfrom
Open
Conversation
…ent infrastructure
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.
1. Unified Attachment & Resource Architecture
The Issue (Original State)
Originally, the platform's attachment system was limited strictly to image uploads via
ChatInput.tsx. There was no infrastructure for handling general file types (PDFs, text files, etc.), and resources injected by AI tools (context) were not visually rendered as first-class objects in the chat interface.The Fix Applied (Final Update)
ChatInput.tsxfrom an image-only input to a generic file system. Added anUploadicon and multi-format preview cards for all file types.MessageList.tsxusingResourceCardcomponents with type-specific Lucide icons. This gallery merges both user-uploaded files and AI-injected context into a single, professional visual stack.pathandsizemetadata, ensuring resources are correctly identified and rendered across the monorepo.Files Changed
packages/ui/src/components/ChatInput.tsxpackages/ui/src/components/MessageList.tsxpackages/ui/src/hooks/useChatStore.tsxpackages/gateway/src/services/middleware/persistence.tspackages/gateway/src/types/index.tspackages/core/src/services/message-types.tspackages/ui/src/types/index.ts2. Industrial-Grade File Serving & Security
The Issue (Original State)
chat.tsusing synchronousreadFileSync, which loaded entire files into memory—a risk for server stability with large files.401 Unauthorizederrors when viewing original files.statSyncimport inchat.tswhich eventually caused TypeScript build failures (TS6133) under strict compiler rules.The Fix Applied (Final Update)
createReadStream). This provides constant, minimal memory footprint file delivery regardless of size.packages/gateway/src/middleware/auth.tsto support session tokens in query parameters (?token=...) and injected these into all UI file links for secure cross-tab viewing.Files Changed
packages/gateway/src/routes/chat.tspackages/gateway/src/middleware/auth.tspackages/gateway/src/middleware/validation.tspackages/gateway/src/routes/helpers.ts(AddedhydrateAttachmentsfor AI processing)3. Professional UI Hardening & Layout
The Issue (Original State)
The original chat interface was designed for simple text bubbles. As we introduced the complex Resource Gallery, the layout needed hardening to maintain pixel-perfect alignment.
The Fix Applied (Final Update)
flex-row-reverse justify-startlayout on user message rows. This guarantees that all content—from bubbles to multi-attachment galleries—remains perfectly pinned to the right edge and avatar axis.chat-streaming.tsandchat-history.tsto ensure file metadata is preserved in real-time, eliminating UI "flicker" during AI generation.Files Changed
packages/ui/src/components/MessageList.tsxpackages/gateway/src/routes/chat-streaming.tspackages/gateway/src/routes/chat-history.ts