langgenius / dify

Dify is an open-source LLM app development platform. Dify's intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production.
https://dify.ai
Other
49.4k stars 7.06k forks source link

Include branch node stream output not working #9852

Open majian159 opened 2 hours ago

majian159 commented 2 hours ago

Self Checks

Dify version

0.10.1

Cloud or Self Hosted

Cloud, Self Hosted (Docker)

Steps to reproduce

DSL:

app:
  description: ''
  icon: 🤖
  icon_background: '#FFEAD5'
  mode: advanced-chat
  name: Dify 多分支流式bug
  use_icon_as_answer_icon: false
kind: app
version: 0.1.2
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
      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: llm
        targetType: answer
      id: 1729824788897-source-1729824802941-target
      selected: false
      source: '1729824788897'
      sourceHandle: source
      target: '1729824802941'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: start
        targetType: if-else
      id: 1729820644004-source-1729825752321-target
      source: '1729820644004'
      sourceHandle: source
      target: '1729825752321'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: if-else
        targetType: template-transform
      id: 1729825752321-false-1729824706299-target
      source: '1729825752321'
      sourceHandle: 'false'
      target: '1729824706299'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: if-else
        targetType: template-transform
      id: 1729825752321-true-1729825876844-target
      source: '1729825752321'
      sourceHandle: 'true'
      target: '1729825876844'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: template-transform
        targetType: llm
      id: 1729824706299-source-1729824788897-target
      source: '1729824706299'
      sourceHandle: source
      target: '1729824788897'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: template-transform
        targetType: llm
      id: 1729825876844-source-1729824788897-target
      source: '1729825876844'
      sourceHandle: source
      target: '1729824788897'
      targetHandle: target
      type: custom
      zIndex: 0
    nodes:
    - data:
        desc: ''
        selected: false
        title: 开始
        type: start
        variables: []
      height: 52
      id: '1729820644004'
      position:
        x: 30
        y: 268
      positionAbsolute:
        x: 30
        y: 268
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        desc: ''
        selected: false
        template: '{{ 1 }}'
        title: 模板转换
        type: template-transform
        variables: []
      height: 52
      id: '1729824706299'
      position:
        x: 636
        y: 268
      positionAbsolute:
        x: 636
        y: 268
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        context:
          enabled: false
          variable_selector: []
        desc: ''
        model:
          completion_params:
            temperature: 0.7
          mode: chat
          name: gpt-4o
          provider: openai
        prompt_template:
        - id: 5f49010b-fd39-4da0-835f-2e1e0fd00d6e
          role: system
          text: 回答问题
        - id: a93f129e-e36d-4152-a25f-2f48e8d71f98
          role: user
          text: '{{#sys.query#}}'
        selected: false
        title: LLM
        type: llm
        variables: []
        vision:
          enabled: false
      height: 96
      id: '1729824788897'
      position:
        x: 1242
        y: 268
      positionAbsolute:
        x: 1242
        y: 268
      selected: true
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        answer: '{{#1729824788897.text#}}'
        desc: ''
        selected: false
        title: 直接回复
        type: answer
        variables: []
      height: 101
      id: '1729824802941'
      position:
        x: 1545
        y: 268
      positionAbsolute:
        x: 1545
        y: 268
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        cases:
        - case_id: 'true'
          conditions:
          - comparison_operator: empty
            id: daac28d1-868a-4bfc-86d5-514fb7800558
            value: ''
            varType: string
            variable_selector:
            - sys
            - query
          id: 'true'
          logical_operator: and
        desc: ''
        selected: false
        title: 条件分支
        type: if-else
      height: 124
      id: '1729825752321'
      position:
        x: 333
        y: 268
      positionAbsolute:
        x: 333
        y: 268
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    - data:
        desc: ''
        selected: false
        template: '{{ 2 }}'
        title: 模板转换 2
        type: template-transform
        variables: []
      height: 52
      id: '1729825876844'
      position:
        x: 636
        y: 360
      positionAbsolute:
        x: 636
        y: 360
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 243
    viewport:
      x: -66.99612827501005
      y: 97.09133860246311
      zoom: 0.7712872040412053

✔️ Expected Behavior

stream output

❌ Actual Behavior

block output

dosubot[bot] commented 2 hours ago

The issue you're experiencing with the 'stream output' not working and instead getting a 'block output' in Dify's workflow execution is likely related to the configuration of the response_mode parameter. To achieve a streaming output, ensure that the response_mode is set to streaming in your workflow configuration. If it's set to blocking, the output will be returned only after the execution is complete, which is the behavior you're currently observing [1][2].

Check your workflow configuration to ensure that the response_mode is correctly set to streaming where applicable. This should enable the expected stream output behavior.

To continue talking to Dosu, mention @dosu.