-
-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhanced File Handling: File Support, Improved UI, and Robust Processing #130
Open
Anajrim01
wants to merge
31
commits into
ShipBit:main
Choose a base branch
from
Anajrim01:file-support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
@Anajrim01 is attempting to deploy a commit to the ShipBit Team on Vercel. A member of the Team first needs to authorize it. |
- Integrate pdfjs-dist library for handling PDF files - Implement functions for loading PDF, extracting text content, and extracting image data - Update fileUtils.ts to handle PDF uploads and limit the number of attachments - Add readFileAsArrayBuffer function for reading files as ArrayBuffer - Refactor handleFiles.ts to handle PDF extraction requests - Improve error handling and logging for PDF processing
Anajrim01
changed the title
feat: Add support for PDF file uploads and extraction
feat: Add support for file uploads and extraction
Oct 7, 2024
Anajrim01
changed the title
feat: Add support for file uploads and extraction
feat: Add support for file uploads
Oct 7, 2024
- bug: currently deleting attachment doesn't delete the image as they're not linked (maybe create seperate FileAttachments interface?)
This commit modifies the `renderContentArray` function in `markdownUtils.ts` to properly render file attachments for text content. It adds a new condition to check if the `fileAttached` property of the attachment is true, and if so, it renders a container with the attachment details. This change addresses the bug mentioned in the recent user commits where deleting an attachment did not delete the associated image because they were not properly linked. It also extends the `ChatContent` interface to support file attachments.
- Rename processFile to processImageFile for clarity. - Add VerbosityLevel.ERRORS to loadPdf for concise error reporting from PDF.js. - Improve showUploadResult to provide better feedback on uploaded images and skipped files. - Enhance extractImageData to handle duplicates using a Set. - Ensure correct image extraction from both objs and commonObjs. - Simplify removeAttachment logic for accurate removal based on specified index and quantity. - Update uploadFilesAndDebounce to correctly count only image_url attachments. - Add validation for image upload limit in handleFileExtractionRequest.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
- Improved chat message support for attachments. - Redesigned layout for better attachment display. - Refined FileDropzone for easier file uploads. - Fixed image positioning issues in text. - Updated dependencies for security and performance.
- Added `async-mutex` to `package.json` for better async operation management. - Updated `ChatInput.svelte` to support more text file formats and improved UI messages. - Refactored `fileUtils.ts` to `fileHandler.ts` for better code organization. - Introduced `extractTextFileContent` for handling text file extraction. - Moved file reading utilities to `shared.ts` for reuse. - Simplified `processImageFile` and made it exportable. - Enhanced Rollup configuration in `vite.config.ts` to split third-party modules into separate chunks. - Improved error handling and edge case management in file processing.
Anajrim01
changed the title
feat: Add support for file uploads
Enhanced File Handling: PDF Support, Improved UI, and Robust Processing
Oct 13, 2024
- Introduced `processContent` function to streamline content processing, ensuring message content is consistently formatted as `ChatContent[]`. - Added logic to handle unsupported image URLs for non-OpenAi providers, displaying a warning toast and removing such images from messages. - Simplified `processMessageContent` by utilizing the new `processContent` function, improving code readability and maintainability. - Updated `editMessage` function to handle message content and attachments more effectively, ensuring proper handling of text and image data. - Removed redundant `processContentItem` function, consolidating content processing logic.
- Introduced `processContent` function to streamline content processing, ensuring message content is consistently formatted as `ChatContent[]`. - Added logic to handle unsupported image URLs for non-OpenAi providers, displaying a warning toast and removing such images from messages. - Simplified `processMessageContent` by utilizing the new `processContent` function, improving code readability and maintainability. - Updated `editMessage` function to handle message content and attachments more effectively, ensuring proper handling of text and image data. - Removed redundant `processContentItem` function, consolidating content processing logic.
…into file-support
Hello @Shackless, I've tried to make everything as clear to understand as possible. Also some small UI improvements here and there for a more seamless UX. |
Anajrim01
changed the title
Enhanced File Handling: PDF Support, Improved UI, and Robust Processing
Enhanced File Handling: File Support, Improved UI, and Robust Processing
Oct 14, 2024
- The width and height are set on upload of image by default, if for some reason this fails. There's a fallback method which is broken but might work in some cases.
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.
This pull request significantly enhances the application's file handling and preview capabilities by introducing robust support for file uploads. It primarily focuses on improving document handling, particularly for PDFs and various text-based formats. Future updates will further expand supported formats and refine the processing mechanisms.
Features
.py
,.cs
,.cpp
,.c
,.txt
, and.csv
files.Code Changes
pdfjs-dist
library for handling PDF files.fileUtils.ts
(nowfileHandler.ts
) to process and handle different file types, including advanced extraction for PDFs.readFileAsArrayBuffer
function for reading files as anArrayBuffer
.ChatInput.svelte
to handle file input and display attachments.markdownUtils.ts
to render attachments properly in the UI.suggestChatTitle
logic inshared.ts
for better integration with supported models and file attachments.FileDropzone
for smoother file uploads.async-mutex
topackage.json
for better async operation management.vite.config.ts
to split third-party modules into separate chunks.Detailed Commits
renderContentArray
function inmarkdownUtils.ts
for better file attachment display.ChatContent
interface to support file attachments.To-Do List
Limit file size so it doesn't exceed max token limit (model specific).This set of changes collectively boosts the application's ability to handle various file formats, improves user experience through refined UI, and ensures robust processing and previewing of uploaded files.