Commit graph

19 commits

Author SHA1 Message Date
Max
069f60f1f8 Add zip processing functionality for attachments
- Introduce a new `processZip` function to package multiple attachment files into a single zip archive and upload it to the uploader storage.
- Implement filename deduplication within the zip archive to handle potential naming conflicts.
- Enhance the `Init` function to register the new `Zip` process for attachment management.
- Include detailed documentation for the `processZip` function, outlining its arguments, return values, and usage examples.
2026-02-15 12:12:17 +08:00
Max
02e813af0b Update Dependencies and Enhance Agent Context with Forked Context Support
- Updated `logrus` dependency from v1.9.3 to v1.9.4 and `golang.org/x/sys` from v0.38.0 to v0.40.0 for improved functionality and security.
- Introduced a `Fork` method in the agent context to create child contexts for concurrent agent and LLM calls, preventing race conditions on shared state during batch operations.
- Enhanced the `Orchestrator` methods to utilize forked contexts, ensuring independent execution of agent calls without interference.
2026-01-25 20:32:02 +08:00
Max
ef63718941 Enhance Attachment Process with Plain Text and UTF-8 Support
- Added tests for saving plain text and Chinese text directly, ensuring proper handling of content without data URI encoding.
- Updated the `parseDataURI` function to support plain text storage, returning the correct content type and data bytes.
- Improved the `getAssistants` method to support nested assistants, enhancing directory scanning for assistant pages.
- Refactored the `Page` method to accommodate assistant IDs with nested structures, improving route handling for pages.
2026-01-25 17:32:50 +08:00
Max
6d4388cf1b Refactor TestGenerateFilename to Simplify Extension Validation
- Removed the validExts field from test cases, streamlining the filename generation tests.
- Enhanced validation to ensure filenames have a proper extension format and are not empty, improving test robustness.
- Updated comments for clarity on expected filename behavior based on content type.
2026-01-25 12:07:38 +08:00
Max
042066e6b3 Enhance Attachment Package with Process API and Initialization
- Added an initialization step in the Load function to register attachment processes, improving the setup for file management.
- Expanded the README to include detailed documentation on the new Process API, outlining available processes, permission models, and usage examples for better developer guidance.
2026-01-25 11:25:55 +08:00
Max
1060c0f0e0 Enhance attachment manager with dual text content handling
- Updated `GetText` and `SaveText` methods to support both full content and a preview (first 2000 characters) for improved performance and usability.
- Added comprehensive tests in `manager_test.go` to validate the new functionality, including UTF-8 character handling and content retrieval scenarios.
- Modified the attachment model to include a `content_preview` field alongside the existing `content` field, ensuring efficient data management.
- Enhanced the README.md to document the new dual storage feature, providing clear examples for users on how to utilize the updated methods.
2025-12-03 18:29:24 +08:00
Max
4170fbd13b Add text content storage functionality to attachment manager
- Implemented `GetText` and `SaveText` methods in the attachment manager to handle storing and retrieving parsed text content from files.
- Enhanced the `manager_test.go` with comprehensive tests for various scenarios, including saving, updating, and retrieving text, as well as handling non-existent file IDs.
- Updated the README.md to document the new text content storage features, providing examples for saving and retrieving parsed text.
- Modified the attachment model to include a new `content` field for storing text content, improving the overall functionality of the attachment management system.
2025-12-03 18:18:46 +08:00
Max
2f6cf1a08c Enhance attachment upload functionality with image compression and metadata caching
- Introduced new fields for image compression options in the UploadChunk struct, allowing for better handling of image uploads.
- Updated the upload process to utilize cached compression settings from the first chunk, improving efficiency and consistency.
- Implemented a fallback mechanism for image compression, logging errors and using original files when compression fails.
- Refactored the compressStoredImage function to return the compressed size, enhancing the upload process and error handling.
2025-11-06 11:53:24 +08:00
Max
e435c03e0e Enhance attachment upload process and content type handling
- Updated the upload process to cache metadata from the first chunk, ensuring consistency in content type, filename, and user path across chunked uploads.
- Modified content type validation in tests to allow for charset variations, improving robustness in file type checks.
- Refactored database save logic to differentiate between new records and updates for chunked uploads, enhancing data integrity and performance.
2025-11-06 11:31:24 +08:00
Max
5d18e76acd Enhance attachment management with public and share fields
- Introduced new fields in the attachment model for public access control and sharing options, allowing attachments to be marked as public or shared with specific teams.
- Updated the upload process to handle new permission fields, ensuring proper handling of public and share options during file uploads.
- Implemented permission checks in the file retrieval and deletion processes to enforce access control based on user roles and attachment settings.
- Added comprehensive tests for the new permission fields to validate functionality and ensure correct behavior in various scenarios.
2025-11-05 18:11:36 +08:00
Max
0ee38a1cb3 Implement attachment wrapper parsing and Base64 conversion in attachment manager
- Added `Parse` function to handle attachment wrapper strings, extracting uploader name and file ID.
- Introduced `Base64` function to convert attachment wrappers to Base64 format, with optional data URI support.
- Enhanced `readFilePathAsBase64` to read files from the filesystem and return Base64 encoded content.
- Updated `teamInvitationGetPublic` to process team logos and inviter pictures as Base64 for direct display in the response.
2025-10-30 09:59:09 +08:00
Max
c425b74383 Refactor error handling in various components to improve logging and message formatting
- Updated error messages to use fmt.Errorf with %s for better clarity and consistency.
- Enhanced logging statements to utilize formatted strings for improved readability.
- Refactored multiple Load functions across different modules to standardize error handling practices.
2025-09-28 10:24:17 +08:00
Max
8471343311 Refactor storage tests to use unique filenames with UUIDs
- Introduced a `generateTestFileName` function to create unique test filenames for both local and S3 storage tests, reducing conflicts during test execution.
- Updated test cases to utilize the new filename generation method, ensuring consistent and unique identifiers for uploaded files across various scenarios.
- Enhanced readability and maintainability of test code by replacing hardcoded filenames with dynamically generated ones.
2025-07-27 10:05:50 +08:00
Max
c3b374f043 Implement LocalPath functionality for attachment management
- Added LocalPath method to the Manager and Storage interfaces to retrieve the absolute path and content type of files.
- Enhanced local and S3 storage implementations to support LocalPath, including handling gzipped files and content type detection.
- Introduced comprehensive tests for LocalPath functionality, covering various file types, non-existent files, and gzipped content.
- Updated AddFile API to utilize LocalPath for retrieving file information, improving error handling and response consistency.
2025-07-27 09:48:49 +08:00
Max
070ff59225 Enhance attachment management with file storage improvements
- Refactored the attachment manager to support file uploads with a new storage path and improved metadata handling.
- Implemented chunked uploads and direct content retrieval, enhancing performance and flexibility.
- Updated the file management API to include comprehensive operations for file uploads, downloads, and metadata management.
- Added support for multiple storage backends, including local and S3, with improved error handling and validation.
- Enhanced test coverage for file operations, ensuring reliability and consistency across different storage implementations.
2025-07-26 19:25:41 +08:00
Max
0fe42b517f Update S3 storage tests to use UUIDs for file identifiers
- Modified test cases in `storage_test.go` to generate unique file IDs using UUIDs, ensuring no conflicts during tests.
- Updated the download test for non-existent files to utilize a UUID-based identifier, enhancing test reliability.
2025-07-26 11:07:20 +08:00
Max
5d5d0d4ce9 Improve error messages in S3 storage operations
- Enhanced error handling in the S3 storage implementation by including the fileID in error messages for upload, upload chunk, merge chunks, and download operations. This change provides clearer context for debugging and improves the overall error reporting mechanism.
2025-07-25 19:15:18 +08:00
Max
2f13dbbffb Enhance attachment model and add local uploader support
- Introduced a new `Groups` field in the `Attachment` struct to support categorization of attachments.
- Integrated `types.MetaInfo` into `ManagerOption` for improved metadata handling.
- Added a local uploader for attachments, enabling file uploads from a specified local path.
- Updated asset management functions to reflect changes in file metadata and structure.
2025-07-25 18:15:51 +08:00
Max
435b482c38 Refactor attachment handling and enhance upload options
- Updated the API to include new upload options for handling different storage types: chat, knowledge, and assets.
- Improved group building logic for attachment uploads based on user, chat, and assistant IDs.
- Removed deprecated attachment files and refactored related code to streamline the attachment management process.
- Enhanced error handling for required fields in upload options, ensuring better validation and user feedback.
2025-07-25 17:25:12 +08:00