fix(ui): display 5-point scale scores correctly in dimension cards

This commit is contained in:
sinohqb 2026-08-20 19:34:18 +08:00
parent fb68f9ebce
commit d61657eedb

View File

@ -105,15 +105,15 @@ function SessionMessages({ evalId, sessionId, verdict }: {
function DimensionScoresCards({ dimScores }: { dimScores: [string, number][] }) {
const getScoreMeta = (score: number) => {
if (score >= 0.8) return { color: statusColors.completed, label: '优秀', icon: <CheckCircleOutlined /> }
if (score >= 0.6) return { color: colors.warning, label: '良好', icon: <WarningOutlined /> }
if (score >= 4) return { color: statusColors.completed, label: '优秀', icon: <CheckCircleOutlined /> }
if (score >= 3) return { color: colors.warning, label: '良好', icon: <WarningOutlined /> }
return { color: statusColors.failed, label: '待改进', icon: <CloseCircleOutlined /> }
}
return (
<div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
{dimScores.map(([dimension, score]) => {
const pct = Math.round(score * 100)
const pct = Math.round((score / 5) * 100)
const meta = getScoreMeta(score)
return (
<div key={dimension} style={{ padding: '12px 16px', background: colors.bgSubtle, borderRadius: 8 }}>
@ -136,7 +136,7 @@ function DimensionScoresCards({ dimScores }: { dimScores: [string, number][] })
/>
</div>
<div style={{ fontSize: 18, fontWeight: 700, color: meta.color, minWidth: 40, textAlign: 'right' }}>
{pct}
{score.toFixed(1)}
</div>
</div>
</div>