mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-16 17:15:59 +08:00
fix: bug
This commit is contained in:
parent
c2bb11405f
commit
4418fa1d2b
@ -18,6 +18,7 @@ import { getIterationStartNode } from './utils'
|
|||||||
import CustomNode from './nodes'
|
import CustomNode from './nodes'
|
||||||
import CustomNoteNode from './note-node'
|
import CustomNoteNode from './note-node'
|
||||||
import { CUSTOM_NOTE_NODE } from './note-node/constants'
|
import { CUSTOM_NOTE_NODE } from './note-node/constants'
|
||||||
|
import { BlockEnum } from './types'
|
||||||
|
|
||||||
const CandidateNode = () => {
|
const CandidateNode = () => {
|
||||||
const store = useStoreApi()
|
const store = useStoreApi()
|
||||||
@ -53,7 +54,8 @@ const CandidateNode = () => {
|
|||||||
y,
|
y,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
draft.push(getIterationStartNode(candidateNode.id))
|
if (candidateNode.data.type === BlockEnum.Iteration)
|
||||||
|
draft.push(getIterationStartNode(candidateNode.id))
|
||||||
})
|
})
|
||||||
setNodes(newNodes)
|
setNodes(newNodes)
|
||||||
if (candidateNode.type === CUSTOM_NOTE_NODE)
|
if (candidateNode.type === CUSTOM_NOTE_NODE)
|
||||||
|
@ -334,10 +334,10 @@ export const useNodesInteractions = () => {
|
|||||||
if (targetNode?.parentId !== sourceNode?.parentId)
|
if (targetNode?.parentId !== sourceNode?.parentId)
|
||||||
return
|
return
|
||||||
|
|
||||||
if (targetNode?.data.isIterationStart)
|
if (sourceNode?.type === CUSTOM_NOTE_NODE || targetNode?.type === CUSTOM_NOTE_NODE)
|
||||||
return
|
return
|
||||||
|
|
||||||
if (sourceNode?.type === CUSTOM_NOTE_NODE || targetNode?.type === CUSTOM_NOTE_NODE)
|
if (edges.find(edge => edge.source === source && edge.sourceHandle === sourceHandle && edge.target === target && edge.targetHandle === targetHandle))
|
||||||
return
|
return
|
||||||
|
|
||||||
const newEdge = {
|
const newEdge = {
|
||||||
@ -398,14 +398,12 @@ export const useNodesInteractions = () => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!node.data.isIterationStart) {
|
setConnectingNodePayload({
|
||||||
setConnectingNodePayload({
|
nodeId,
|
||||||
nodeId,
|
nodeType: node.data.type,
|
||||||
nodeType: node.data.type,
|
handleType,
|
||||||
handleType,
|
handleId,
|
||||||
handleId,
|
})
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}, [store, workflowStore, getNodesReadOnly])
|
}, [store, workflowStore, getNodesReadOnly])
|
||||||
|
|
||||||
@ -771,9 +769,6 @@ export const useNodesInteractions = () => {
|
|||||||
node.data.start_node_id = newNode.id
|
node.data.start_node_id = newNode.id
|
||||||
node.data.startNodeType = newNode.data.type
|
node.data.startNodeType = newNode.data.type
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node.id === nextNodeId && node.data.isIterationStart)
|
|
||||||
node.data.isIterationStart = false
|
|
||||||
})
|
})
|
||||||
draft.push(newNode)
|
draft.push(newNode)
|
||||||
if (newIterationStartNode)
|
if (newIterationStartNode)
|
||||||
@ -1117,7 +1112,6 @@ export const useNodesInteractions = () => {
|
|||||||
zIndex: nodeToPaste.zIndex,
|
zIndex: nodeToPaste.zIndex,
|
||||||
})
|
})
|
||||||
newNode.id = newNode.id + index
|
newNode.id = newNode.id + index
|
||||||
// If only the iteration start node is copied, remove the isIterationStart flag
|
|
||||||
// This new node is movable and can be placed anywhere
|
// This new node is movable and can be placed anywhere
|
||||||
let newChildren: Node[] = []
|
let newChildren: Node[] = []
|
||||||
if (nodeToPaste.data.type === BlockEnum.Iteration) {
|
if (nodeToPaste.data.type === BlockEnum.Iteration) {
|
||||||
|
@ -50,6 +50,7 @@ import {
|
|||||||
} from '@/service/tools'
|
} from '@/service/tools'
|
||||||
import I18n from '@/context/i18n'
|
import I18n from '@/context/i18n'
|
||||||
import { CollectionType } from '@/app/components/tools/types'
|
import { CollectionType } from '@/app/components/tools/types'
|
||||||
|
import { CUSTOM_ITERATION_START_NODE } from '@/app/components/workflow/nodes/iteration-start/constants'
|
||||||
|
|
||||||
export const useIsChatMode = () => {
|
export const useIsChatMode = () => {
|
||||||
const appDetail = useAppStore(s => s.appDetail)
|
const appDetail = useAppStore(s => s.appDetail)
|
||||||
@ -77,7 +78,7 @@ export const useWorkflow = () => {
|
|||||||
const currentNode = nodes.find(node => node.id === nodeId)
|
const currentNode = nodes.find(node => node.id === nodeId)
|
||||||
|
|
||||||
if (currentNode?.parentId)
|
if (currentNode?.parentId)
|
||||||
startNode = nodes.find(node => node.parentId === currentNode.parentId && node.data.isIterationStart)
|
startNode = nodes.find(node => node.parentId === currentNode.parentId && node.type === CUSTOM_ITERATION_START_NODE)
|
||||||
|
|
||||||
if (!startNode)
|
if (!startNode)
|
||||||
return []
|
return []
|
||||||
@ -284,9 +285,6 @@ export const useWorkflow = () => {
|
|||||||
const sourceNode: Node = nodes.find(node => node.id === source)!
|
const sourceNode: Node = nodes.find(node => node.id === source)!
|
||||||
const targetNode: Node = nodes.find(node => node.id === target)!
|
const targetNode: Node = nodes.find(node => node.id === target)!
|
||||||
|
|
||||||
if (targetNode.data.isIterationStart)
|
|
||||||
return false
|
|
||||||
|
|
||||||
if (sourceNode.type === CUSTOM_NOTE_NODE || targetNode.type === CUSTOM_NOTE_NODE)
|
if (sourceNode.type === CUSTOM_NOTE_NODE || targetNode.type === CUSTOM_NOTE_NODE)
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
@ -40,9 +40,7 @@ export const NodeTargetHandle = memo(({
|
|||||||
const { getNodesReadOnly } = useNodesReadOnly()
|
const { getNodesReadOnly } = useNodesReadOnly()
|
||||||
const connected = data._connectedTargetHandleIds?.includes(handleId)
|
const connected = data._connectedTargetHandleIds?.includes(handleId)
|
||||||
const { availablePrevBlocks } = useAvailableBlocks(data.type, data.isInIteration)
|
const { availablePrevBlocks } = useAvailableBlocks(data.type, data.isInIteration)
|
||||||
const isConnectable = !!availablePrevBlocks.length && (
|
const isConnectable = !!availablePrevBlocks.length
|
||||||
!data.isIterationStart
|
|
||||||
)
|
|
||||||
|
|
||||||
const handleOpenChange = useCallback((v: boolean) => {
|
const handleOpenChange = useCallback((v: boolean) => {
|
||||||
setOpen(v)
|
setOpen(v)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user