mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-15 19:55:58 +08:00
update the method to check if a node is in iteration
This commit is contained in:
parent
4962b2c460
commit
5cb018e15d
@ -141,8 +141,6 @@ export const useWorkflowRun = () => {
|
|||||||
tracing: [],
|
tracing: [],
|
||||||
resultText: '',
|
resultText: '',
|
||||||
})
|
})
|
||||||
|
|
||||||
let isInIteration = false
|
|
||||||
let iterationLength = 0
|
let iterationLength = 0
|
||||||
|
|
||||||
let ttsUrl = ''
|
let ttsUrl = ''
|
||||||
@ -251,7 +249,9 @@ export const useWorkflowRun = () => {
|
|||||||
setEdges,
|
setEdges,
|
||||||
transform,
|
transform,
|
||||||
} = store.getState()
|
} = store.getState()
|
||||||
if (isInIteration) {
|
const nodes = getNodes()
|
||||||
|
const nodeParentId = nodes.find(node => node.id === data.node_id)!.parentId
|
||||||
|
if (nodeParentId) {
|
||||||
setWorkflowRunningData(produce(workflowRunningData!, (draft) => {
|
setWorkflowRunningData(produce(workflowRunningData!, (draft) => {
|
||||||
const tracing = draft.tracing!
|
const tracing = draft.tracing!
|
||||||
const iterations = tracing[tracing.length - 1]
|
const iterations = tracing[tracing.length - 1]
|
||||||
@ -263,7 +263,6 @@ export const useWorkflowRun = () => {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const nodes = getNodes()
|
|
||||||
setWorkflowRunningData(produce(workflowRunningData!, (draft) => {
|
setWorkflowRunningData(produce(workflowRunningData!, (draft) => {
|
||||||
draft.tracing!.push({
|
draft.tracing!.push({
|
||||||
...data,
|
...data,
|
||||||
@ -312,8 +311,9 @@ export const useWorkflowRun = () => {
|
|||||||
getNodes,
|
getNodes,
|
||||||
setNodes,
|
setNodes,
|
||||||
} = store.getState()
|
} = store.getState()
|
||||||
|
const nodes = getNodes()
|
||||||
if (isInIteration) {
|
const nodeParentId = nodes.find(node => node.id === data.node_id)!.parentId
|
||||||
|
if (nodeParentId) {
|
||||||
setWorkflowRunningData(produce(workflowRunningData!, (draft) => {
|
setWorkflowRunningData(produce(workflowRunningData!, (draft) => {
|
||||||
const tracing = draft.tracing!
|
const tracing = draft.tracing!
|
||||||
const iterations = tracing[tracing.length - 1] // the iteration node
|
const iterations = tracing[tracing.length - 1] // the iteration node
|
||||||
@ -344,7 +344,6 @@ export const useWorkflowRun = () => {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const nodes = getNodes()
|
|
||||||
setWorkflowRunningData(produce(workflowRunningData!, (draft) => {
|
setWorkflowRunningData(produce(workflowRunningData!, (draft) => {
|
||||||
const currentIndex = draft.tracing!.findIndex((trace) => {
|
const currentIndex = draft.tracing!.findIndex((trace) => {
|
||||||
if (!trace.execution_metadata?.parallel_id)
|
if (!trace.execution_metadata?.parallel_id)
|
||||||
@ -392,7 +391,6 @@ export const useWorkflowRun = () => {
|
|||||||
details: [],
|
details: [],
|
||||||
} as any)
|
} as any)
|
||||||
}))
|
}))
|
||||||
isInIteration = true
|
|
||||||
iterationLength = data.metadata.iterator_length
|
iterationLength = data.metadata.iterator_length
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@ -477,7 +475,6 @@ export const useWorkflowRun = () => {
|
|||||||
status: NodeRunningStatus.Succeeded,
|
status: NodeRunningStatus.Succeeded,
|
||||||
} as any
|
} as any
|
||||||
}))
|
}))
|
||||||
isInIteration = false
|
|
||||||
|
|
||||||
const newNodes = produce(nodes, (draft) => {
|
const newNodes = produce(nodes, (draft) => {
|
||||||
const currentNode = draft.find(node => node.id === data.node_id)!
|
const currentNode = draft.find(node => node.id === data.node_id)!
|
||||||
|
Loading…
x
Reference in New Issue
Block a user