Skip to content

Conversation

@erichare
Copy link
Collaborator

@erichare erichare commented Jun 12, 2025

This pull request adds a raw message output of the raw file data to the output of the Files component.

Summary by CodeRabbit

  • New Features
    • Added a "Raw Content" output option to the File component across multiple starter projects, enabling users to retrieve loaded file contents as a single message.
    • Enhanced the Memory component with a new output to retrieve messages as formatted text, and introduced improved sender filtering options for message retrieval.
  • Improvements
    • Updated input fields and output configurations for better clarity and flexibility in the Memory component.

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jun 12, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 12, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This update introduces a new "Raw Content" output to the "File" component across several starter project configurations and implements the corresponding load_files_message method in the backend. Additionally, the "Memory Chatbot" component is enhanced with a new output for formatted message text and improved input handling for sender filtering and identity.

Changes

File(s) Change Summary
src/backend/base/langflow/base/data/base_file.py Added load_files_message method and registered new "Raw Content" output in BaseFileComponent.
.../starter_projects/Document Q&A.json
.../Portfolio Website Code Generator.json
.../Text Sentiment Analysis.json
.../Vector Store RAG.json
Added "Raw Content" output (type "Message") to the "File" component in each starter project configuration.
.../starter_projects/Memory Chatbot.json Added "Message" output for formatted text, updated input fields for sender filtering, and enhanced output logic.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant FileComponent
    participant BaseFileComponent

    User->>FileComponent: Request file loading (select output)
    alt DataFrame output
        FileComponent->>BaseFileComponent: load_files()
        BaseFileComponent-->>FileComponent: DataFrame
    else Raw Content output
        FileComponent->>BaseFileComponent: load_files_message()
        BaseFileComponent-->>FileComponent: Message (concatenated file content)
    end
    FileComponent-->>User: Return selected output
Loading
sequenceDiagram
    participant User
    participant MemoryComponent

    User->>MemoryComponent: Retrieve messages (select output)
    alt DataFrame output
        MemoryComponent->>MemoryComponent: retrieve_messages()
        MemoryComponent-->>User: DataFrame
    else Message output
        MemoryComponent->>MemoryComponent: retrieve_messages_as_text()
        MemoryComponent-->>User: Message (formatted text)
    end
Loading

Possibly related PRs

Suggested labels

size:M, lgtm

Suggested reviewers

  • rodrigosnader
  • edwinjosechittilappilly
✨ Finishing Touches
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Commit Unit Tests in branch feat-file-output-selection
  • Post Copyable Unit Tests in Comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Jun 12, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (4)
src/backend/base/langflow/base/data/base_file.py (1)

176-179: Name collision & discoverability risk for new output

name="message" is very generic and likely to overlap with other components’ outputs (e.g. chat-oriented nodes already expose “message”).
When graph-building UIs auto-complete on name, this can lead to ambiguous wiring.

Consider a more explicit identifier such as raw_message or raw_content_message to avoid collisions and make intent clearer.

src/backend/base/langflow/initial_setup/starter_projects/Memory Chatbot.json (3)

856-865: Ensure clear labeling for the new message output
The new "messages_text" output correctly invokes retrieve_messages_as_text, but using display_name: "Message" may be ambiguous alongside other message outputs. Consider renaming it to "Messages Text" or "Message History (Text)" to align the display_name with the name and avoid UI confusion.


1007-1009: Explicit default for sender input
The updated sender input now allows an empty value to fallback to the current sender, but the template field lacks an explicit "value": "". Adding this default will make the UI behavior clear and consistent.


1047-1071: Verify and simplify sender_type dropdown
The new sender_type dropdown covers Machine, User, and Machine-and-User as expected and maps correctly to None in the backend when “Machine and User” is selected. For brevity, consider renaming that option to "Both" in the dropdown.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5266f23 and bb3c8df.

