mirror of https://github.com/langgenius/dify.git
feat(step-run): add resolvedStatus calculation for improved run result handling
This commit is contained in:
parent
7658c92cf9
commit
79e46c8a81
|
|
@ -60,6 +60,16 @@ const LastRun: FC<Props> = ({
|
|||
const noLastRun = (error as any)?.status === 404
|
||||
const runResult = (canRunLastRun ? lastRunResult : singleRunResult) || lastRunResult || {}
|
||||
|
||||
const resolvedStatus = useMemo(() => {
|
||||
if (isPaused)
|
||||
return NodeRunningStatus.Stopped
|
||||
|
||||
if (oneStepRunRunningStatus === NodeRunningStatus.Stopped)
|
||||
return NodeRunningStatus.Stopped
|
||||
|
||||
return (runResult as any).status || otherResultPanelProps.status
|
||||
}, [isPaused, oneStepRunRunningStatus, runResult, otherResultPanelProps.status])
|
||||
|
||||
const resetHidePageStatus = useCallback(() => {
|
||||
setPageHasHide(false)
|
||||
setPageShowed(false)
|
||||
|
|
@ -104,18 +114,18 @@ const LastRun: FC<Props> = ({
|
|||
|
||||
if (isRunning)
|
||||
return <ResultPanel status='running' showSteps={false} />
|
||||
|
||||
if (!isPaused && (noLastRun || !runResult)) {
|
||||
return (
|
||||
<NoData canSingleRun={canSingleRun} onSingleRun={onSingleRunClicked} />
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<ResultPanel
|
||||
{...runResult as any}
|
||||
{...otherResultPanelProps}
|
||||
status={isPaused ? NodeRunningStatus.Stopped : ((runResult as any).status || otherResultPanelProps.status)}
|
||||
status={resolvedStatus}
|
||||
total_tokens={(runResult as any)?.execution_metadata?.total_tokens || otherResultPanelProps?.total_tokens}
|
||||
created_by={(runResult as any)?.created_by_account?.created_by || otherResultPanelProps?.created_by}
|
||||
nodeInfo={runResult as NodeTracing}
|
||||
|
|
|
|||
Loading…
Reference in New Issue