dify icon indicating copy to clipboard operation
dify copied to clipboard

The chatbot workflow returns answers containing other branches

Open LarchLiu opened this issue 3 months ago • 1 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

v0.11.1

Cloud or Self Hosted

Cloud, Self Hosted (Docker)

Steps to reproduce

dify-bug As shown in the diagram above, when input class b is entered, it outputs Class AClass B. The answers from other branches are also outputted together. Based on my tests, the output is correct if there is no Variable Aggregator node.

P.S v0.10.1 is ok even with Variable Aggregator node.

Test

Workflow DSL
app:
  description: ''
  icon: 🤖
  icon_background: '#FFEAD5'
  mode: advanced-chat
  name: test
  use_icon_as_answer_icon: false
kind: app
version: 0.1.3
workflow:
  conversation_variables:
  - description: ''
    id: 603c742e-24c3-4081-aed5-bb8d1ce36a7a
    name: str
    value: ''
    value_type: string
  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: false
    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: if-else
      id: 1731334661852-source-1731334672471-target
      source: '1731334661852'
      sourceHandle: source
      target: '1731334672471'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: if-else
        targetType: question-classifier
      id: 1731334672471-false-1731335916748-target
      source: '1731334672471'
      sourceHandle: 'false'
      target: '1731335916748'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: question-classifier
        targetType: answer
      id: 1731335916748-2-1731334706164-target
      source: '1731335916748'
      sourceHandle: '2'
      target: '1731334706164'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: question-classifier
        targetType: assigner
      id: 1731335916748-1-1731336197596-target
      source: '1731335916748'
      sourceHandle: '1'
      target: '1731336197596'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: assigner
        targetType: answer
      id: 1731336197596-source-answer-target
      source: '1731336197596'
      sourceHandle: source
      target: answer
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: if-else
        targetType: assigner
      id: 1731334672471-true-1731336197596-target
      source: '1731334672471'
      sourceHandle: 'true'
      target: '1731336197596'
      targetHandle: target
      type: custom
      zIndex: 0
    nodes:
    - data:
        desc: ''
        selected: false
        title: Start
        type: start
        variables: []
      height: 54
      id: '1731334661852'
      position:
        x: 144.69474430647074
        y: 278.27494676871834
      positionAbsolute:
        x: 144.69474430647074
        y: 278.27494676871834
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
    - data:
        answer: Class A
        desc: ''
        selected: false
        title: Answer
        type: answer
        variables: []
      height: 100
      id: answer
      position:
        x: 790.6938164621216
        y: 370.68627082784076
      positionAbsolute:
        x: 790.6938164621216
        y: 370.68627082784076
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
    - data:
        cases:
        - case_id: 'true'
          conditions:
          - comparison_operator: contains
            id: 8bad7a47-1ea2-4eb0-8dd4-83da2228aefe
            value: class a
            varType: string
            variable_selector:
            - sys
            - query
          id: 'true'
          logical_operator: and
        desc: ''
        selected: false
        title: 'IF/ELSE '
        type: if-else
      height: 126
      id: '1731334672471'
      position:
        x: 144.69474430647074
        y: 424.79370719913084
      positionAbsolute:
        x: 144.69474430647074
        y: 424.79370719913084
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
    - data:
        answer: Class B
        desc: ''
        selected: false
        title: Answer 2
        type: answer
        variables: []
      height: 100
      id: '1731334706164'
      position:
        x: 543.5986187871038
        y: 739.7625740921067
      positionAbsolute:
        x: 543.5986187871038
        y: 739.7625740921067
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
    - data:
        classes:
        - id: '1'
          name: class A
        - id: '2'
          name: class B
        desc: ''
        instructions: ''
        model:
          completion_params:
            temperature: 0.7
          mode: chat
          name: gpt-3.5-turbo
          provider: openai
        query_variable_selector:
        - '1731334661852'
        - sys.query
        selected: false
        title: 'Question Classifier '
        topics: []
        type: question-classifier
        vision:
          enabled: false
      height: 176
      id: '1731335916748'
      position:
        x: 144.69474430647074
        y: 656.5697185934825
      positionAbsolute:
        x: 144.69474430647074
        y: 656.5697185934825
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
    - data:
        assigned_variable_selector:
        - conversation
        - str
        desc: ''
        input_variable_selector:
        - sys
        - query
        selected: true
        title: Variable Aggregator
        type: assigner
        write_mode: over-write
      height: 132
      id: '1731336197596'
      position:
        x: 511.314824115996
        y: 347.09426702972354
      positionAbsolute:
        x: 511.314824115996
        y: 347.09426702972354
      selected: true
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
    viewport:
      x: -68.04491865859256
      y: -74.0413060355445
      zoom: 0.8053576187333558

✔️ Expected Behavior

Just return Class B

❌ Actual Behavior

The output is Class AClass B

LarchLiu avatar Nov 11 '24 15:11 LarchLiu