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

The node can't be executed if it is connected to both the if and else branches. #12592

Open
5 tasks done
liuzhenghua opened this issue Jan 10, 2025 · 1 comment · May be fixed by #12593
Open
5 tasks done

The node can't be executed if it is connected to both the if and else branches. #12592

liuzhenghua opened this issue Jan 10, 2025 · 1 comment · May be fixed by #12593
Labels
🌊 feat:workflow Workflow related stuff.

Comments

@liuzhenghua
Copy link
Contributor

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.9.2

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

The node can't be executed if it is connected to both the if and else branches.

app:
  description: ''
  icon: 🤖
  icon_background: '#FFEAD5'
  mode: advanced-chat
  name: 并行流问题验证
  use_icon_as_answer_icon: false
kind: app
version: 0.1.2
workflow:
  conversation_variables: []
  environment_variables: []
  features:
    file_upload:
      image:
        enabled: false
        number_limits: 3
        transfer_methods:
        - local_file
        - remote_url
    opening_statement: ''
    retriever_resource:
      enabled: true
    sensitive_word_avoidance:
      enabled: false
    speech_to_text:
      enabled: false
    suggested_questions: []
    suggested_questions_after_answer:
      enabled: false
    text_to_speech:
      enabled: false
      language: ''
      voice: ''
  graph:
    edges:
    - data:
        isInIteration: false
        sourceType: start
        targetType: code
      id: 1736483932029-source-1736484018043-target
      source: '1736483932029'
      sourceHandle: source
      target: '1736484018043'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: start
        targetType: if-else
      id: 1736483932029-source-1736484036958-target
      source: '1736483932029'
      sourceHandle: source
      target: '1736484036958'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: if-else
        targetType: answer
      id: 1736484036958-true-1736484058927-target
      source: '1736484036958'
      sourceHandle: 'true'
      target: '1736484058927'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: if-else
        targetType: code
      id: 1736484036958-false-1736484106283-target
      source: '1736484036958'
      sourceHandle: 'false'
      target: '1736484106283'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: code
        targetType: answer
      id: 1736484018043-source-answer-target
      source: '1736484018043'
      sourceHandle: source
      target: answer
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: code
        targetType: answer
      id: 1736484106283-source-answer-target
      source: '1736484106283'
      sourceHandle: source
      target: answer
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: if-else
        targetType: code
      id: 1736484036958-true-1736484106283-target
      source: '1736484036958'
      sourceHandle: 'true'
      target: '1736484106283'
      targetHandle: target
      type: custom
      zIndex: 0
    nodes:
    - data:
        desc: ''
        selected: false
        title: 开始
        type: start
        variables: []
      height: 53
      id: '1736483932029'
      position:
        x: 80
        y: 282
      positionAbsolute:
        x: 80
        y: 282
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        answer: 'result 1: {{#1736484018043.result#}}

          result 2: {{#1736484106283.result#}}'
        desc: ''
        selected: false
        title: 直接回复
        type: answer
        variables: []
      height: 125
      id: answer
      position:
        x: 1111
        y: 427
      positionAbsolute:
        x: 1111
        y: 427
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        code: "\ndef main() -> dict:\n    return {\n        \"result\": 1,\n    }\n"
        code_language: python3
        desc: ''
        outputs:
          result:
            children: null
            type: number
        selected: false
        title: 代码执行1
        type: code
        variables: []
      height: 53
      id: '1736484018043'
      position:
        x: 500
        y: 155
      positionAbsolute:
        x: 500
        y: 155
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        cases:
        - case_id: 'true'
          conditions:
          - comparison_operator: contains
            id: e2cd4e17-0b5b-4512-ade8-b0ce699964c9
            value: test parallel
            varType: string
            variable_selector:
            - sys
            - query
          id: 'true'
          logical_operator: and
        desc: ''
        selected: false
        title: 条件分支
        type: if-else
      height: 125
      id: '1736484036958'
      position:
        x: 387
        y: 413
      positionAbsolute:
        x: 387
        y: 413
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        answer: IF
        desc: ''
        selected: false
        title: 直接回复 2
        type: answer
        variables: []
      height: 103
      id: '1736484058927'
      position:
        x: 690
        y: 413
      positionAbsolute:
        x: 690
        y: 413
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        code: "\ndef main() -> dict:\n    return {\n        \"result\": 2,\n    }\n"
        code_language: python3
        desc: ''
        outputs:
          result:
            children: null
            type: number
        selected: false
        title: 代码执行 2
        type: code
        variables: []
      height: 53
      id: '1736484106283'
      position:
        x: 690
        y: 555
      positionAbsolute:
        x: 690
        y: 555
      selected: true
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    viewport:
      x: 43.85324998620399
      y: 160.05043883833406
      zoom: 0.6597539553864471

✔️ Expected Behavior

代码执行2 node can be executed.
image

❌ Actual Behavior

代码执行2 node can not be executed.
image

@dosubot dosubot bot added the 🌊 feat:workflow Workflow related stuff. label Jan 10, 2025
Copy link

dosubot bot commented Jan 10, 2025

In Dify version 0.9.2, the issue where a node cannot be executed when connected to both the if and else branches is a known problem. This occurs because the condition of the second branch becomes invalid when multiple paths connect the IF/ELSE branches, leading to the execution of all subsequent paths.

To address this, you can try the following workaround:

  1. Add an Empty Component: Insert an empty component, such as an empty variable assignment, in all paths between the IF/ELSE branches. This can help prevent the condition from becoming invalid and ensure that the correct path is executed.

This workaround is based on a similar issue observed in later versions of Dify, and it might help mitigate the problem in version 0.9.2 as well [1].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

liuzhenghua added a commit to liuzhenghua/dify that referenced this issue Jan 10, 2025
@liuzhenghua liuzhenghua linked a pull request Jan 10, 2025 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌊 feat:workflow Workflow related stuff.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant