mirror of
https://github.com/langgenius/dify.git
synced 2025-11-24 00:42:41 +00:00
fix: var type error in cal var type in data source type
This commit is contained in:
parent
350ea6be6e
commit
2acdb0a4ea
@ -830,12 +830,20 @@ export const getVarType = ({
|
|||||||
const isSystem = isSystemVar(valueSelector)
|
const isSystem = isSystemVar(valueSelector)
|
||||||
const isEnv = isENV(valueSelector)
|
const isEnv = isENV(valueSelector)
|
||||||
const isChatVar = isConversationVar(valueSelector)
|
const isChatVar = isConversationVar(valueSelector)
|
||||||
const isRagVariable = isRagVariableVar(valueSelector)
|
const isSharedRagVariable = isRagVariableVar(valueSelector) && valueSelector[1] === 'shared'
|
||||||
|
const isInNodeRagVariable = isRagVariableVar(valueSelector) && valueSelector[1] !== 'shared'
|
||||||
|
|
||||||
const startNode = availableNodes.find((node: any) => {
|
const startNode = availableNodes.find((node: any) => {
|
||||||
return node?.data.type === BlockEnum.Start
|
return node?.data.type === BlockEnum.Start
|
||||||
})
|
})
|
||||||
|
|
||||||
const targetVarNodeId = isSystem ? startNode?.id : valueSelector[0]
|
const targetVarNodeId = (() => {
|
||||||
|
if(isSystem)
|
||||||
|
return startNode?.id
|
||||||
|
if(isInNodeRagVariable)
|
||||||
|
return valueSelector[1]
|
||||||
|
return valueSelector[0]
|
||||||
|
})()
|
||||||
const targetVar = beforeNodesOutputVars.find(v => v.nodeId === targetVarNodeId)
|
const targetVar = beforeNodesOutputVars.find(v => v.nodeId === targetVarNodeId)
|
||||||
|
|
||||||
if (!targetVar)
|
if (!targetVar)
|
||||||
@ -844,14 +852,21 @@ export const getVarType = ({
|
|||||||
let type: VarType = VarType.string
|
let type: VarType = VarType.string
|
||||||
let curr: any = targetVar.vars
|
let curr: any = targetVar.vars
|
||||||
|
|
||||||
if (isSystem || isEnv || isChatVar || isRagVariable) {
|
if (isSystem || isEnv || isChatVar || isSharedRagVariable) {
|
||||||
return curr.find((v: any) => v.variable === (valueSelector as ValueSelector).join('.'))?.type
|
return curr.find((v: any) => v.variable === (valueSelector as ValueSelector).join('.'))?.type
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const targetVar = curr.find((v: any) => v.variable === valueSelector[1])
|
const targetVar = curr.find((v: any) => {
|
||||||
|
if(isInNodeRagVariable)
|
||||||
|
return v.variable === valueSelector.join('.')
|
||||||
|
return v.variable === valueSelector[1]
|
||||||
|
})
|
||||||
if (!targetVar)
|
if (!targetVar)
|
||||||
return VarType.string
|
return VarType.string
|
||||||
|
|
||||||
|
if(isInNodeRagVariable)
|
||||||
|
return targetVar.type
|
||||||
|
|
||||||
const isStructuredOutputVar = !!targetVar.children?.schema?.properties
|
const isStructuredOutputVar = !!targetVar.children?.schema?.properties
|
||||||
if (isStructuredOutputVar) {
|
if (isStructuredOutputVar) {
|
||||||
if (valueSelector.length === 2) { // root
|
if (valueSelector.length === 2) { // root
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user