File size: 1,175 Bytes
1c0c94d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { useRuntime } from '../../context/RuntimeContext.jsx'
import ScoreBar from './ScoreBar.jsx'

// Explains HOW the fused confidence was reached, source by source.
export default function ScoreBreakdown({ scores }) {
  const rt = useRuntime()
  if (!scores) return null
  const fused = Number(scores.fused) || 0
  const autoT = rt.auto_confirm_threshold ?? 0.85
  const reviewT = rt.review_threshold ?? 0.55
  const fusedColor = fused >= autoT ? '#16a34a' : fused >= reviewT ? '#d97706' : '#64748b'
  const note =
    fused >= autoT
      ? `≥ ${autoT} auto-confirm threshold ✓`
      : fused >= reviewT
        ? `between ${reviewT} and ${autoT} — needs a second opinion`
        : `below ${reviewT} review threshold`

  return (
    <div>
      <ScoreBar label="Detection" value={scores.detection} />
      <ScoreBar label="Rule" value={scores.rule} />
      <ScoreBar label="Attribute" value={scores.attribute} />
      <ScoreBar label="VLM" value={scores.vlm} off={scores.vlm == null} />
      <ScoreBar label="Fused" value={fused} color={fusedColor} fused />
      <div className="muted" style={{ marginTop: 4 }}>
        {note}
      </div>
    </div>
  )
}