mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-05 01:10:43 +08:00
feat: delete node delete vars
This commit is contained in:
parent
99221010bd
commit
cc85e53ffc
@ -21,10 +21,10 @@ const useInspectVarsCrud = () => {
|
||||
setInspectVarValue,
|
||||
renameInspectVarName: renameInspectVarNameInStore,
|
||||
deleteAllInspectVars: deleteAllInspectVarsInStore,
|
||||
hasNodeInspectVars,
|
||||
deleteNodeInspectVars: deleteNodeInspectVarsInStore,
|
||||
deleteInspectVar: deleteInspectVarInStore,
|
||||
isInspectVarEdited,
|
||||
getLastRunVar,
|
||||
} = workflowStore.getState()
|
||||
|
||||
const { data: conversationVars } = useConversationVarValues(appId)
|
||||
@ -61,7 +61,9 @@ const useInspectVarsCrud = () => {
|
||||
}
|
||||
|
||||
const deleteNodeInspectorVars = async (nodeId: string) => {
|
||||
await doDeleteNodeInspectorVars(nodeId)
|
||||
if (hasNodeInspectVars(nodeId))
|
||||
await doDeleteNodeInspectorVars(nodeId)
|
||||
|
||||
deleteNodeInspectVarsInStore(nodeId)
|
||||
}
|
||||
|
||||
@ -95,9 +97,10 @@ const useInspectVarsCrud = () => {
|
||||
}
|
||||
|
||||
const resetToLastRunVar = (nodeId: string, key: string) => {
|
||||
const lastRunVar = getLastRunVar(nodeId, key)
|
||||
if (lastRunVar)
|
||||
editInspectVarValue(nodeId, key, lastRunVar)
|
||||
// const lastRunVar = getLastRunVar(nodeId, key)
|
||||
// if (lastRunVar)
|
||||
// editInspectVarValue(nodeId, key, lastRunVar)
|
||||
// TODO
|
||||
}
|
||||
|
||||
// console.log(conversationVars, systemVars)
|
||||
|
@ -60,6 +60,7 @@ import {
|
||||
useWorkflowReadOnly,
|
||||
} from './use-workflow'
|
||||
import { WorkflowHistoryEvent, useWorkflowHistory } from './use-workflow-history'
|
||||
import useInspectVarsCrud from './use-inspect-vars-crud'
|
||||
|
||||
export const useNodesInteractions = () => {
|
||||
const { t } = useTranslation()
|
||||
@ -530,6 +531,8 @@ export const useNodesInteractions = () => {
|
||||
setEnteringNodePayload(undefined)
|
||||
}, [store, handleNodeConnect, getNodesReadOnly, workflowStore, reactflow])
|
||||
|
||||
const { deleteNodeInspectorVars } = useInspectVarsCrud()
|
||||
|
||||
const handleNodeDelete = useCallback((nodeId: string) => {
|
||||
if (getNodesReadOnly())
|
||||
return
|
||||
@ -551,6 +554,7 @@ export const useNodesInteractions = () => {
|
||||
if (currentNode.data.type === BlockEnum.Start)
|
||||
return
|
||||
|
||||
deleteNodeInspectorVars(nodeId)
|
||||
if (currentNode.data.type === BlockEnum.Iteration) {
|
||||
const iterationChildren = nodes.filter(node => node.parentId === currentNode.id)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user