mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-05 20:16:02 +08:00
chore: handle lastrun run retry
This commit is contained in:
parent
2c4ea612a7
commit
650abe8a8f
@ -139,7 +139,6 @@ const BasePanel: FC<BasePanelProps> = ({
|
|||||||
|
|
||||||
const {
|
const {
|
||||||
isShowSingleRun,
|
isShowSingleRun,
|
||||||
showSingleRun,
|
|
||||||
hideSingleRun,
|
hideSingleRun,
|
||||||
runningStatus,
|
runningStatus,
|
||||||
handleStop,
|
handleStop,
|
||||||
|
@ -30,9 +30,9 @@ const LastRun: FC<Props> = ({
|
|||||||
...otherResultPanelProps
|
...otherResultPanelProps
|
||||||
}) => {
|
}) => {
|
||||||
const isRunning = oneStepRunRunningStatus === NodeRunningStatus.Running
|
const isRunning = oneStepRunRunningStatus === NodeRunningStatus.Running
|
||||||
// const isOneStepRunSuccess = oneStepRunRunningStatus === NodeRunningStatus.Succeeded
|
|
||||||
const isOneStepRunFailed = oneStepRunRunningStatus === NodeRunningStatus.Failed
|
const isOneStepRunFailed = oneStepRunRunningStatus === NodeRunningStatus.Failed
|
||||||
const { data: lastRunResult, isFetching } = useLastRun(appId, nodeId, !isOneStepRunFailed)
|
const { data: lastRunResult, isFetching, error } = useLastRun(appId, nodeId, !isOneStepRunFailed)
|
||||||
|
const noLastRun = (error as any)?.status === 404
|
||||||
const runResult = (isOneStepRunFailed ? singleRunResult : lastRunResult) || {}
|
const runResult = (isOneStepRunFailed ? singleRunResult : lastRunResult) || {}
|
||||||
|
|
||||||
if (isFetching) {
|
if (isFetching) {
|
||||||
@ -45,7 +45,7 @@ const LastRun: FC<Props> = ({
|
|||||||
if (isRunning)
|
if (isRunning)
|
||||||
return <ResultPanel status='running' showSteps={false} />
|
return <ResultPanel status='running' showSteps={false} />
|
||||||
|
|
||||||
if (!runResult) {
|
if (noLastRun || !runResult) {
|
||||||
return (
|
return (
|
||||||
<NoData canSingleRun={canSingleRun} onSingleRun={onSingleRunClicked} />
|
<NoData canSingleRun={canSingleRun} onSingleRun={onSingleRunClicked} />
|
||||||
)
|
)
|
||||||
|
@ -94,8 +94,11 @@ export const useLastRun = (appID: string, nodeId: string, enabled: boolean) => {
|
|||||||
enabled,
|
enabled,
|
||||||
queryKey: [...useLastRunKey, appID, nodeId],
|
queryKey: [...useLastRunKey, appID, nodeId],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
return get(`apps/${appID}/workflows/draft/nodes/${nodeId}/last-run`)
|
return get(`apps/${appID}/workflows/draft/nodes/${nodeId}/last-run`, {}, {
|
||||||
|
silent: true,
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
retry: 0,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user