Skip to content

Conversation

christian-byrne
Copy link
Contributor

@christian-byrne christian-byrne commented May 20, 2025

Adds support for text file uploads in ComfyUI nodes, similar to how image and video uploads are handled. This allows for text files (including PDFs) to be uploaded via a button, drag-and-drop, or clipboard paste.\n\nNodes can use the new 'text_upload: true' flag on combo inputs to enable this functionality.

┆Issue is synchronized with this Notion page by Unito

@christian-byrne christian-byrne requested a review from a team as a code owner May 20, 2025 09:28
@christian-byrne christian-byrne marked this pull request as draft May 20, 2025 09:29
@christian-byrne christian-byrne force-pushed the feature/text-upload-support branch from 94a2aa2 to eca9e3d Compare May 22, 2025 00:40
@christian-byrne christian-byrne force-pushed the feature/text-upload-support branch from 3bdcb68 to 53ccd4a Compare May 29, 2025 20:59
Copy link
Contributor Author

@christian-byrne christian-byrne left a comment

Choose a reason for hiding this comment

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

Requires changes to core in followup:

  • Update node typings
  • Add upload/text-file route handler

@christian-byrne christian-byrne marked this pull request as ready for review May 29, 2025 21:04
christian-byrne and others added 5 commits May 29, 2025 20:34
Adds allow_batch configuration support to text upload widgets, enabling multiple file uploads when specified. Changes include:
- Support for allow_batch input specification
- Batch file processing with uploadTextFiles function
- Value transform logic for single vs array outputs
- Dynamic button text (file/files) based on batch mode
- Translation keys for plural file selection
- Use proper discriminated unions instead of manual type checking
- Replace 'any' types with 'unknown' for better type safety
- Update naming: TEXTUPLOAD → TEXT_FILE_UPLOAD, text_upload → text_file_upload
- Extract constants for maintainability (SUPPORTED_FILE_TYPES, TEXT_FILE_UPLOAD)
- Convert to V2 widget pattern with ComfyWidgetConstructorV2
- Self-documenting function names replacing comments
- Clean error handling with proper type guards

Addresses all PR review feedback for improved code quality and consistency.
@christian-byrne christian-byrne force-pushed the feature/text-upload-support branch from 648e17f to 1989561 Compare May 30, 2025 09:20
@christian-byrne
Copy link
Contributor Author

It might be better to generalize this process. That is, we make an API whereby nodes can declare they want to support upload connected to a specific COMBO widget, while also specifying the mimetype and fileextension list (same format as the accept on HTML file button). Then that node will support copy/paste, drag-and-drop, and upload button for that given type of file.

Otherwise, we will be adding all this boiler plate for each new input file type, which will be harder to propogate bug fixes across.

@christian-byrne
Copy link
Contributor Author

christian-byrne commented Jun 4, 2025

Replace this PR with #4071 after it has been implemented.

@christian-byrne
Copy link
Contributor Author

Will be redone in Vue Nodes more easily, no longer necessary.

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.

2 participants