'use client' import type { FC } from 'react' import { useTranslation } from 'react-i18next' import useTimestamp from '@/hooks/use-timestamp' type Props = { status: string executor?: string startTime?: number time?: number tokens?: number steps?: number showSteps?: boolean } const MetaData: FC = ({ status, executor, startTime, time, tokens, steps = 1, showSteps = true, }) => { const { t } = useTranslation() const { formatTime } = useTimestamp() return (
{t('runLog.meta.title')}
{t('runLog.meta.status')}
{status === 'running' && (
)} {status === 'succeeded' && ( SUCCESS )} {status === 'failed' && ( FAIL )} {status === 'stopped' && ( STOP )}
{t('runLog.meta.executor')}
{status === 'running' && (
)} {status !== 'running' && ( {executor || 'N/A'} )}
{t('runLog.meta.startTime')}
{status === 'running' && (
)} {status !== 'running' && ( {startTime ? formatTime(startTime, t('appLog.dateTimeFormat') as string) : '-'} )}
{t('runLog.meta.time')}
{status === 'running' && (
)} {status !== 'running' && ( {time ? `${time.toFixed(3)}s` : '-'} )}
{t('runLog.meta.tokens')}
{status === 'running' && (
)} {status !== 'running' && ( {`${tokens || 0} Tokens`} )}
{showSteps && (
{t('runLog.meta.steps')}
{status === 'running' && (
)} {status !== 'running' && ( {steps} )}
)}
) } export default MetaData