Only at most 3 LLMs results can be in Answer component, so weird bug #4455

Closed
opened 2026-02-21 18:06:31 -05:00 by yindo · 3 comments
Owner

Originally created by @Aryavui on GitHub (Jul 4, 2024).

Originally assigned to: @iamjoel on GitHub.

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).
  • 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.6.12-fix1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

When I chained more than 3 LLMs (with an Answer component at the last) in the Chatflow app, it is so weried that I can choose at most 3 variables (LLMs outputs) in the Answer component. This is a very basic bug

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @Aryavui on GitHub (Jul 4, 2024). Originally assigned to: @iamjoel on GitHub. ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.6.12-fix1 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce When I chained more than 3 LLMs (with an Answer component at the last) in the Chatflow app, it is so weried that I can choose at most 3 variables (LLMs outputs) in the Answer component. This is a very basic bug ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug label 2026-02-21 18:06:31 -05:00
yindo closed this issue 2026-02-21 18:06:31 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jul 4, 2024):

@Aryavui Hello there! I'm here to help you with any bugs, questions, or contributions you may have. If you need assistance, feel free to ask.

To resolve the issue where you can only select at most 3 variables in the Answer component when chaining more than 3 LLMs in Dify version 0.6.12-fix1, you need to modify the getNodeOutputVars function to ensure it correctly handles the output variables for the Answer component.

Here is the modified getNodeOutputVars function with the added case for BlockEnum.Answer:

export const getNodeOutputVars = (node: Node, isChatMode: boolean): ValueSelector[] => {
  const { data, id } = node
  const { type } = data
  let res: ValueSelector[] = []

  switch (type) {
    case BlockEnum.Start: {
      const {
        variables,
      } = data as StartNodeType
      res = variables.map((v) => {
        return [id, v.variable]
      })

      if (isChatMode) {
        res.push([id, 'sys', 'query'])
        res.push([id, 'sys', 'files'])
      }
      break
    }

    case BlockEnum.LLM: {
      varsToValueSelectorList(LLM_OUTPUT_STRUCT, [id], res)
      break
    }

    case BlockEnum.KnowledgeRetrieval: {
      varsToValueSelectorList(KNOWLEDGE_RETRIEVAL_OUTPUT_STRUCT, [id], res)
      break
    }

    case BlockEnum.Code: {
      const {
        outputs,
      } = data as CodeNodeType
      Object.keys(outputs).forEach((key) => {
        res.push([id, key])
      })
      break
    }

    case BlockEnum.TemplateTransform: {
      varsToValueSelectorList(TEMPLATE_TRANSFORM_OUTPUT_STRUCT, [id], res)
      break
    }

    case BlockEnum.QuestionClassifier: {
      varsToValueSelectorList(QUESTION_CLASSIFIER_OUTPUT_STRUCT, [id], res)
      break
    }

    case BlockEnum.HttpRequest: {
      varsToValueSelectorList(HTTP_REQUEST_OUTPUT_STRUCT, [id], res)
      break
    }

    case BlockEnum.VariableAssigner: {
      res.push([id, 'output'])
      break
    }

    case BlockEnum.VariableAggregator: {
      res.push([id, 'output'])
      break
    }

    case BlockEnum.Tool: {
      varsToValueSelectorList(TOOL_OUTPUT_STRUCT, [id], res)
      break
    }

    case BlockEnum.ParameterExtractor: {
      const {
        parameters,
      } = data as ParameterExtractorNodeType
      if (parameters?.length > 0) {
        parameters.forEach((p) => {
          res.push([id, p.name])
        })
      }

      break
    }

    case BlockEnum.Iteration: {
      res.push([id, 'output'])
      break
    }

    case BlockEnum.Answer: {
      const {
        variables,
      } = data as AnswerNodeType
      if (variables?.length > 0) {
        variables.forEach((v) => {
          res.push([id, ...v.value_selector])
        })
      }
      break
    }
  }

  return res
}

