mirror of https://github.com/langgenius/dify.git
refactor(use-checklist, variable-utils): update dependencies in hooks and enhance human-input node support
This commit is contained in:
parent
b24fafe901
commit
2fa688cefd
|
|
@ -249,7 +249,7 @@ export const useChecklist = (nodes: Node[], edges: Edge[]) => {
|
|||
})
|
||||
|
||||
return list
|
||||
}, [nodes, nodesExtraData, edges, buildInTools, customTools, workflowTools, language, dataSourceList, getToolIcon, strategyProviders, getCheckData, t, map, shouldCheckStartNode])
|
||||
}, [nodes, edges, shouldCheckStartNode, nodesExtraData, buildInTools, customTools, workflowTools, language, dataSourceList, triggerPlugins, getToolIcon, strategyProviders, getCheckData, t, map])
|
||||
|
||||
return needWarningNodes
|
||||
}
|
||||
|
|
@ -419,7 +419,7 @@ export const useChecklistBeforePublish = () => {
|
|||
}
|
||||
|
||||
return true
|
||||
}, [store, notify, t, language, nodesExtraData, strategyProviders, updateDatasetsDetail, getCheckData, workflowStore, buildInTools, customTools, workflowTools, shouldCheckStartNode])
|
||||
}, [store, workflowStore, getNodesAvailableVarList, shouldCheckStartNode, nodesExtraData, notify, t, updateDatasetsDetail, buildInTools, customTools, workflowTools, language, getCheckData, strategyProviders])
|
||||
|
||||
return {
|
||||
handleCheckBeforePublish,
|
||||
|
|
|
|||
|
|
@ -1311,7 +1311,6 @@ const replaceOldVarInText = (
|
|||
)
|
||||
}
|
||||
|
||||
// todo: add human-input node support
|
||||
export const getNodeUsedVars = (node: Node): ValueSelector[] => {
|
||||
const { data } = node
|
||||
const { type } = data
|
||||
|
|
@ -1503,12 +1502,18 @@ export const getNodeUsedVars = (node: Node): ValueSelector[] => {
|
|||
res = valueSelectors
|
||||
break
|
||||
}
|
||||
|
||||
case BlockEnum.HumanInput: {
|
||||
const payload = data as HumanInputNodeType
|
||||
const formContent = payload.form_content
|
||||
res = matchNotSystemVars([formContent])
|
||||
break
|
||||
}
|
||||
}
|
||||
return res || []
|
||||
}
|
||||
|
||||
// can be used in iteration node
|
||||
// todo: add human-input node
|
||||
export const getNodeUsedVarPassToServerKey = (
|
||||
node: Node,
|
||||
valueSelector: ValueSelector,
|
||||
|
|
@ -1602,6 +1607,11 @@ export const getNodeUsedVarPassToServerKey = (
|
|||
res = 'query'
|
||||
break
|
||||
}
|
||||
|
||||
case BlockEnum.HumanInput: {
|
||||
res = `#${valueSelector.join('.')}#`
|
||||
break
|
||||
}
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
|
@ -1619,7 +1629,6 @@ export const findUsedVarNodes = (
|
|||
return res
|
||||
}
|
||||
|
||||
// todo: add human-input node
|
||||
export const updateNodeVars = (
|
||||
oldNode: Node,
|
||||
oldVarSelector: ValueSelector,
|
||||
|
|
@ -1939,6 +1948,15 @@ export const updateNodeVars = (
|
|||
payload.variable = newVarSelector
|
||||
break
|
||||
}
|
||||
case BlockEnum.HumanInput: {
|
||||
const payload = data as HumanInputNodeType
|
||||
payload.form_content = replaceOldVarInText(
|
||||
payload.form_content,
|
||||
oldVarSelector,
|
||||
newVarSelector,
|
||||
)
|
||||
break
|
||||
}
|
||||
}
|
||||
})
|
||||
return newNode
|
||||
|
|
|
|||
Loading…
Reference in New Issue