import { cn } from "@/lib/cn"; import type { ChunkView } from "@/lib/api"; /** * The score ladder: how a passage got here, left to right. * * D·3 S·7 → RRF .0312 → CE +5.11 * * This is the structural device of the interface, and it is not decorative numbering — * every figure is a real intermediate value from the retrieval run. A passage found by * only one retriever visibly shows the gap where the other rank would be, which is the * clearest possible argument for why hybrid retrieval exists. */ export function ScoreLadder({ chunk, className }: { chunk: ChunkView; className?: string }) { return (
D·{chunk.dense_rank ?? "—"} S·{chunk.sparse_rank ?? "—"} RRF {chunk.rrf_score !== null ? chunk.rrf_score.toFixed(4).replace(/^0/, "") : "—"} {chunk.rerank_score !== null ? ( <> = 0 ? "text-indigo" : "text-ochre"} title={ chunk.rerank_probability !== null ? `cross-encoder logit; ${(chunk.rerank_probability * 100).toFixed(1)}% relevance` : "cross-encoder logit" } > CE {chunk.rerank_score >= 0 ? "+" : ""} {chunk.rerank_score.toFixed(2)} ) : null}
); }