refactor: unify file collection loading and enhance filtering capabil…#441
Merged
refactor: unify file collection loading and enhance filtering capabil…#441
Conversation
…ities - Replaced instances of loadMergedFileCollection with loadFileCollection to streamline file retrieval across contexts. - Updated file collection functions to handle inCollection status more effectively, ensuring files can be accessed regardless of their chat-specific status. - Improved filtering logic to support better management of files in various contexts, including handling empty inCollection arrays. - Enhanced tests to validate the new loading and filtering behavior, ensuring robust functionality across file operations.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors file collection loading by unifying loadMergedFileCollection and loadFileCollectionAll into a single loadFileCollection function, improving filtering capabilities for files based on inCollection status across multiple contexts.
Key Changes:
- Unified file loading API with enhanced filtering via
options.chatIdsparameter - Better handling of files without
inCollectionstatus (e.g., Labeeb uploads) - Updated tool definitions to support multi-file analysis (AnalyzePDF, AnalyzeImage)
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/fileUtils.js | Core refactoring - unified loadFileCollection function, removed deprecated functions, enhanced filtering logic for compound contexts |
| pathways/system/entity/tools/sys_tool_file_collection.js | Updated to use unified loadFileCollection API, improved tool descriptions |
| pathways/system/entity/tools/sys_tool_analyzefile.js | Changed from single 'file' to 'files' array parameter for multi-file support |
| pathways/system/entity/tools/sys_tool_view_image.js | Migrated from loadMergedFileCollection to loadFileCollection |
| pathways/system/entity/tools/sys_tool_editfile.js | Migrated from loadMergedFileCollection to loadFileCollection |
| pathways/system/entity/files/sys_read_file_collection.js | Migrated from loadMergedFileCollection to loadFileCollection |
| tests/unit/core/fileCollection.test.js | Updated to use new API signature with options object |
| tests/integration/features/tools/fileCollection.test.js | Comprehensive test updates for new API, including compound context tests |
| tests/integration/features/tools/writefile.test.js | Updated to use new API signature |
| tests/integration/graphql/async/stream/file_operations_agent.test.js | New comprehensive integration tests for file operations with agent |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… logic - Changed the parameter from 'file' to 'files' in the analyzer tool to support multiple file inputs, enhancing flexibility. - Updated filtering logic in loadFileCollection to improve handling of file collections based on chat context. - Adjusted tests to reflect changes in file parameter handling and ensure backward compatibility with legacy 'file' parameter.
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.
…ities