Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[chore] - chore: store fragment content type (#5838)
* [types] - feature: extend content types for content fragments - Added new content type literals for text and image formats - Replaced 'slack_thread_content' and 'file_attachment' with more specific content types - Defined supported formats for text and images and applied them to the content fragment schemas * [connectors] - fix: update contentType for Slack thread content - Change the value of contentType from "slack_thread_content" to "dust-application/slack" to match a standardized format [front] - feature: support display of various content types in ContentFragment - Extend switch case to handle additional content types like plain text, CSV, markdown, PDF, and image formats - Set the logo type to 'document' for these newly supported types to enhance visual representation in the UI * [types] - feature: enhance typing for supported format constants - Define explicit constant types for text and image formats - Implement utility functions to check for supported content formats - Improve type safety by narrowing down the types for content fragment formats * [front/components/assistant/conversation/input_bar] - feature: enhance file upload handling in AssistantInputBar - Add support for additional content formats in file uploads - Implement an error notification for unsupported file formats - Introduce separate handling for image uploads alongside text files * [misc] - refactor: update handling and support for content fragments - Removed image formats from supported content fragment types in ContentFragment.tsx - Updated file upload handling to remove specific image upload process - Added content type validation logic to createConversationWithMessage - Changed file upload acceptance to use a defined list of supported extensions - Modified postNewContent roundup functions to include content type in their processes - Removed dead code related to image format handling as it's no longer necessary [types] - refactor: remove image content types from supported formats schemas - Updated internal and public assistant API schemas to reflect the removal of image content types - Adjusted type definitions and utility functions to no longer include image formats as supported - Clarified and reinforced text format content handling across various modules * fix: lint/format * [front] - feature: support Slack thread and file attachment content types - Added 'slack_thread_content' and 'file_attachment' to content type handling, allowing integration with Slack threads and attachment display - Marked 'slack_thread_content' and 'file_attachment' for future removal after data migration is complete [types] - feature: extend content fragment types for Assistant API - Included new literals 'file_attachment' and 'slack_thread_content' to the content fragment schema definition to support more content types - Added TODO for removal of newly added content types post data backfilling process * [assistant/conversation/input_bar] - fix: correct file upload validation logic and update supported formats list - The condition to check unsupported file formats during upload was inverted, now correctly validating supported content - Removed '.tsv' from the list of supported file extensions for uploads to reflect current specifications [lib/resources/content_fragment_resource] - refactor: remove unused getSignedUrlForContentFragment function - Deleted the getSignedUrlForContentFragment function as it is no longer needed in the codebase * [front] - refactor: streamline ContentFragment logic for logo types - Simplified the switch-case to if-else statements for determining logoType based on contentType - Removed redundant case strings for text content types, using `startsWith` method for brevity [types] - refactor: clean up supported content types in schemas - Removed specific text types (tsv, comma/tab-separated values) to streamline supported formats - Adjusted validation schemas to reflect supported content type changes across internal and public APIs * [assistant/conversation] - refactor: update types for content fragment handling - Change `ContentFragmentInput` to `UploadedContentFragment` to enhance type specificity - Include `contentType` in `UploadedContentContentFragment` for better content type management [assistant/conversation] - fix: standardize error handling for unsupported content types - Implement direct checks for unsupported content types during file uploads - Remove deprecated `isSupportedContentFormat` dependency to streamline file handling [assistant] - refactor: adjust input handling for creating and submitting conversations - Align conversation-related functions with updated content fragment types - Ensure consistent content fragment processing within conversation creation workflow [content_fragment] - feature: extend file upload handling to include content type - Update `handleFileUploadToText` to return content type, ensuring compatibility with updated fragment structure - Add error handling for unsupported file types during upload processing * [assistant/conversation/input_bar] - feature: handle markdown file uploads correctly - Add a check to correctly identify markdown files during uploads - Recreate File object with the correct MIME type if a markdown file is detected * [front] - refactor: streamline content fragment type checks and naming - Replaced multiple instances of isSupportedContentFormat with isSupportedContentFragmentType to ensure consistent type checking across modules - Renamed several variables and types to align with the new supportedContentFragment naming, improving readability [types] - refactor: update content fragment type names and collections - Deprecated slack_thread_content in supportedTextFormat, moving it to supportedContentFragment for clarity - Renamed SupportedTextFormatType to SupportedTextContentFragmentType to mirror changes in content fragment type checks - Adjusted function naming from isSupportedTextContentFormat to isSupportedTextContentFragmentType to better reflect their purpose * [front] - refactor: standardize UploadedContentFragment type import - Moved the `UploadedContentFragment` import to use the `@dust-tt/types` package across different components - Removed redundant declarations of the `UploadedContentFragment` type to clean up the codebase [types] - feature: add UploadedContentFragment definition to the types package - Defined a new `UploadedContentFragment` type to be used across different parts of the application for consistent type checking * [front/components/assistant] - refactor: centralize MIME type handling for file uploads - Replace individual file type checks with a centralized `getMimeTypeFromFile` utility function - Remove redundant code for copying and handling markdown files by using the new utility function [front/lib/client] - fix: ensure correct MIME type used when handling text in file uploads - Utilize `getMimeTypeFromFile` to determine the correct MIME type for supporting text extraction from uploads [front/lib/resources] - refactor: enforce stronger typing for content type in content fragment storage - Change contentType parameter to use `SupportedContentFragmentType` for better type safety * [types] - refactor: centralize content type definitions for consistency - Replaced repetitive content type definitions with a centralized codec function - Enhanced maintainability by using getSupportedTextContentFragmentCodec in API handler schemas * [front/lib] - feature: add function to detect markdown file types - Introduce a utility to check if a file is of type markdown based on its name or MIME type - Extend MIME type recognition to cover markdown files without a type from the file object * [types] - refactor: update content fragment codec functions - Replaced `getSupportedTextContentFragmentCodec` with `getSupportedContentFragmentCodec` for broader fragment support - Updated usage in internal and public assistant API handlers to reflect codec function change * [front] - refactor: streamline file upload handling and content fragment creation - Remove checks for unsupported file types during file uploads to simplify the workflow - Eliminate unused content type parameters in content fragment storage and API endpoints [types] - refactor: update codec function for content fragment types - Rename codec function to better reflect its purpose of getting supported content fragment types - Expand list of supported text content fragment types to include CSV and TSV formats * [types] - refactor: move content fragment logic to a dedicated module - Extract ContentFragment related types and functions from the conversation module - Create a new module content_fragment to manage them separately - Update import statements in internal and public API handlers to refer to the new module location - Prepare for removal of deprecated content fragment types with a TODO in the new module * [types] - feature: add textUrl attribute to ContentFragmentType - Introduced a new mandatory textUrl field to the content fragment structure to manage text content by URL reference --------- Co-authored-by: Jules <[email protected]>
- Loading branch information