All files / src/components/chat/QualityCheck QualityCheckBadge.tsx

100% Statements 4/4
100% Branches 2/2
100% Functions 1/1
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 33 34 35 36 37 38 39 40 41        16x               16x                         16x       24x                      
import { QUALITY_CHECK, StatusBadge } from "@/components/detail";
import type { QualityOutcome } from "@/objects/Model";
import React from "react";
 
const LABEL: Record<QualityOutcome, string> = {
  passed: "Checked",
  revised: "Revised after check",
  failed: "Failed check",
  unavailable: "Not checked",
  skipped: "Not checked (simple request)",
};
 
const EXPLAIN: Record<QualityOutcome, string> = {
  passed: "The agent's quality check reviewed this answer and it passed.",
  revised:
    "The quality check found gaps in the agent's first answer; the agent revised it, and the revision passed.",
  failed: "The quality check found problems the agent's revisions did not fix.",
  unavailable: "No quality check ran on this answer.",
  skipped:
    "This agent's cost profile answers a request it reads as simple without a quality check.",
};
 
/** What became of an answer at the agent's quality check. The score is the
 *  evaluator model's judgement of the draft — not a calibrated confidence —
 *  so it is offered in the tooltip, never as the label. */
const QualityCheckBadge: React.FC<{ outcome: QualityOutcome; score?: number }> = ({
  outcome,
  score,
}) => (
  <span
    title={
      EXPLAIN[outcome] +
      (typeof score === "number" ? ` Quality score ${score}/100.` : "")
    }
  >
    <StatusBadge status={outcome} scale={QUALITY_CHECK} label={LABEL[outcome]} />
  </span>
);
 
export default QualityCheckBadge;