mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-13 22:25:57 +08:00
update the onNodeFinished method for nodes being passed through more than once
This commit is contained in:
parent
708256ef1d
commit
e3ae529a55
@ -329,7 +329,12 @@ export const useWorkflowRun = () => {
|
||||
else {
|
||||
const nodes = getNodes()
|
||||
setWorkflowRunningData(produce(workflowRunningData!, (draft) => {
|
||||
const currentIndex = draft.tracing!.findIndex(trace => trace.node_id === data.node_id)
|
||||
const currentIndex = draft.tracing!.findIndex((trace) => {
|
||||
if (!trace.execution_metadata?.parallel_id)
|
||||
return trace.node_id === data.node_id
|
||||
|
||||
return trace.node_id === data.node_id && trace.execution_metadata?.parallel_id === data.execution_metadata?.parallel_id
|
||||
})
|
||||
|
||||
if (currentIndex > -1 && draft.tracing) {
|
||||
draft.tracing[currentIndex] = {
|
||||
|
@ -382,7 +382,12 @@ export const useChat = (
|
||||
}))
|
||||
}
|
||||
else {
|
||||
const currentIndex = responseItem.workflowProcess!.tracing!.findIndex(item => item.node_id === data.node_id)
|
||||
const currentIndex = responseItem.workflowProcess!.tracing!.findIndex((item) => {
|
||||
if (!item.execution_metadata?.parallel_id)
|
||||
return item.node_id === data.node_id
|
||||
|
||||
return item.node_id === data.node_id && item.execution_metadata?.parallel_id === data.execution_metadata?.parallel_id
|
||||
})
|
||||
responseItem.workflowProcess!.tracing[currentIndex] = {
|
||||
...(responseItem.workflowProcess!.tracing[currentIndex].extras
|
||||
? { extras: responseItem.workflowProcess!.tracing[currentIndex].extras }
|
||||
|
@ -144,6 +144,7 @@ export type NodeFinishedResponse = {
|
||||
total_tokens: number
|
||||
total_price: number
|
||||
currency: string
|
||||
parallel_id?: string
|
||||
}
|
||||
created_at: number
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user