From a430284aa21e3ae1f0d5654e55b2ad2852519cc2 Mon Sep 17 00:00:00 2001 From: wwf <yearningwang@iqtogether.com> Date: 星期三, 04 六月 2025 15:17:49 +0800 Subject: [PATCH] 初始化 --- app/components/workflow/run/result-panel.tsx | 88 ++++++++++++++------------------------------ 1 files changed, 28 insertions(+), 60 deletions(-) diff --git a/app/components/workflow/run/result-panel.tsx b/app/components/workflow/run/result-panel.tsx index 096a825..bbe740a 100644 --- a/app/components/workflow/run/result-panel.tsx +++ b/app/components/workflow/run/result-panel.tsx @@ -1,24 +1,19 @@ 'use client' import type { FC } from 'react' import { useTranslation } from 'react-i18next' +import { + RiArrowRightSLine, + RiRestartFill, +} from '@remixicon/react' import StatusPanel from './status' import MetaData from './meta' import CodeEditor from '@/app/components/workflow/nodes/_base/components/editor/code-editor' import { CodeLanguage } from '@/app/components/workflow/nodes/code/types' import ErrorHandleTip from '@/app/components/workflow/nodes/_base/components/error-handle/error-handle-tip' -import type { - AgentLogItemWithChildren, - NodeTracing, -} from '@/types/workflow' -import { BlockEnum } from '@/app/components/workflow/types' -import { hasRetryNode } from '@/app/components/workflow/utils' -import { IterationLogTrigger } from '@/app/components/workflow/run/iteration-log' -import { LoopLogTrigger } from '@/app/components/workflow/run/loop-log' -import { RetryLogTrigger } from '@/app/components/workflow/run/retry-log' -import { AgentLogTrigger } from '@/app/components/workflow/run/agent-log' +import type { NodeTracing } from '@/types/workflow' +import Button from '@/app/components/base/button' type ResultPanelProps = { - nodeInfo?: NodeTracing inputs?: string process_data?: string outputs?: string @@ -33,14 +28,11 @@ showSteps?: boolean exceptionCounts?: number execution_metadata?: any - handleShowIterationResultList?: (detail: NodeTracing[][], iterDurationMap: any) => void - handleShowLoopResultList?: (detail: NodeTracing[][], loopDurationMap: any) => void - onShowRetryDetail?: (detail: NodeTracing[]) => void - handleShowAgentOrToolLog?: (detail?: AgentLogItemWithChildren) => void + retry_events?: NodeTracing[] + onShowRetryDetail?: (retries: NodeTracing[]) => void } const ResultPanel: FC<ResultPanelProps> = ({ - nodeInfo, inputs, process_data, outputs, @@ -54,17 +46,10 @@ showSteps, exceptionCounts, execution_metadata, - handleShowIterationResultList, - handleShowLoopResultList, + retry_events, onShowRetryDetail, - handleShowAgentOrToolLog, }) => { const { t } = useTranslation() - const isIterationNode = nodeInfo?.node_type === BlockEnum.Iteration && !!nodeInfo?.details?.length - const isLoopNode = nodeInfo?.node_type === BlockEnum.Loop && !!nodeInfo?.details?.length - const isRetryNode = hasRetryNode(nodeInfo?.node_type) && !!nodeInfo?.retryDetail?.length - const isAgentNode = nodeInfo?.node_type === BlockEnum.Agent && !!nodeInfo?.agentLog?.length - const isToolNode = nodeInfo?.node_type === BlockEnum.Tool && !!nodeInfo?.agentLog?.length return ( <div className='bg-components-panel-bg py-2'> @@ -77,41 +62,24 @@ exceptionCounts={exceptionCounts} /> </div> - <div className='px-4'> - { - isIterationNode && handleShowIterationResultList && ( - <IterationLogTrigger - nodeInfo={nodeInfo} - onShowIterationResultList={handleShowIterationResultList} - /> - ) - } - { - isLoopNode && handleShowLoopResultList && ( - <LoopLogTrigger - nodeInfo={nodeInfo} - onShowLoopResultList={handleShowLoopResultList} - /> - ) - } - { - isRetryNode && onShowRetryDetail && ( - <RetryLogTrigger - nodeInfo={nodeInfo} - onShowRetryResultList={onShowRetryDetail} - /> - ) - } - { - (isAgentNode || isToolNode) && handleShowAgentOrToolLog && ( - <AgentLogTrigger - nodeInfo={nodeInfo} - onShowAgentOrToolLog={handleShowAgentOrToolLog} - /> - ) - } - </div> - <div className='flex flex-col gap-2 px-4 py-2'> + { + retry_events?.length && onShowRetryDetail && ( + <div className='px-4'> + <Button + className='flex items-center justify-between w-full' + variant='tertiary' + onClick={() => onShowRetryDetail(retry_events)} + > + <div className='flex items-center'> + <RiRestartFill className='mr-0.5 w-4 h-4 text-components-button-tertiary-text flex-shrink-0' /> + {t('workflow.nodes.common.retry.retries', { num: retry_events?.length })} + </div> + <RiArrowRightSLine className='w-4 h-4 text-components-button-tertiary-text flex-shrink-0' /> + </Button> + </div> + ) + } + <div className='px-4 py-2 flex flex-col gap-2'> <CodeEditor readOnly title={<div>{t('workflow.common.input').toLocaleUpperCase()}</div>} @@ -140,7 +108,7 @@ )} </div> <div className='px-4 py-2'> - <div className='divider-subtle h-[0.5px]' /> + <div className='h-[0.5px] divider-subtle' /> </div> <div className='px-4 py-2'> <MetaData -- Gitblit v1.8.0