mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 11:42:29 +08:00
Fix: workflow result display (#5299)
This commit is contained in:
parent
24282236f0
commit
61ebcd8adb
|
@ -265,18 +265,29 @@ const Result: FC<IResultProps> = ({
|
||||||
return
|
return
|
||||||
if (data.error) {
|
if (data.error) {
|
||||||
notify({ type: 'error', message: data.error })
|
notify({ type: 'error', message: data.error })
|
||||||
|
setWorkflowProccessData(produce(getWorkflowProccessData()!, (draft) => {
|
||||||
|
draft.status = WorkflowRunningStatus.Failed
|
||||||
|
}))
|
||||||
setRespondingFalse()
|
setRespondingFalse()
|
||||||
onCompleted(getCompletionRes(), taskId, false)
|
onCompleted(getCompletionRes(), taskId, false)
|
||||||
isEnd = true
|
isEnd = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
setWorkflowProccessData(produce(getWorkflowProccessData()!, (draft) => {
|
setWorkflowProccessData(produce(getWorkflowProccessData()!, (draft) => {
|
||||||
draft.status = data.error ? WorkflowRunningStatus.Failed : WorkflowRunningStatus.Succeeded
|
draft.status = WorkflowRunningStatus.Succeeded
|
||||||
}))
|
}))
|
||||||
if (!data.outputs)
|
if (!data.outputs) {
|
||||||
setCompletionRes('')
|
setCompletionRes('')
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
setCompletionRes(data.outputs)
|
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()
|
setRespondingFalse()
|
||||||
setMessageId(tempMessageId)
|
setMessageId(tempMessageId)
|
||||||
onCompleted(getCompletionRes(), taskId, true)
|
onCompleted(getCompletionRes(), taskId, true)
|
||||||
|
|
|
@ -179,11 +179,17 @@ export const useWorkflowRun = () => {
|
||||||
setWorkflowRunningData,
|
setWorkflowRunningData,
|
||||||
} = workflowStore.getState()
|
} = workflowStore.getState()
|
||||||
|
|
||||||
|
const isStringOutput = Object.keys(data.outputs).length === 1 && typeof data.outputs[Object.keys(data.outputs)[0]] === 'string'
|
||||||
|
|
||||||
setWorkflowRunningData(produce(workflowRunningData!, (draft) => {
|
setWorkflowRunningData(produce(workflowRunningData!, (draft) => {
|
||||||
draft.result = {
|
draft.result = {
|
||||||
...draft.result,
|
...draft.result,
|
||||||
...data,
|
...data,
|
||||||
} as any
|
} as any
|
||||||
|
if (isStringOutput) {
|
||||||
|
draft.resultTabActive = true
|
||||||
|
draft.resultText = data.outputs[Object.keys(data.outputs)[0]]
|
||||||
|
}
|
||||||
}))
|
}))
|
||||||
|
|
||||||
prevNodeId = ''
|
prevNodeId = ''
|
||||||
|
|
Loading…
Reference in New Issue
Block a user