Only at most 3 LLMs results can be in Answer component, so weird bug
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] 请务必使用英文提交 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
@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.
This robot is very annoying. Don't you realize that? The probability that the robot can solve the problem is very low
@Aryavui I can't reproduction it. Can you provide an app DSL?