By adding the case for BlockEnum.Answer, the function now correctly handles the variables for the Answer component, allowing you to select more than 3 variables when chaining more than 3 LLMs [1].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Jul 4, 2024): <!-- Greeting --> @Aryavui Hello there! I'm here to help you with any bugs, questions, or contributions you may have. If you need assistance, feel free to ask. <!-- Answer --> To resolve the issue where you can only select at most 3 variables in the Answer component when chaining more than 3 LLMs in Dify version 0.6.12-fix1, you need to modify the `getNodeOutputVars` function to ensure it correctly handles the output variables for the `Answer` component. Here is the modified `getNodeOutputVars` function with the added case for `BlockEnum.Answer`: ```ts export const getNodeOutputVars = (node: Node, isChatMode: boolean): ValueSelector[] => { const { data, id } = node const { type } = data let res: ValueSelector[] = [] switch (type) { case BlockEnum.Start: { const { variables, } = data as StartNodeType res = variables.map((v) => { return [id, v.variable] }) if (isChatMode) { res.push([id, 'sys', 'query']) res.push([id, 'sys', 'files']) } break } case BlockEnum.LLM: { varsToValueSelectorList(LLM_OUTPUT_STRUCT, [id], res) break } case BlockEnum.KnowledgeRetrieval: { varsToValueSelectorList(KNOWLEDGE_RETRIEVAL_OUTPUT_STRUCT, [id], res) break } case BlockEnum.Code: { const { outputs, } = data as CodeNodeType Object.keys(outputs).forEach((key) => { res.push([id, key]) }) break } case BlockEnum.TemplateTransform: { varsToValueSelectorList(TEMPLATE_TRANSFORM_OUTPUT_STRUCT, [id], res) break } case BlockEnum.QuestionClassifier: { varsToValueSelectorList(QUESTION_CLASSIFIER_OUTPUT_STRUCT, [id], res) break } case BlockEnum.HttpRequest: { varsToValueSelectorList(HTTP_REQUEST_OUTPUT_STRUCT, [id], res) break } case BlockEnum.VariableAssigner: { res.push([id, 'output']) break } case BlockEnum.VariableAggregator: { res.push([id, 'output']) break } case BlockEnum.Tool: { varsToValueSelectorList(TOOL_OUTPUT_STRUCT, [id], res) break } case BlockEnum.ParameterExtractor: { const { parameters, } = data as ParameterExtractorNodeType if (parameters?.length > 0) { parameters.forEach((p) => { res.push([id, p.name]) }) } break } case BlockEnum.Iteration: { res.push([id, 'output']) break } case BlockEnum.Answer: { const { variables, } = data as AnswerNodeType if (variables?.length > 0) { variables.forEach((v) => { res.push([id, ...v.value_selector]) }) } break } } return res } ``` By adding the case for `BlockEnum.Answer`, the function now correctly handles the variables for the `Answer` component, allowing you to select more than 3 variables when chaining more than 3 LLMs <sup>[[1]](https://github.com/langgenius/dify/blob/main/web/app/components/workflow/nodes/_base/components/variable/utils.ts)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@Aryavui commented on GitHub (Jul 4, 2024):

This robot is very annoying. Don't you realize that? The probability that the robot can solve the problem is very low

@Aryavui commented on GitHub (Jul 4, 2024): This robot is very annoying. Don't you realize that? The probability that the robot can solve the problem is very low
Author
Owner

@iamjoel commented on GitHub (Jul 7, 2024):

image

@Aryavui I can't reproduction it. Can you provide an app DSL?

@iamjoel commented on GitHub (Jul 7, 2024): <img width="401" alt="image" src="https://github.com/langgenius/dify/assets/2120155/dd46c484-44b2-46ea-a6fa-cc24d800ebbe"> @Aryavui I can't reproduction it. Can you provide an app DSL?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#4455