Skip to content

Feat/merge node#67

Merged
srijanpatel merged 29 commits intomainfrom
feat/merge-node
Dec 27, 2024
Merged

Feat/merge node#67
srijanpatel merged 29 commits intomainfrom
feat/merge-node

Conversation

@preet-bhadra
Copy link
Copy Markdown
Collaborator

@preet-bhadra preet-bhadra commented Dec 27, 2024

Now it is renamed to coalesce node, impleted the coalesce node backend and frontend


Important

Introduce CoalesceNode to replace MergeNode, updating backend and frontend components to handle multiple inputs and output the first non-null value.

  • Behavior:
    • Introduce CoalesceNode to replace MergeNode, outputs first non-null value from multiple inputs.
    • Backend logic in coalesce.py, handles multiple inputs and outputs first non-null value.
    • workflow_executor.py updated to handle CoalesceNode, skips early failure for None inputs.
  • Models:
    • CoalesceNode added to node_types.py.
  • Frontend:
    • Replace MergeNode with CoalesceNode in FlowCanvas.tsx and CoalesceNode.tsx.
    • Update NodeSidebar.tsx to handle CoalesceNode configuration.
    • Adjust flowSlice.ts to manage CoalesceNode state, including schema rebuilding logic.
  • Misc:
    • Update .env.example to reflect new repository name.
    • Minor script update in test-release.sh for Docker compose command.

This description was created by Ellipsis for 490c2d1. It will automatically update as commits are pushed.

@preet-bhadra
Copy link
Copy Markdown
Collaborator Author

@ellipsis review this.

Copy link
Copy Markdown
Contributor

@ellipsis-dev ellipsis-dev Bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Reviewed everything up to aa5593e in 1 minute and 34 seconds

More details
  • Looked at 1430 lines of code in 9 files
  • Skipped 0 files when reviewing.
  • Skipped posting 6 drafted comments based on config settings.
1. backend/app/execution/workflow_executor.py:102
  • Draft comment:
    Replace print statements with proper logging to avoid cluttering the console and to provide more control over the logging output.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The code contains multiple print statements for debugging purposes. These should be replaced with proper logging to avoid cluttering the console and to provide more control over the logging output.
2. backend/app/execution/workflow_executor.py:103
  • Draft comment:
    Replace print statements with proper logging to avoid cluttering the console and to provide more control over the logging output.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The code contains multiple print statements for debugging purposes. These should be replaced with proper logging to avoid cluttering the console and to provide more control over the logging output.
3. backend/app/execution/workflow_executor.py:139
  • Draft comment:
    Replace print statements with proper logging to avoid cluttering the console and to provide more control over the logging output.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The code contains multiple print statements for debugging purposes. These should be replaced with proper logging to avoid cluttering the console and to provide more control over the logging output.
4. backend/app/nodes/logic/coalesce.py:47
  • Draft comment:
    Replace print statements with proper logging to avoid cluttering the console and to provide more control over the logging output.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The code contains multiple print statements for debugging purposes. These should be replaced with proper logging to avoid cluttering the console and to provide more control over the logging output.
5. backend/app/nodes/logic/coalesce.py:63
  • Draft comment:
    Replace print statements with proper logging to avoid cluttering the console and to provide more control over the logging output.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The code contains multiple print statements for debugging purposes. These should be replaced with proper logging to avoid cluttering the console and to provide more control over the logging output.
6. backend/app/nodes/logic/coalesce.py:79
  • Draft comment:
    Replace print statements with proper logging to avoid cluttering the console and to provide more control over the logging output.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The code contains multiple print statements for debugging purposes. These should be replaced with proper logging to avoid cluttering the console and to provide more control over the logging output.

Workflow ID: wflow_EqK49RhTpLH3RCDj


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Copy Markdown
Collaborator

@srijanpatel srijanpatel left a comment

Choose a reason for hiding this comment

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

Looks good overall. Left some minor comments. Also please drop debug print statements and console logs.

print(f"Returning first non-null value: {key}, {value}")
return self.output_model(**first_non_null_output) # type: ignore

# If all values are None, return an empty output
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

In this case we should return a None output instead of an empty model. None will skip the children nodes.

Comment thread backend/example_merge.json Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Remove this from the final commit.

} else if (node.name === 'MergeNode') {
acc[node.name] = (props: any) => <MergeNode {...props} />;
} else if (node.name === 'CoalesceNode') {
acc[node.name] = CoalesceNode;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@preet-bhadra can you make sure there are no linter errors here? If there are then let's use the functional style as it was done for merge node.


interface CoalesceNodeProps {
id: string;
data: CoalesceNodeData;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This can be FlowWorkflowNode['data']
We should use already declared types as much as possible.
No need to declare CoalesceNodeData type separately.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice work moving the router and coalesce node logic to respective functions

@preet-bhadra preet-bhadra marked this pull request as ready for review December 27, 2024 16:08
Copy link
Copy Markdown
Contributor

@ellipsis-dev ellipsis-dev Bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Reviewed everything up to 490c2d1 in 1 minute and 27 seconds

More details
  • Looked at 1280 lines of code in 13 files
  • Skipped 0 files when reviewing.
  • Skipped posting 5 drafted comments based on config settings.
1. backend/app/execution/workflow_executor.py:99
  • Draft comment:
    Consider replacing print statements with a proper logging mechanism for better control over log levels and outputs.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The PR introduces a new CoalesceNode to replace the MergeNode. The backend logic and frontend components have been updated accordingly. The changes seem to be well-integrated, but there are a few areas that need attention. Specifically, the use of print statements for logging in workflow_executor.py is not ideal for production code. Additionally, the CoalesceNode logic in coalesce.py could be improved for clarity and efficiency. The frontend components seem to be updated correctly, but there are some redundant console logs that should be removed. Overall, the PR is a good step forward, but these minor issues should be addressed before merging.
2. backend/app/nodes/logic/coalesce.py:50
  • Draft comment:
    Consider optimizing the iteration over data by combining preference checks with the general iteration to avoid redundant loops. Also, simplify the use of create_model if possible.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The CoalesceNode logic in coalesce.py is mostly correct, but the handling of preferences and the iteration over data could be optimized. The current implementation checks preferences first and then iterates over all data, which is fine, but could be more efficient if combined. Additionally, the use of create_model could be simplified.
3. frontend/src/components/canvas/FlowCanvas.tsx:192
  • Draft comment:
    Remove redundant console.log statements to clean up the code.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The PR includes changes to the frontend components to replace MergeNode with CoalesceNode. While the changes are mostly correct, there are some redundant console logs that should be removed to clean up the code.
4. frontend/src/components/nodes/DynamicNode.tsx:174
  • Draft comment:
    Remove redundant console.log statements to clean up the code.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The PR includes changes to the frontend components to replace MergeNode with CoalesceNode. While the changes are mostly correct, there are some redundant console logs that should be removed to clean up the code.
5. frontend/src/components/nodes/logic/RouterNode.tsx:282
  • Draft comment:
    Remove redundant console.log statements to clean up the code.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The PR includes changes to the frontend components to replace MergeNode with CoalesceNode. While the changes are mostly correct, there are some redundant console logs that should be removed to clean up the code.

Workflow ID: wflow_QnBXqUAa31uWrXaq


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@srijanpatel
Copy link
Copy Markdown
Collaborator

LGTM!

@srijanpatel srijanpatel merged commit 63a8f51 into main Dec 27, 2024
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