Fix: workflow result display (#5299)

This commit is contained in:
KVOJJJin 2024-06-17 14:36:17 +08:00 committed by GitHub
parent 24282236f0
commit 61ebcd8adb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 3 deletions

View File

@ -265,18 +265,29 @@ const Result: FC<IResultProps> = ({
return
if (data.error) {
notify({ type: 'error', message: data.error })
setWorkflowProccessData(produce(getWorkflowProccessData()!, (draft) => {
draft.status = WorkflowRunningStatus.Failed
}))
setRespondingFalse()
onCompleted(getCompletionRes(), taskId, false)
isEnd = true
return
}
setWorkflowProccessData(produce(getWorkflowProccessData()!, (draft) => {
draft.status = data.error ? WorkflowRunningStatus.Failed : WorkflowRunningStatus.Succeeded
draft.status = WorkflowRunningStatus.Succeeded
}))
if (!data.outputs)
if (!data.outputs) {
setCompletionRes('')
else
}
else {
setCompletionRes(data.outputs)
const isStringOutput = Object.keys(data.outputs).length === 1 && typeof data.outputs[Object.keys(data.outputs)[0]] === 'string'
if (isStringOutput) {
setWorkflowProccessData(produce(getWorkflowProccessData()!, (draft) => {
draft.resultText = data.outputs[Object.keys(data.outputs)[0]]
}))
}
}
setRespondingFalse()
setMessageId(tempMessageId)
onCompleted(getCompletionRes(), taskId, true)

View File

@ -179,11 +179,17 @@ export const useWorkflowRun = () => {
setWorkflowRunningData,
} = workflowStore.getState()
const isStringOutput = Object.keys(data.outputs).length === 1 && typeof data.outputs[Object.keys(data.outputs)[0]] === 'string'
setWorkflowRunningData(produce(workflowRunningData!, (draft) => {
draft.result = {
...draft.result,
...data,
} as any
if (isStringOutput) {
draft.resultTabActive = true
draft.resultText = data.outputs[Object.keys(data.outputs)[0]]
}
}))
prevNodeId = ''