📒 Files selected for processing (6)
  • src/backend/base/langflow/base/data/base_file.py (2 hunks)
  • src/backend/base/langflow/initial_setup/starter_projects/Document Q&A.json (1 hunks)
  • src/backend/base/langflow/initial_setup/starter_projects/Memory Chatbot.json (4 hunks)
  • src/backend/base/langflow/initial_setup/starter_projects/Portfolio Website Code Generator.json (1 hunks)
  • src/backend/base/langflow/initial_setup/starter_projects/Text Sentiment Analysis.json (5 hunks)
  • src/backend/base/langflow/initial_setup/starter_projects/Vector Store RAG.json (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/backend/base/langflow/base/data/base_file.py (2)
src/backend/base/langflow/template/field/base.py (1)
  • Output (181-257)
src/backend/base/langflow/schema/message.py (1)
  • Message (38-288)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Optimize new Python code in this PR
🔇 Additional comments (8)
src/backend/base/langflow/initial_setup/starter_projects/Portfolio Website Code Generator.json (1)

1827-1840: Add ‘Raw Content’ output entry
This new output correctly mirrors other starter-project configs, using load_files_message to emit a Message type alongside the existing DataFrame output. Caching, loop allowances, and tool-mode flags are consistent and ordering is valid.

src/backend/base/langflow/initial_setup/starter_projects/Vector Store RAG.json (1)

2408-2422: Properly configured Raw Content output
The new "Raw Content" output entry correctly references load_files_message, enables caching, disallows loops, and aligns with the schema in other starter projects. This addition looks solid and consistent.

src/backend/base/langflow/initial_setup/starter_projects/Document Q&A.json (1)

815-829: Configuration correct for new "Raw Content" output

The new output is properly defined with display_name "Raw Content", method load_files_message, name "message", and type "Message", matching the backend implementation.

src/backend/base/langflow/initial_setup/starter_projects/Text Sentiment Analysis.json (4)

183-187: Approve addition of output_types for the File component edge.

The new "output_types": ["Message"] entry on the File→OpenAIModel edge correctly exposes the “Raw Content” output for downstream routing. This aligns with the newly added load_files_message output.


214-216: Approve addition of output_types for the File component edge.

The "output_types": ["Message"] on the File→Prompt edge is consistent with supporting raw file content as a Message. This ensures the graph can connect the new output to prompt templates.


228-230: Approve updated sourceHandle for the File component edge.

The expanded sourceHandle string now includes "output_types":["Message"], matching the File component’s new raw content output. This maintains schema consistency for all edge definitions.


281-294: Approve addition of “Raw Content” output in the File node.

The new output block—display name “Raw Content”, method load_files_message, type Message—correctly declares the raw content option alongside the existing DataFrame output. This mirrors the backend implementation in BaseFileComponent.

src/backend/base/langflow/initial_setup/starter_projects/Memory Chatbot.json (1)

867-869: Caching added to DataFrame output looks good
Introducing "cache": true for the existing DataFrame output will improve performance by reusing retrieved data across renders. No issues found here.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Jun 12, 2025
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Jun 12, 2025
@erichare erichare requested a review from Yukiyukiyeah June 12, 2025 16:07
Copy link
Collaborator

@edwinjosechittilappilly edwinjosechittilappilly left a comment

Choose a reason for hiding this comment

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

LGTM

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jun 12, 2025
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Jun 12, 2025
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Jun 12, 2025
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Jun 12, 2025
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Jun 12, 2025
@edwinjosechittilappilly edwinjosechittilappilly added this pull request to the merge queue Jun 12, 2025
Merged via the queue into main with commit b8f72d9 Jun 12, 2025
44 checks passed
@edwinjosechittilappilly edwinjosechittilappilly deleted the feat-file-output-selection branch June 12, 2025 23:50
dev-thiago-oliver pushed a commit to vvidai/langflow that referenced this pull request Jun 17, 2025
* Add raw content output for File component

* Update src/backend/base/langflow/base/data/base_file.py

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Edwin Jose <[email protected]>
ogabrielluiz pushed a commit to bkatya2001/langflow that referenced this pull request Jun 24, 2025
* Add raw content output for File component

* Update src/backend/base/langflow/base/data/base_file.py

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Edwin Jose <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants