There is a bug in condition branch node
Self Checks
- [X] This is only for bug report, if you would like to ask a question, please head to Discussions.
- [X] I have searched for existing issues search for existing issues, including closed ones.
- [X] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
- [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
- [X] Please do not modify this template :) and fill in all the required fields.
Dify version
0.11.2
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
in this workflow, typing help to get in help mode.
whatever you type, both direct reply nodes will be triggered and respond with the numbers that shouldn't be responded.
bug_dsl.yml.txt
✔️ Expected Behavior
when you type 1, branch 1 will be triggered, and 2, branch 2 will be triggered.
❌ Actual Behavior
both branches are triggered in condition node
@RoyDingZF Hello there! I'm here to help you with any bugs, questions, or contributions while you wait for a human maintainer. Let's tackle this issue together!
The issue you're experiencing, where both branches are triggered in the condition branch node, could be due to several factors related to the logic in the IfElseNode class. Here are some potential causes and solutions:
-
Logical Operator Misconfiguration: Ensure that the logical operators used in your conditions are correctly set. If both branches are being triggered, it might be due to a misconfiguration of these operators, causing both conditions to evaluate as
True[1]. -
Condition Evaluation Error: Check if there is an error in how conditions are evaluated. This could be due to incorrect data in the
variable_poolor incorrect condition definitions. Verify that the conditions are set up correctly using the supported condition types such as "Contains", "Not contains", "Start with", "End with", "Is", "Is not", "Is empty", and "Is not empty" [2]. -
Fallback Logic: If the new cases structure is not used, the fallback logic might be incorrectly triggering both branches. Ensure that the conditions and logical operators in the fallback logic are correctly defined [1].
-
Variable Pool Configuration: Review the
variable_poolto ensure that it is correctly configured with the necessary variables and values for condition evaluation. Thevariable_poolshould accurately reflect the inputs and expected conditions for your workflow [3].
By addressing these areas, you should be able to resolve the issue of both branches being triggered. If the problem persists, further investigation into the specific conditions and data used in your workflow might be necessary.
To continue talking to Dosu, mention @dosu.
I think this can be resolved by adding a variable aggregator node before the template node.
I think this can be resolved by adding a variable aggregator node before the template node.
not working for me.
I also encountered this problem. When there are two or more nodes connect to a if-else node, all answer nodes after the if-else node will be triggered. A workaround is to add a template node before the if-else node so that there is only one node connects to the if-else node.
Before:
After:
@laipz8200 @crazywoola This is fixed too