mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-19 20:59:09 +08:00
fix: ts problems
This commit is contained in:
parent
94e40d4ed9
commit
e90b055c47
@ -350,7 +350,7 @@ export const toNodeOutputVars = (
|
|||||||
const res = [
|
const res = [
|
||||||
...nodes.filter(node => SUPPORT_OUTPUT_VARS_NODE.includes(node.data.type)),
|
...nodes.filter(node => SUPPORT_OUTPUT_VARS_NODE.includes(node.data.type)),
|
||||||
...(environmentVariables.length > 0 ? [ENV_NODE] : []),
|
...(environmentVariables.length > 0 ? [ENV_NODE] : []),
|
||||||
...((isChatMode && conversationVariables.length) > 0 ? [CHAT_VAR_NODE] : []),
|
...((isChatMode && conversationVariables.length > 0) ? [CHAT_VAR_NODE] : []),
|
||||||
].map((node) => {
|
].map((node) => {
|
||||||
return {
|
return {
|
||||||
...formatItem(node, isChatMode, filterVar),
|
...formatItem(node, isChatMode, filterVar),
|
||||||
@ -619,7 +619,7 @@ export const getNodeUsedVars = (node: Node): ValueSelector[] => {
|
|||||||
}
|
}
|
||||||
case BlockEnum.IfElse: {
|
case BlockEnum.IfElse: {
|
||||||
res = (data as IfElseNodeType).conditions?.map((c) => {
|
res = (data as IfElseNodeType).conditions?.map((c) => {
|
||||||
return c.variable_selector
|
return c.variable_selector || []
|
||||||
}) || []
|
}) || []
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -681,7 +681,7 @@ export const getNodeUsedVars = (node: Node): ValueSelector[] => {
|
|||||||
return res || []
|
return res || []
|
||||||
}
|
}
|
||||||
|
|
||||||
// used can be used in iteration node
|
// can be used in iteration node
|
||||||
export const getNodeUsedVarPassToServerKey = (node: Node, valueSelector: ValueSelector): string | string[] => {
|
export const getNodeUsedVarPassToServerKey = (node: Node, valueSelector: ValueSelector): string | string[] => {
|
||||||
const { data } = node
|
const { data } = node
|
||||||
const { type } = data
|
const { type } = data
|
||||||
@ -700,7 +700,7 @@ export const getNodeUsedVarPassToServerKey = (node: Node, valueSelector: ValueSe
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
case BlockEnum.IfElse: {
|
case BlockEnum.IfElse: {
|
||||||
const targetVar = (data as IfElseNodeType).conditions?.find(c => c.variable_selector.join('.') === valueSelector.join('.'))
|
const targetVar = (data as IfElseNodeType).conditions?.find(c => c.variable_selector?.join('.') === valueSelector.join('.'))
|
||||||
if (targetVar)
|
if (targetVar)
|
||||||
res = `#${valueSelector.join('.')}#`
|
res = `#${valueSelector.join('.')}#`
|
||||||
break
|
break
|
||||||
@ -821,7 +821,7 @@ export const updateNodeVars = (oldNode: Node, oldVarSelector: ValueSelector, new
|
|||||||
const payload = data as IfElseNodeType
|
const payload = data as IfElseNodeType
|
||||||
if (payload.conditions) {
|
if (payload.conditions) {
|
||||||
payload.conditions = payload.conditions.map((c) => {
|
payload.conditions = payload.conditions.map((c) => {
|
||||||
if (c.variable_selector.join('.') === oldVarSelector.join('.'))
|
if (c.variable_selector?.join('.') === oldVarSelector.join('.'))
|
||||||
c.variable_selector = newVarSelector
|
c.variable_selector = newVarSelector
|
||||||
return c
|
return c
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user