mirror of
https://github.com/langgenius/dify.git
synced 2026-05-05 01:48:04 +08:00
refactor(use-checklist, variable-utils): update dependencies in hooks and enhance human-input node support
This commit is contained in:
@ -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,
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user