import { Box, Paper, Typography, Chip, Collapse, IconButton, Avatar, Divider, Grid } from '@mui/material'; import ReactMarkdown from 'react-markdown'; import { useTranslation } from 'react-i18next'; import { useTheme, alpha } from '@mui/material/styles'; import ExpandMoreIcon from '@mui/icons-material/ExpandMore'; import ExpandLessIcon from '@mui/icons-material/ExpandLess'; import PsychologyIcon from '@mui/icons-material/Psychology'; import EmojiEventsIcon from '@mui/icons-material/EmojiEvents'; import CheckCircleIcon from '@mui/icons-material/CheckCircle'; import CancelIcon from '@mui/icons-material/Cancel'; import RemoveCircleIcon from '@mui/icons-material/RemoveCircle'; import HelpIcon from '@mui/icons-material/Help'; import { useState } from 'react'; import 'github-markdown-css/github-markdown-light.css'; // 解析包含 标签的内容 const parseAnswerContent = text => { if (!text) return { thinking: '', content: '' }; // 匹配 ... 内容 const thinkMatch = text.match(/([\s\S]*?)<\/think>/); if (thinkMatch) { return { thinking: thinkMatch[1].trim(), content: text.replace(/[\s\S]*?<\/think>/, '').trim() }; } return { thinking: '', content: text }; }; function ResultAnswerSection({ title, rawContent, isWinner, modelLabel, t, theme }) { const { thinking, content } = parseAnswerContent(rawContent); const [showThinking, setShowThinking] = useState(false); const isLeft = modelLabel.includes('A') || title.includes('左'); const avatarColor = isLeft ? 'primary.main' : 'secondary.main'; return ( {modelLabel} {title} {isWinner && ( } label={t('blindTest.winner', '胜出')} size="small" color={isLeft ? 'primary' : 'secondary'} sx={{ fontWeight: 600 }} /> )} {/* 思维链展示 */} {thinking && ( setShowThinking(!showThinking)} > {t('playground.reasoningProcess', '推理过程')} {showThinking ? ( ) : ( )} {thinking} )} {/* 正文内容 */}
{content || '-'}
); } function ResultItem({ result, index, task, question }) { const { t } = useTranslation(); const theme = useTheme(); const [expanded, setExpanded] = useState(false); // Determine vote icon and color let VoteIcon = HelpIcon; let voteColor = 'default'; let voteLabel = ''; switch (result.vote) { case 'left': VoteIcon = CheckCircleIcon; voteColor = 'primary'; voteLabel = t('blindTest.leftBetter', '左边更好'); break; case 'right': VoteIcon = CheckCircleIcon; voteColor = 'secondary'; voteLabel = t('blindTest.rightBetter', '右边更好'); break; case 'both_good': VoteIcon = CheckCircleIcon; voteColor = 'success'; voteLabel = t('blindTest.bothGood', '都好'); break; case 'both_bad': VoteIcon = CancelIcon; voteColor = 'error'; voteLabel = t('blindTest.bothBad', '都不好'); break; default: VoteIcon = RemoveCircleIcon; voteLabel = t('blindTest.ties', '平局'); } // Determine Model labels based on swap status const leftModelName = result.isSwapped ? task.modelInfo?.modelB?.modelName : task.modelInfo?.modelA?.modelName; const rightModelName = result.isSwapped ? task.modelInfo?.modelA?.modelName : task.modelInfo?.modelB?.modelName; const leftModelLabel = result.isSwapped ? 'B' : 'A'; const rightModelLabel = result.isSwapped ? 'A' : 'B'; return ( {/* 头部摘要 */} setExpanded(!expanded)} > #{index + 1} {question?.question || result.questionId} } label={voteLabel} color={voteColor === 'default' ? 'default' : voteColor} variant={result.vote === 'both_good' || result.vote === 'both_bad' ? 'outlined' : 'filled'} sx={{ fontWeight: 600 }} /> {/* 展开详情 */} QUESTION {question?.question} {/* 左侧详情 */} {/* 右侧详情 */} ); } export default function ResultDetailList({ task }) { const { t } = useTranslation(); return ( {t('blindTest.detailResults', '详细结果')} {task.detail?.results?.map((result, index) => { const question = task.evalDatasets?.find(q => q.id === result.questionId); return ; })} ); }