refactor(use-checklist, variable-utils): update dependencies in hooks and enhance human-input node support

This commit is contained in:
twwu
2026-01-12 15:41:25 +08:00
parent b24fafe901
commit 2fa688cefd
2 changed files with 23 additions and 5 deletions

View File

@ -249,7 +249,7 @@ export const useChecklist = (nodes: Node[], edges: Edge[]) => {
}) })
return list 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 return needWarningNodes
} }
@ -419,7 +419,7 @@ export const useChecklistBeforePublish = () => {
} }
return true 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 { return {
handleCheckBeforePublish, handleCheckBeforePublish,

View File

@ -1311,7 +1311,6 @@ const replaceOldVarInText = (
) )
} }
// todo: add human-input node support
export const getNodeUsedVars = (node: Node): ValueSelector[] => { export const getNodeUsedVars = (node: Node): ValueSelector[] => {
const { data } = node const { data } = node
const { type } = data const { type } = data
@ -1503,12 +1502,18 @@ export const getNodeUsedVars = (node: Node): ValueSelector[] => {
res = valueSelectors res = valueSelectors
break break
} }
case BlockEnum.HumanInput: {
const payload = data as HumanInputNodeType
const formContent = payload.form_content
res = matchNotSystemVars([formContent])
break
}
} }
return res || [] return res || []
} }
// can be used in iteration node // can be used in iteration node
// todo: add human-input node
export const getNodeUsedVarPassToServerKey = ( export const getNodeUsedVarPassToServerKey = (
node: Node, node: Node,
valueSelector: ValueSelector, valueSelector: ValueSelector,
@ -1602,6 +1607,11 @@ export const getNodeUsedVarPassToServerKey = (
res = 'query' res = 'query'
break break
} }
case BlockEnum.HumanInput: {
res = `#${valueSelector.join('.')}#`
break
}
} }
return res return res
} }
@ -1619,7 +1629,6 @@ export const findUsedVarNodes = (
return res return res
} }
// todo: add human-input node
export const updateNodeVars = ( export const updateNodeVars = (
oldNode: Node, oldNode: Node,
oldVarSelector: ValueSelector, oldVarSelector: ValueSelector,
@ -1939,6 +1948,15 @@ export const updateNodeVars = (
payload.variable = newVarSelector payload.variable = newVarSelector
break break
} }
case BlockEnum.HumanInput: {
const payload = data as HumanInputNodeType
payload.form_content = replaceOldVarInText(
payload.form_content,
oldVarSelector,
newVarSelector,
)
break
}
} }
}) })
return newNode return newNode