dify/web/app/components/workflow/run/special-result-panel.tsx

74 lines
2.1 KiB
TypeScript
Raw Normal View History

2024-12-25 16:56:55 +08:00
import { RetryResultPanel } from './retry-log'
import { IterationResultPanel } from './iteration-log'
2024-12-26 10:16:12 +08:00
import { AgentResultPanel } from './agent-log'
2024-12-26 15:44:40 +08:00
import type {
AgentLogItemWithChildren,
IterationDurationMap,
NodeTracing,
} from '@/types/workflow'
2024-12-25 16:14:51 +08:00
2024-12-27 18:10:18 +08:00
export type SpecialResultPanelProps = {
showRetryDetail?: boolean
setShowRetryDetailFalse?: () => void
retryResultList?: NodeTracing[]
2024-12-25 16:14:51 +08:00
2024-12-27 18:10:18 +08:00
showIteratingDetail?: boolean
setShowIteratingDetailFalse?: () => void
iterationResultList?: NodeTracing[][]
iterationResultDurationMap?: IterationDurationMap
2024-12-26 10:16:12 +08:00
2024-12-31 14:02:50 +08:00
agentOrToolLogItemStack?: AgentLogItemWithChildren[]
2024-12-30 10:23:03 +08:00
agentOrToolLogListMap?: Record<string, AgentLogItemWithChildren[]>
2024-12-30 11:14:28 +08:00
handleShowAgentOrToolLog?: (detail?: AgentLogItemWithChildren) => void
2024-12-25 16:14:51 +08:00
}
const SpecialResultPanel = ({
showRetryDetail,
setShowRetryDetailFalse,
retryResultList,
showIteratingDetail,
setShowIteratingDetailFalse,
iterationResultList,
iterationResultDurationMap,
2024-12-26 10:16:12 +08:00
2024-12-30 11:14:28 +08:00
agentOrToolLogItemStack,
2024-12-30 10:23:03 +08:00
agentOrToolLogListMap,
handleShowAgentOrToolLog,
2024-12-25 16:14:51 +08:00
}: SpecialResultPanelProps) => {
return (
2025-01-08 14:19:50 +08:00
<div onClick={(e) => {
e.stopPropagation()
e.nativeEvent.stopImmediatePropagation()
}}>
2024-12-25 16:14:51 +08:00
{
2024-12-27 18:10:18 +08:00
!!showRetryDetail && !!retryResultList?.length && setShowRetryDetailFalse && (
2024-12-25 16:14:51 +08:00
<RetryResultPanel
list={retryResultList}
onBack={setShowRetryDetailFalse}
/>
)
}
{
2024-12-27 18:10:18 +08:00
showIteratingDetail && !!iterationResultList?.length && setShowIteratingDetailFalse && (
2024-12-25 16:14:51 +08:00
<IterationResultPanel
list={iterationResultList}
onBack={setShowIteratingDetailFalse}
iterDurationMap={iterationResultDurationMap}
/>
)
}
2024-12-26 10:16:12 +08:00
{
2024-12-30 11:14:28 +08:00
!!agentOrToolLogItemStack?.length && agentOrToolLogListMap && handleShowAgentOrToolLog && (
2024-12-26 10:16:12 +08:00
<AgentResultPanel
2024-12-30 11:14:28 +08:00
agentOrToolLogItemStack={agentOrToolLogItemStack}
2024-12-30 10:23:03 +08:00
agentOrToolLogListMap={agentOrToolLogListMap}
onShowAgentOrToolLog={handleShowAgentOrToolLog}
2024-12-26 10:16:12 +08:00
/>
)
}
2025-01-08 14:19:50 +08:00
</div>
2024-12-25 16:14:51 +08:00
)
}
export default SpecialResultPanel