refactor: improve output selection logic and edge updating in Generic…
This pull request introduces a new group_outputs flag to various components and JSON configuration files in the backend. The flag determines whether outputs should be displayed as grouped or individually in the frontend. This change affects both the logic components and the starter project configurations.
Updates to Logic Components:
- Added
group_outputs=Trueto theOutputdefinitions inConditionalRouterandLoopComponentto ensure all outputs are displayed without dropdowns in the frontend. (src/backend/base/langflow/components/logic/conditional_router.py,src/backend/base/langflow/components/logic/loop.py) [1] [2]
Updates to Starter Projects:
- Added
group_outputs=falseto multiple output configurations in JSON files for starter projects (Basic Prompt Chaining.json,Basic Prompting.json,Blog Writer.json,Custom Component Maker.json,Diet Analysis.json) to explicitly specify that outputs should not be grouped. This change ensures consistency across all starter projects. [1] [2] [3] [4] [5] [6]
These updates improve the clarity and consistency of how outputs are handled in both the backend logic and the initial setup configurations.
Summary by CodeRabbit
-
New Features
- Added a new option to control output grouping, allowing certain outputs to be displayed together without dropdown menus.
-
Improvements
- Enhanced output selection UI with refined dropdown visibility logic and improved handling of hidden outputs.
- Smarter default output selection and updated edge connections reflecting output changes.
-
Style
- Reduced size of the hidden outputs toggle button for a cleaner interface.
-
Documentation
- Added explicit output grouping metadata across numerous starter projects to clarify display behavior.
-
Refactor
- Simplified and clarified node output rendering logic for better maintainability.
-
Chores
- Reformatted multiple JSON configuration files for improved readability and consistency.
CodSpeed Performance Report
Merging #8254 will not alter performance
Comparing lfoss-1244 (65f68a9) with main (7ab4951)
Summary
✅ 19 untouched benchmarks
Walkthrough
The changes introduce a new boolean property, group_outputs, to output definitions in both backend Python and frontend TypeScript/JSON configurations. This property controls whether outputs are grouped or displayed directly, affecting UI rendering. The logic for displaying outputs and dropdowns is updated accordingly, and relevant tests and starter project configurations are modified to include this property.
Changes
| File(s) / Area | Change Summary |
|---|---|
src/backend/base/langflow/template/field/base.py |
Added group_outputs boolean field to Output class with docstring. |
src/backend/base/langflow/base/vectorstores/vector_store_connection_decorator.py |
Added group_outputs=False to "Vector Store Connection" output. |
src/backend/base/langflow/components/logic/conditional_router.py |
Added group_outputs=True to "True" and "False" outputs in ConditionalRouterComponent. |
src/backend/base/langflow/components/logic/loop.py |
Added group_outputs=True to "Item" and "Done" outputs in LoopComponent. |
src/backend/base/langflow/initial_setup/starter_projects/*.json |
Added "group_outputs": false (or true for some loop/router outputs) to output definitions in all projects. |
src/frontend/src/CustomNodes/GenericNode/components/NodeOutputParameter/NodeOutputs.tsx |
Refactored output rendering logic to use group_outputs, affecting how outputs are displayed. |
src/frontend/src/CustomNodes/GenericNode/components/OutputComponent/index.tsx |
Updated dropdown visibility logic to consider group_outputs and node type. |
src/frontend/src/CustomNodes/GenericNode/index.tsx |
Improved output selection initialization and edge updating logic; updated output rendering. |
src/frontend/src/CustomNodes/GenericNode/components/NodeOutputfield/index.tsx |
Removed inline comments, no logic changes. |
src/frontend/src/pages/FlowPage/components/nodeToolbarComponent/index.tsx |
Removed explanatory comments, no logic changes. |
src/backend/tests/unit/test_schema.py |
Updated test to expect "group_outputs" in output dictionary. |
src/frontend/tests/core/integrations/decisionFlow.spec.ts |
Removed dropdown selection step for conditional router output in test. |
Sequence Diagram(s)
sequenceDiagram
participant Backend
participant Frontend
participant User
User->>Frontend: Loads node/component UI
Frontend->>Backend: Requests node/component schema
Backend-->>Frontend: Sends schema with outputs (includes group_outputs flag)
Frontend->>Frontend: Determines output rendering:
alt group_outputs True or allows_loop or ConditionalRouter
Frontend->>User: Displays all outputs directly (no dropdown)
else
Frontend->>User: Displays dropdown to select output
end
User->>Frontend: Interacts with outputs (selects or views)
Frontend->>Backend: Sends/receives data as per output selection
Suggested labels
enhancement, size:M
📜 Recent review details
Configuration used: CodeRabbit UI Review profile: CHILL Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between 6e4922a31a322c2584ea018e08882c3df5793ee9 and f834fa4e7c8cb4f9f2c88cd64c13db7325f8c00b.
📒 Files selected for processing (1)
src/frontend/tests/core/integrations/decisionFlow.spec.ts(0 hunks)
💤 Files with no reviewable changes (1)
- src/frontend/tests/core/integrations/decisionFlow.spec.ts
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: Optimize new Python code in this PR
- GitHub Check: Ruff Style Check (3.13)
- GitHub Check: Run Ruff Check and Format
- GitHub Check: Update Starter Projects
✨ Finishing Touches
- [ ] 📝 Generate Docstrings
🪧 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
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai explain this code block.@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitaiin 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 pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai generate docstringsto generate docstrings for this PR.@coderabbitai generate sequence diagramto generate a sequence diagram of the changes in this PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
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.
@coderabbitai review
✅ Actions performed
Review triggered.
Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.