Support conditional nodes#16
Merged
Merged
Conversation
The outgoing node of a flow node can now be an object that contains a node id and a value. This allows the flow engine to determine which node to execute next based on the value of a condition.
Replaces the `Option` type in `FlowLink` with a `Value` enum. This change allows `FlowLink` to carry more varied data, which will be used for conditional node execution. This change also updates all usages of `FlowLink` to use `Value::None` instead of `None`.
Adds support for conditional flow nodes, allowing the flow engine to execute different branches based on an expression. Improves flow factory to handle multiple outgoing nodes and ensures proper validation of node connections, preventing cycles and orphaned nodes. Adds a test case to validate multiple parent nodes.
Adds validation to ensure that outgoing links from a node have unique values, preventing ambiguous flow execution paths. Introduces `ordered-float` to allow `f64` values to be used in hash maps.
Normalizes different `Number` types to floats before hashing and comparison. This change ensures that numerical values are treated consistently regardless of their underlying representation (e.g., `Number::Float(1.0)` and `Number::PositiveInt(1)` are considered equal). It uses `OrderedFloat` to properly handle `NaN` values in comparisons. This ensures that PartialOrd, PartialEq and Hash agree semantically, so that NaN, -0.0, etc. are treated consistently.
Adds support for conditional flow nodes, allowing flows to branch based on expression evaluation. The engine now evaluates expressions within conditional nodes and navigates to the corresponding outgoing node based on the result. Error handling is included for failed evaluations and missing flow links.
062cf96 to
7016fdb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Numbertypes to floats for hashing and comparison