Skip to content

refactor: unify file collection loading and enhance filtering capabil…#441

Merged
jmacAJ merged 2 commits intomainfrom
jmac_file_tuning
Dec 31, 2025
Merged

refactor: unify file collection loading and enhance filtering capabil…#441
jmacAJ merged 2 commits intomainfrom
jmac_file_tuning

Conversation

@jmacAJ
Copy link
Copy Markdown
Contributor

@jmacAJ jmacAJ commented Dec 31, 2025

…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.

…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.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.chatIds parameter
  • Better handling of files without inCollection status (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.
@jmacAJ jmacAJ merged commit 07acc28 into main Dec 31, 2025
@jmacAJ jmacAJ deleted the jmac_file_tuning branch December 31, 2025 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants