'use client' import type { FC } from 'react' import { useTranslation } from 'react-i18next' import StatusPanel from '@/app/components/workflow/run/status' import CodeEditor from '@/app/components/workflow/nodes/_base/components/editor/code-editor' import { CodeLanguage } from '@/app/components/workflow/nodes/code/types' import useTimestamp from '@/hooks/use-timestamp' type ResultPanelProps = { status: string elapsed_time?: number total_tokens?: number error?: string inputs?: any outputs?: any created_by?: string created_at: string agentMode?: string tools?: string[] iterations?: number } const ResultPanel: FC = ({ elapsed_time, total_tokens, error, inputs, outputs, created_by, created_at, agentMode, tools, iterations, }) => { const { t } = useTranslation() const { formatTime } = useTimestamp() return (
INPUT
} language={CodeLanguage.json} value={inputs} isJSONStringifyBeauty /> OUTPUT
} language={CodeLanguage.json} value={outputs} isJSONStringifyBeauty />
{t('runLog.meta.title')}
{t('runLog.meta.status')}
SUCCESS
{t('runLog.meta.executor')}
{created_by || 'N/A'}
{t('runLog.meta.startTime')}
{formatTime(Date.parse(created_at) / 1000, t('appLog.dateTimeFormat') as string)}
{t('runLog.meta.time')}
{`${elapsed_time?.toFixed(3)}s`}
{t('runLog.meta.tokens')}
{`${total_tokens || 0} Tokens`}
{t('appLog.agentLogDetail.agentMode')}
{agentMode === 'function_call' ? t('appDebug.agent.agentModeType.functionCall') : t('appDebug.agent.agentModeType.ReACT')}
{t('appLog.agentLogDetail.toolUsed')}
{tools?.length ? tools?.join(', ') : 'Null'}
{t('appLog.agentLogDetail.iterations')}
{iterations}
) } export default ResultPanel