import Link from 'next/link'; import { Evidence } from '@/components/evidence'; import { Chip, OpennessBadge, StatusBadge, TierBadge } from '@/components/ui/badges'; import { DataTable, EmptyRow, Td, Th } from '@/components/ui/data-table'; import { EntityLink } from '@/components/ui/entity'; import { Note } from '@/components/ui/section'; import { fmtDate, fmtInt, fmtParams, fmtScore, fmtTokens, fmtUsdPerM, num } from '@/lib/format'; import { routes } from '@/lib/site'; import type { EntitySummary, Price, TimeMachineLeader, TimeMachineModelRow } from '@/lib/types'; /* Time-machine tables (server). Every as-of value is an evidence trigger (claim validity in the drawer); the "today" column comes from the same payload (`model.attributes` is the current record), so nothing extra is fetched. */ function AsOf({ e, property, value, display }: { e: EntitySummary; property: string; value: unknown; display: string }) { if (value === null || value === undefined || value === '') return —; return ( {display} ); } function Today({ asof, now, format }: { asof: unknown; now: unknown; format: (v: unknown) => string }) { const a = asof === null || asof === undefined || asof === '' ? null : format(asof); const b = now === null || now === undefined || now === '' ? null : format(now); if (b === null) return —; if (a === b) return same; return {b}; } export function ModelsAsOf({ rows, total, date, limit }: { rows: TimeMachineModelRow[]; total: number | null; date: string; limit: number }) { return ( <> Model Organization Params Context (as of) Context (today) Openness Status (as of) Status (today) Released Basis History {rows.length === 0 && No canonical model existed at this date according to release dates and dated claims.} {rows.map(({ model: m, attributes_as_of: a, observed_then, reconstructed }) => ( {m.organization ? {m.organization.name} : —} fmtTokens(v)} /> {typeof a.openness === 'string' ? : —} {typeof a.status === 'string' ? : —} String(v)} /> {typeof a.release_date === 'string' ? fmtDate(a.release_date) : typeof m.attributes?.release_date === 'string' ? fmtDate(m.attributes.release_date as string) : '—'} {observed_then ? observed : reconstructed ? reconstructed : —} as of {date} → ))} {total !== null && total > rows.length && Showing {fmtInt(rows.length)} of {fmtInt(total)} models that existed on this date (API cap {fmtInt(limit)}). Open a model's History tab for its full as-of record.} “Today” columns compare the as-of value with the current record; “same” means no recorded change. Click any as-of value for the claim behind it (source, tier, valid from → to). ); } export function PricesAsOf({ rows, total, date }: { rows: Price[]; total: number | null; date: string }) { return ( <> Model Provider Input / 1M Output / 1M Context Valid from Valid to Source {rows.length === 0 && No price row's validity interval covers this date (price history starts when AI Atlas first observed the provider).} {rows.map((p) => ( {fmtUsdPerM(p.input_per_mtok)} {fmtUsdPerM(p.output_per_mtok)} {num(p.context_length) === null ? '—' : fmtTokens(p.context_length)} {fmtDate(p.valid_from)} {p.valid_to ? fmtDate(p.valid_to) : current} {p.source_url && ( source )} ))} {total !== null && total > rows.length && Showing {fmtInt(rows.length)} of {fmtInt(total)} offers valid on this date.} ); } export function LeadersAsOf({ rows, date }: { rows: TimeMachineLeader[]; date: string }) { return ( <> Benchmark Leader Organization Score Metric · group Trust Models ranked {rows.length === 0 && No benchmark result had been observed by this date — leaders are known only once a result is observed (evaluation dates are not used).} {rows.map((r) => ( {r.benchmark.name} {r.benchmark.category && {r.benchmark.category}} {r.leader ? : —} {r.leader?.model.organization?.name ?? '—'} {r.leader ? fmtScore(r.leader.score) : '—'} {r.leader?.metric ?? '—'} {r.leader?.group_label && r.leader.group_label !== r.leader.metric && {r.leader.group_label}} {r.leader?.trust_level ?? '—'} {r.leader?.n_models === undefined ? '—' : fmtInt(r.leader.n_models)} ))} One row per benchmark: the best current row of the primary comparability group among results observed by the date. See the benchmark's Frontier tab for the full leader history. ); } export function HardwareAsOf({ rows, date }: { rows: { hardware: EntitySummary; reconstructed?: boolean }[]; date: string }) { return ( Hardware Manufacturer Kind Memory Bandwidth Released Basis {rows.length === 0 && No hardware with a release date on or before this date.} {rows.map(({ hardware: h, reconstructed }) => { const a = h.attributes ?? {}; const mem = Array.isArray(a.memory_gb) ? (a.memory_gb as unknown[]).map((x) => fmtInt(x)).join(' / ') : num(a.memory_gb) === null ? '—' : fmtInt(a.memory_gb); return ( {typeof a.manufacturer === 'string' ? a.manufacturer : h.organization?.name ?? '—'} {typeof a.kind === 'string' ? a.kind : '—'} {mem === '—' ? mem : `${mem} GB`} {num(a.memory_bandwidth_gbs) === null ? '—' : `${fmtInt(a.memory_bandwidth_gbs)} GB/s`} {typeof a.release_date === 'string' ? fmtDate(a.release_date) : '—'} {reconstructed ? reconstructed : observed} ); })} ); }