'use client' import type { FC } from 'react' import { useTranslation } from 'react-i18next' import cn from '@/utils/classnames' import Indicator from '@/app/components/header/indicator' import StatusContainer from '@/app/components/workflow/run/status-container' type ResultProps = { status: string time?: number tokens?: number error?: string } const StatusPanel: FC = ({ status, time, tokens, error, }) => { const { t } = useTranslation() return (
{t('runLog.resultPanel.status')}
{status === 'running' && ( <> Running )} {status === 'succeeded' && ( <> SUCCESS )} {status === 'failed' && ( <> FAIL )} {status === 'stopped' && ( <> STOP )}
{t('runLog.resultPanel.time')}
{status === 'running' && (
)} {status !== 'running' && ( {time ? `${time?.toFixed(3)}s` : '-'} )}
{t('runLog.resultPanel.tokens')}
{status === 'running' && (
)} {status !== 'running' && ( {`${tokens || 0} Tokens`} )}
{status === 'failed' && error && ( <>
{error}
)} ) } export default StatusPanel