chore: address review feedback

This commit is contained in:
Yanli 盐粒 2026-03-10 19:30:54 +08:00
parent 4f73766a21
commit 715f3affe5
3 changed files with 5 additions and 2 deletions

View File

@ -957,6 +957,7 @@ export const useChat = (
})
},
onNodeStarted: ({ data: nodeStartedData }) => {
// `data` is the outer send payload for this request; loop child runs should not emit top-level node traces here.
if (data.loop_id)
return
@ -977,6 +978,7 @@ export const useChat = (
})
},
onNodeFinished: ({ data: nodeFinishedData }) => {
// Use the outer request payload here as well so loop child runs skip top-level finish handling entirely.
if (data.loop_id)
return

View File

@ -337,7 +337,7 @@ const Result: FC<IResultProps> = ({
onIterationFinish: ({ data }) => {
setWorkflowProcessData(produce(getWorkflowProcessData()!, (draft) => {
draft.expand = true
const iterationsIndex = draft.tracing.findIndex(item => item.id === data.id)!
const iterationsIndex = draft.tracing.findIndex(item => item.id === data.id)
if (iterationsIndex > -1) {
draft.tracing[iterationsIndex] = {
...data,
@ -367,7 +367,7 @@ const Result: FC<IResultProps> = ({
onLoopFinish: ({ data }) => {
setWorkflowProcessData(produce(getWorkflowProcessData()!, (draft) => {
draft.expand = true
const loopsIndex = draft.tracing.findIndex(item => item.id === data.id)!
const loopsIndex = draft.tracing.findIndex(item => item.id === data.id)
if (loopsIndex > -1) {
draft.tracing[loopsIndex] = {
...data,

View File

@ -15,6 +15,7 @@ export const upsertTopLevelTracingNodeOnStart = (
? tracing.findIndex(item => item.id === startedNode.id)
: tracing.findIndex(item => item.node_id === startedNode.node_id)
if (currentIndex > -1)
// Started events are the authoritative snapshot for an execution; merging would retain stale client-side fields.
tracing[currentIndex] = startedNode
else
tracing.push(startedNode)