Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There is a bug in condition branch node #11037

Closed
5 tasks done
RoyDingZF opened this issue Nov 24, 2024 · 5 comments
Closed
5 tasks done

There is a bug in condition branch node #11037

RoyDingZF opened this issue Nov 24, 2024 · 5 comments
Labels
🐞 bug Something isn't working

Comments

@RoyDingZF
Copy link

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • 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.
屏幕截图 2024-11-24 200117
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

@dosubot dosubot bot added the 🐞 bug Something isn't working label Nov 24, 2024
Copy link

dosubot bot commented Nov 24, 2024

@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:

  1. 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].

  2. Condition Evaluation Error: Check if there is an error in how conditions are evaluated. This could be due to incorrect data in the variable_pool or 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].

  3. 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].

  4. Variable Pool Configuration: Review the variable_pool to ensure that it is correctly configured with the necessary variables and values for condition evaluation. The variable_pool should 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.

@crazywoola
Copy link
Member

I think this can be resolved by adding a variable aggregator node before the template node.

@RoyDingZF
Copy link
Author

I think this can be resolved by adding a variable aggregator node before the template node.

not working for me.
屏幕截图 2024-11-24 220841

@Leheng620
Copy link
Contributor

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.

image

Before:
image

After:
image

@yihong0618
Copy link
Contributor

@laipz8200 @crazywoola This is fixed too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants