Skip to content

feat:Add support for binary file uploads in chatflow and agentflow execution#5834

Open
okurayhan wants to merge 2 commits intoFlowiseAI:mainfrom
okurayhan:feature/add-binary-file-uploads
Open

feat:Add support for binary file uploads in chatflow and agentflow execution#5834
okurayhan wants to merge 2 commits intoFlowiseAI:mainfrom
okurayhan:feature/add-binary-file-uploads

Conversation

@okurayhan
Copy link

Summary

This PR adds support for using binary file uploads in Chatflow and Agentflow execution.

With the new variable:

  • {{file_attachment_bin}}

you can now access files uploaded via full file upload in Base64 format.

What is now possible?

{{file_attachment_bin}} can be used in:

  • Agent prompts
  • Tool inputs

This enables passing uploaded file content directly into prompt logic or downstream tools that require Base64 input.

Changes

  • Added binary file attachment support for flow execution
  • Exposed uploaded file content as {{file_attachment_bin}}
  • Enabled usage in both:
    • Agent prompt templates
    • Tool input mappings

Example Usage

Use the following variable where Base64 file content is needed:

  • {{file_attachment_bin}}

Notes

  • This variable is intended for files uploaded through the full file upload flow
  • The content is provided in Base64 format for easier interoperability with tools and APIs

Screenshots

  • Added screenshots showing usage in Agent Prompt
  • Added screenshots showing usage in Tool Input
CleanShot 2026-02-24 at 21 05 21 CleanShot 2026-02-24 at 21 05 36 Code 2026-02-24 20 29 24

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @okurayhan, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the platform's capabilities by introducing support for binary file uploads within Chatflow and Agentflow executions. Users can now upload files, and their content will be made available as a Base64 encoded string via the new {{file_attachment_bin}} variable. This allows for seamless integration of binary data into AI prompts and tools, facilitating more complex and versatile interactions.

Highlights

  • New Variable for Binary File Uploads: Introduced {{file_attachment_bin}} to access uploaded binary files in Base64 format within Chatflow and Agentflow executions.
  • Enhanced Flow Execution: Enabled the usage of {{file_attachment_bin}} directly in Agent prompts and Tool inputs, allowing binary data to be passed to AI models and tools.
  • Backend Processing: Added backend logic to process uploaded files, convert their content to Base64, and expose it through the new variable.
  • User Interface Integration: Updated the UI to include file_attachment_bin as a selectable variable option in relevant input fields.
Changelog
  • packages/server/src/Interface.ts
    • Added uploadedFilesBinaryContent to IExecuteFlowParams interface.
  • packages/server/src/utils/buildAgentflow.ts
    • Imported FILE_ATTACHMENT_BIN_PREFIX.
    • Added uploadedFilesBinaryContent to IExecuteNodeParams interface.
    • Modified resolveVariables function signature to accept uploadedFilesBinaryContent.
    • Implemented logic in resolveVariables to replace {{file_attachment_bin}} with the actual binary content.
    • Updated executeNode and executeAgentFlow to pass uploadedFilesBinaryContent through various function calls.
  • packages/server/src/utils/buildChatflow.ts
    • Implemented a new utility function getUploadedFilesBinaryContent to convert uploaded files into a JSON string of Base64 encoded binary data.
    • Integrated the new utility to populate uploadedFilesBinaryContent from uploads.
    • Passed uploadedFilesBinaryContent to subsequent execution functions.
  • packages/server/src/utils/index.ts
    • Defined FILE_ATTACHMENT_BIN_PREFIX constant.
  • packages/ui/src/ui-component/input/suggestionOption.js
    • Added file_attachment_bin as a new suggestion option for variables, with a description indicating it provides Base64 binary JSON.
  • packages/ui/src/ui-component/json/SelectVariable.jsx
    • Added a new ListItemButton component to the variable selection UI, allowing users to select file_attachment_bin with an appropriate icon and description.
Activity
  • No specific activity was provided in the context.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for binary file uploads in agentflow and chatflow executions by adding a new {{file_attachment_bin}} variable. While the changes correctly propagate the new uploadedFilesBinaryContent property through the agentflow execution path, a significant issue is that the new variable is not resolved in regular chatflows, as the corresponding logic has not been updated. Additionally, there is some code duplication in the UI that could be refactored for better maintainability, and a series of if statements could be optimized into an if-else if chain for better efficiency and clarity. I've left specific comments with suggestions.

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.

1 participant