'use client'; import { Box, Paper, Typography, Chip, Grid, Divider } from '@mui/material'; import SmartToyIcon from '@mui/icons-material/SmartToy'; import AccessTimeIcon from '@mui/icons-material/AccessTime'; import { detailStyles } from '../detailStyles'; import { useTranslation } from 'react-i18next'; import { getModelIcon } from '@/lib/util/modelIcon'; export default function EvalHeader({ task, stats, filterCorrect, onFilterCorrectSelect }) { const { t } = useTranslation(); if (!task) return null; const { modelInfo, createAt, status, detail } = task; const score = detail?.finalScore || 0; const isPass = score >= 60; const totalTime = task.endTime ? Math.floor((new Date(task.endTime) - new Date(task.createAt)) / 1000) : 0; const incorrectCount = (stats?.totalQuestions || 0) - (stats?.correctCount || 0); // 获取教师模型信息 const judgeModelId = detail?.judgeModelId; const judgeProviderId = detail?.judgeProviderId; const hasJudgeModel = judgeModelId && judgeProviderId; return ( {/* 左侧:模型信息 */} {modelInfo?.modelId {modelInfo?.providerName || modelInfo?.providerId} / {modelInfo?.modelName || modelInfo?.modelId} {hasJudgeModel && ( )} {new Date(createAt).toLocaleString()} {totalTime > 0 && ` ${t('evalTasks.durationFormat', { time: totalTime })}`} {/* 中间:统计概览 (增加点击筛选) */} onFilterCorrectSelect(null)} sx={{ ...detailStyles.statBox, cursor: 'pointer', bgcolor: filterCorrect === null ? 'rgba(25, 118, 210, 0.08)' : 'background.default', border: filterCorrect === null ? '1px solid' : '1px solid transparent', borderColor: 'primary.main', transition: 'all 0.2s' }} > {stats?.totalQuestions || 0} {t('evalTasks.totalQuestionsLabel')} onFilterCorrectSelect(true)} sx={{ ...detailStyles.statBox, cursor: 'pointer', bgcolor: filterCorrect === true ? 'rgba(46, 125, 50, 0.08)' : 'background.default', border: filterCorrect === true ? '1px solid' : '1px solid transparent', borderColor: 'success.main', transition: 'all 0.2s' }} > {stats?.correctCount || 0} {t('evalTasks.correctLabel')} onFilterCorrectSelect(false)} sx={{ ...detailStyles.statBox, cursor: 'pointer', bgcolor: filterCorrect === false ? 'rgba(211, 47, 47, 0.08)' : 'background.default', border: filterCorrect === false ? '1px solid' : '1px solid transparent', borderColor: 'error.main', transition: 'all 0.2s' }} > {incorrectCount} {t('evalTasks.incorrectLabel')} {/* 右侧:分数印章 */} {score.toFixed(1)} SCORE ); }