SPB Git

spb/llmindex Public

The discriminative, contamination-resistant, fully transparent LLM ranking — updated live.

TypeScript 77.9% TeX 15.2% Python 3.7% SQL 1.4% JavaScript 1.1% Shell 0.5%
2.1 KB · 62 lines tsx
Raw Blame History
1/**2 * llmindex.io — shared UI primitives (score display with mandatory CI whiskers)3 * Author:  Simon-Pierre Boucher4 * Contact: contact@spboucher.ai5 * License: Proprietary — © Simon-Pierre Boucher, all rights reserved6 */7import type { ReactElement } from 'react';89export interface ScoreBarProps {10  score: number;11  scoreLow: number;12  scoreHigh: number;13  max?: number;14}1516/**17 * Horizontal score bar with a CI whisker. Uncertainty is always rendered —18 * a score without its CI is a methodology violation (§8).19 */20export function ScoreBar({ score, scoreLow, scoreHigh, max = 1000 }: ScoreBarProps): ReactElement {21  const pct = (v: number): number => Math.min(100, Math.max(0, (v / max) * 100));22  return (23    <div className="relative h-2 w-full rounded bg-zinc-200" title={`${score} (95% CI ${scoreLow}–${scoreHigh})`}>24      <div className="absolute h-2 rounded bg-emerald-500/80" style={{ width: `${pct(score)}%` }} />25      <div26        className="absolute top-1/2 h-3 -translate-y-1/2 border-y border-zinc-500/80"27        style={{ left: `${pct(scoreLow)}%`, width: `${Math.max(0.5, pct(scoreHigh) - pct(scoreLow))}%` }}28      />29    </div>30  );31}3233export function ScoreValue({ score, scoreLow, scoreHigh }: ScoreBarProps): ReactElement {34  return (35    <span className="tabular-nums">36      <span className="font-semibold text-zinc-900">{score}</span>{' '}37      <span className="text-xs text-zinc-600">38        [{scoreLow}–{scoreHigh}]39      </span>40    </span>41  );42}4344export function DemoBanner(): ReactElement {45  return (46    <div className="rounded-md border border-amber-300 bg-amber-50 px-4 py-2 text-sm text-amber-800">47      Demo data — these scores are deterministic placeholders, not a real evaluation. They will be48      replaced by the first published IRT fit run.49    </div>50  );51}5253export function formatUsd(v: number | null | undefined): string {54  if (v == null) return '—';55  return v < 1 ? `$${v.toFixed(3)}` : `$${v.toFixed(2)}`;56}5758export function formatMs(v: number | null | undefined): string {59  if (v == null) return '—';60  return v >= 1000 ? `${(v / 1000).toFixed(1)}s` : `${Math.round(v)}ms`;61}62