first commit of v.02 application
This commit is contained in:
22
client/src/components/GroundednessScore.jsx
Normal file
22
client/src/components/GroundednessScore.jsx
Normal file
@@ -0,0 +1,22 @@
|
||||
const LEVEL_LABELS = {
|
||||
green: 'High score. Factually reliable response.',
|
||||
gold: 'Average score. Reliable response, may exhibit minor drift from source.',
|
||||
red: 'Low score. Unreliable response, factually inaccurate or hallucination.',
|
||||
};
|
||||
|
||||
function GroundednessScore({ score }) {
|
||||
if (score == null) return null;
|
||||
|
||||
const pct = Math.round(score * 100);
|
||||
let level = 'red';
|
||||
if (pct >= 75) level = 'green';
|
||||
else if (pct >= 50) level = 'gold';
|
||||
|
||||
return (
|
||||
<span className={`groundedness-score ${level}`}>
|
||||
Grounded: {pct}% – {LEVEL_LABELS[level]}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
export default GroundednessScore;
|
||||
Reference in New Issue
Block a user