dify icon indicating copy to clipboard operation
dify copied to clipboard

The problem classifier will perform on all nodes

Open CarltonHere opened this issue 9 months ago • 5 comments

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

1.1.0

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

Image

✔️ Expected Behavior

Run only the correct branch according to the green path

❌ Actual Behavior

The problem classifier shows correctly on the flowchart, but it actually runs all branches.

CarltonHere avatar Mar 19 '25 11:03 CarltonHere

The DSL file

app:
  description: ''
  icon: 🤖
  icon_background: '#FFEAD5'
  mode: advanced-chat
  name: Minimum test unit
  use_icon_as_answer_icon: false
dependencies:
- current_identifier: null
  type: marketplace
  value:
    marketplace_plugin_unique_identifier: langgenius/tongyi:0.0.12@0e4f4caf2002b8fa6de179abf3e8b91b640324921982e9999d96967474f43e18
kind: app
version: 0.1.5
workflow:
  conversation_variables: []
  environment_variables: []
  features:
    file_upload:
      allowed_file_extensions:
      - .JPG
      - .JPEG
      - .PNG
      - .GIF
      - .WEBP
      - .SVG
      allowed_file_types:
      - image
      allowed_file_upload_methods:
      - local_file
      - remote_url
      enabled: false
      fileUploadConfig:
        audio_file_size_limit: 50
        batch_count_limit: 5
        file_size_limit: 15
        image_file_size_limit: 10
        video_file_size_limit: 100
        workflow_file_upload_limit: 10
      image:
        enabled: false
        number_limits: 3
        transfer_methods:
        - local_file
        - remote_url
      number_limits: 3
    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
        isInLoop: false
        sourceType: start
        targetType: answer
      id: 1742382361944-source-1742382401920-target
      source: '1742382361944'
      sourceHandle: source
      target: '1742382401920'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: answer
        targetType: question-classifier
      id: 1742382401920-source-1742382406742-target
      source: '1742382401920'
      sourceHandle: source
      target: '1742382406742'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: question-classifier
        targetType: llm
      id: 1742382406742-1-1742382460532-target
      source: '1742382406742'
      sourceHandle: '1'
      target: '1742382460532'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: question-classifier
        targetType: question-classifier
      id: 1742382406742-1-1742382480077-target
      source: '1742382406742'
      sourceHandle: '1'
      target: '1742382480077'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: question-classifier
        targetType: answer
      id: 1742382480077-1-1742382531085-target
      source: '1742382480077'
      sourceHandle: '1'
      target: '1742382531085'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: question-classifier
        targetType: answer
      id: 1742382480077-2-1742382534798-target
      source: '1742382480077'
      sourceHandle: '2'
      target: '1742382534798'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: question-classifier
        targetType: answer
      id: 1742382480077-1742382525856-1742382538517-target
      source: '1742382480077'
      sourceHandle: '1742382525856'
      target: '1742382538517'
      targetHandle: target
      type: custom
      zIndex: 0
    nodes:
    - data:
        desc: ''
        selected: false
        title: 开始
        type: start
        variables: []
      height: 53
      id: '1742382361944'
      position:
        x: 80
        y: 282
      positionAbsolute:
        x: 80
        y: 282
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        answer: '### 我正在理解您的问题请稍等🧠🧠🧠

          '
        desc: ''
        selected: false
        title: 直接回复
        type: answer
        variables: []
      height: 117
      id: '1742382401920'
      position:
        x: 383
        y: 282
      positionAbsolute:
        x: 383
        y: 282
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        classes:
        - id: '1'
          name: 是税务相关问题
        - id: '2'
          name: 不是税务相关问题
        desc: ''
        instruction: ''
        instructions: ''
        model:
          completion_params:
            temperature: 0.7
          mode: chat
          name: qwen-max-latest
          provider: langgenius/tongyi/tongyi
        query_variable_selector:
        - '1742382361944'
        - sys.query
        selected: false
        title: 问题分类器
        topics: []
        type: question-classifier
        vision:
          enabled: false
      height: 171
      id: '1742382406742'
      position:
        x: 686
        y: 282
      positionAbsolute:
        x: 686
        y: 282
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        context:
          enabled: false
          variable_selector: []
        desc: ''
        model:
          completion_params:
            temperature: 0.7
          mode: chat
          name: qwen-max-latest
          provider: langgenius/tongyi/tongyi
        prompt_template:
        - id: 3ccf5c41-e58c-45eb-b610-6d7002d31d24
          role: system
          text: 你是一个非常有经验的税务专家,解答用户的问题
        - id: be521ed7-943d-4500-9503-55c5fa43f803
          role: user
          text: '{{#sys.query#}}'
        selected: false
        title: LLM
        type: llm
        variables: []
        vision:
          enabled: false
      height: 89
      id: '1742382460532'
      position:
        x: 989
        y: 282
      positionAbsolute:
        x: 989
        y: 282
      selected: true
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        classes:
        - id: '1'
          name: 增值税
        - id: '2'
          name: 印花税
        - id: '1742382525856'
          name: 其他
        desc: ''
        instruction: ''
        instructions: ''
        model:
          completion_params:
            temperature: 0.7
          mode: chat
          name: qwen-max-latest
          provider: langgenius/tongyi/tongyi
        query_variable_selector:
        - '1742382361944'
        - sys.query
        selected: false
        title: 问题分类器 2
        topics: []
        type: question-classifier
        vision:
          enabled: false
      height: 209
      id: '1742382480077'
      position:
        x: 989
        y: 410
      positionAbsolute:
        x: 989
        y: 410
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        answer: '增值税:{{#sys.query#}}

          '
        desc: ''
        selected: false
        title: 直接回复 2
        type: answer
        variables: []
      height: 104
      id: '1742382531085'
      position:
        x: 1292
        y: 410
      positionAbsolute:
        x: 1292
        y: 410
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        answer: '印花税:{{#sys.query#}}

          '
        desc: ''
        selected: false
        title: 直接回复 3
        type: answer
        variables: []
      height: 104
      id: '1742382534798'
      position:
        x: 1292
        y: 550
      positionAbsolute:
        x: 1292
        y: 550
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        answer: '其他:{{#sys.query#}}

          '
        desc: ''
        selected: false
        title: 直接回复 4
        type: answer
        variables: []
      height: 104
      id: '1742382538517'
      position:
        x: 1292
        y: 690
      positionAbsolute:
        x: 1292
        y: 690
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    viewport:
      x: 97.80114691770643
      y: 50.40037330669551
      zoom: 0.757858283255199

