special-result-panel.tsx 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import { RetryResultPanel } from './retry-log'
  2. import { IterationResultPanel } from './iteration-log'
  3. import { AgentResultPanel } from './agent-log'
  4. import type {
  5. AgentLogItemWithChildren,
  6. IterationDurationMap,
  7. NodeTracing,
  8. } from '@/types/workflow'
  9. export type SpecialResultPanelProps = {
  10. showRetryDetail?: boolean
  11. setShowRetryDetailFalse?: () => void
  12. retryResultList?: NodeTracing[]
  13. showIteratingDetail?: boolean
  14. setShowIteratingDetailFalse?: () => void
  15. iterationResultList?: NodeTracing[][]
  16. iterationResultDurationMap?: IterationDurationMap
  17. agentOrToolLogItemStack?: AgentLogItemWithChildren[]
  18. agentOrToolLogListMap?: Record<string, AgentLogItemWithChildren[]>
  19. handleShowAgentOrToolLog?: (detail?: AgentLogItemWithChildren) => void
  20. }
  21. const SpecialResultPanel = ({
  22. showRetryDetail,
  23. setShowRetryDetailFalse,
  24. retryResultList,
  25. showIteratingDetail,
  26. setShowIteratingDetailFalse,
  27. iterationResultList,
  28. iterationResultDurationMap,
  29. agentOrToolLogItemStack,
  30. agentOrToolLogListMap,
  31. handleShowAgentOrToolLog,
  32. }: SpecialResultPanelProps) => {
  33. return (
  34. <div onClick={(e) => {
  35. e.stopPropagation()
  36. e.nativeEvent.stopImmediatePropagation()
  37. }}>
  38. {
  39. !!showRetryDetail && !!retryResultList?.length && setShowRetryDetailFalse && (
  40. <RetryResultPanel
  41. list={retryResultList}
  42. onBack={setShowRetryDetailFalse}
  43. />
  44. )
  45. }
  46. {
  47. showIteratingDetail && !!iterationResultList?.length && setShowIteratingDetailFalse && (
  48. <IterationResultPanel
  49. list={iterationResultList}
  50. onBack={setShowIteratingDetailFalse}
  51. iterDurationMap={iterationResultDurationMap}
  52. />
  53. )
  54. }
  55. {
  56. !!agentOrToolLogItemStack?.length && agentOrToolLogListMap && handleShowAgentOrToolLog && (
  57. <AgentResultPanel
  58. agentOrToolLogItemStack={agentOrToolLogItemStack}
  59. agentOrToolLogListMap={agentOrToolLogListMap}
  60. onShowAgentOrToolLog={handleShowAgentOrToolLog}
  61. />
  62. )
  63. }
  64. </div>
  65. )
  66. }
  67. export default SpecialResultPanel