diff --git a/web/app/components/workflow/hooks/use-checklist.ts b/web/app/components/workflow/hooks/use-checklist.ts index 5a9e4dacb7..642179aed7 100644 --- a/web/app/components/workflow/hooks/use-checklist.ts +++ b/web/app/components/workflow/hooks/use-checklist.ts @@ -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, diff --git a/web/app/components/workflow/nodes/_base/components/variable/utils.ts b/web/app/components/workflow/nodes/_base/components/variable/utils.ts index b76156efde..c19acbf30f 100644 --- a/web/app/components/workflow/nodes/_base/components/variable/utils.ts +++ b/web/app/components/workflow/nodes/_base/components/variable/utils.ts @@ -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