mirror of
https://github.com/langgenius/dify.git
synced 2026-05-13 08:57:28 +08:00
fix: not show sys var type
This commit is contained in:
parent
f3bf4c7730
commit
978ee93df7
@ -97,27 +97,32 @@ const VarReferencePicker: FC<Props> = ({
|
|||||||
const getVarType = () => {
|
const getVarType = () => {
|
||||||
if (isConstant)
|
if (isConstant)
|
||||||
return 'undefined'
|
return 'undefined'
|
||||||
|
const isSystem = isSystemVar(value as ValueSelector)
|
||||||
const targetVarNodeId = isSystemVar(value as ValueSelector) ? startNode?.id : outputVarNodeId
|
const targetVarNodeId = isSystem ? startNode?.id : outputVarNodeId
|
||||||
const targetVar = allOutputVars.find(v => v.nodeId === targetVarNodeId)
|
const targetVar = allOutputVars.find(v => v.nodeId === targetVarNodeId)
|
||||||
|
|
||||||
if (!targetVar)
|
if (!targetVar)
|
||||||
return 'undefined'
|
return 'undefined'
|
||||||
|
|
||||||
let type: VarType = VarType.string
|
let type: VarType = VarType.string
|
||||||
let curr: any = targetVar.vars;
|
let curr: any = targetVar.vars
|
||||||
(value as ValueSelector).slice(1).forEach((key, i) => {
|
if (isSystem) {
|
||||||
const isLast = i === value.length - 2
|
return curr.find((v: any) => v.variable === (value as ValueSelector).join('.'))?.type
|
||||||
curr = curr.find((v: any) => v.variable === key)
|
}
|
||||||
if (isLast) {
|
else {
|
||||||
type = curr?.type
|
(value as ValueSelector).slice(1).forEach((key, i) => {
|
||||||
}
|
const isLast = i === value.length - 2
|
||||||
else {
|
curr = curr.find((v: any) => v.variable === key)
|
||||||
if (curr.type === VarType.object)
|
if (isLast) {
|
||||||
curr = curr.children
|
type = curr?.type
|
||||||
}
|
}
|
||||||
})
|
else {
|
||||||
return type
|
if (curr.type === VarType.object)
|
||||||
|
curr = curr.children
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return type
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const varKindTypes = [
|
const varKindTypes = [
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user