CarltonHere avatar Mar 19 '25 11:03 CarltonHere

Hey @CarltonHere! I'm here to help you with your DSL file issue. Let's squash those bugs together! 🤖

I found a similar issue related to the problem classifier running all branches instead of only the correct one. In Dify 0.13.2, a known issue occurs when multiple paths from an IF/ELSE statement connect to the same problem classifier, causing it to execute all paths. A temporary workaround is to add an empty component (like assigning a value to an empty variable) in all paths between IF/ELSE branches to prevent this behavior [1].

Additionally, there was a closed issue where the chatbot workflow returned answers containing other branches. This was resolved by fixing the answer node stream processing in conditional branches [2]. You might want to check if a similar fix applies to your version or if a workaround can be implemented based on these insights.

To continue talking to Dosu, mention @dosu.


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

dosubot[bot] avatar Mar 19 '25 11:03 dosubot[bot]

Hey @CarltonHere! I'm here to help you with your DSL file issue. Let's squash those bugs together! 🤖

I found a similar issue related to the problem classifier running all branches instead of only the correct one. In Dify 0.13.2, a known issue occurs when multiple paths from an IF/ELSE statement connect to the same problem classifier, causing it to execute all paths. A temporary workaround is to add an empty component (like assigning a value to an empty variable) in all paths between IF/ELSE branches to prevent this behavior [1].

Additionally, there was a closed issue where the chatbot workflow returned answers containing other branches. This was resolved by fixing the answer node stream processing in conditional branches [2]. You might want to check if a similar fix applies to your version or if a workaround can be implemented based on these insights.

To continue talking to Dosu, mention @dosu.

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

Thanks, adding an empty component does work, but it can be confirmed that this is a BUG, hoping to be thoroughly resolved. Image

CarltonHere avatar Mar 19 '25 11:03 CarltonHere

i have the same issue after updated to Cloud PRO v1.1 Also the if/else node always show all answers

acauaferreira avatar Mar 19 '25 14:03 acauaferreira

For me also works to add an empty variable assigner before EVERY ANSWER inside my workflow... A lot of time wasted to stop everything and manually fix this bug inside all workflows...

acauaferreira avatar Mar 19 '25 14:03 acauaferreira