(async function () { const $ = id => document.getElementById(id); const BLUE = "var(--blue)", TEAL = "var(--teal)", GREEN = "var(--green)", GRAY = "#94a3b8", RED = "#e5484d"; const GR = "#94a3b8"; $("diagram").innerHTML = ``; const H = window.RIcharts.hbar, frac = (a, b) => ({ value: a / b, text: `${a}/${b}` }); H($("scaleChart"), [ Object.assign({ label: "VAL-LLM BOOST · 0.45M tokens", color: BLUE }, frac(17, 21)), Object.assign({ label: "VAL-LLM BOOST · 1.5M tokens", color: BLUE }, frac(17, 21)), Object.assign({ label: "VAL-LLM BOOST · 14.95M tokens", color: BLUE }, frac(17, 21)), { label: "Full window · 45K tokens", value: 0.004, text: "0/13", color: RED }], { max: 1, labelW: 220, w: 560 }); H($("boostChart"), [ Object.assign({ label: "All 21 · memory alone", color: GRAY }, frac(17, 21)), Object.assign({ label: "All 21 · with BOOST", color: TEAL }, frac(20, 21)), { label: "Multi-hop · memory alone", value: 0.004, text: "0/2", color: GRAY }, Object.assign({ label: "Multi-hop · with BOOST", color: TEAL }, frac(1, 2)), { label: "Aggregation · memory alone", value: 0.004, text: "0/2", color: GRAY }, Object.assign({ label: "Aggregation · with BOOST", color: TEAL }, frac(2, 2))], { max: 1, labelW: 220, w: 560 }); const txt = await (await fetch("evidence/ledger.jsonl")).text(); const ROWS = txt.split("\n").filter(l => l.trim()).map(l => JSON.parse(l)); const SUM = await (await fetch("evidence/summary.json")).json(); const seg = SUM.local_312_summary.segments; const pct = s => { const [a, b] = s.split("/").map(Number); return { value: a / b, text: s }; }; H($("segChart"), [ Object.assign({ label: "Core · first third", color: BLUE }, pct(seg.first.core)), Object.assign({ label: "Core · middle third", color: BLUE }, pct(seg.middle.core)), Object.assign({ label: "Core · last third", color: BLUE }, pct(seg.last.core)), Object.assign({ label: "Traps · first", color: TEAL }, pct(seg.first.traps)), Object.assign({ label: "Traps · middle", color: TEAL }, pct(seg.middle.traps)), Object.assign({ label: "Traps · last", color: TEAL }, pct(seg.last.traps)), { label: "Hallucinated tokens", value: 0.004, text: "0", color: GREEN }], { max: 1, labelW: 180, w: 560 }); const local312 = ROWS.filter(r => r.edition === "local" && r.run.startsWith("312")); $("kAns").textContent = local312.filter(r => r.verdict === "emit").length; $("kSil").textContent = local312.filter(r => r.verdict !== "emit").length; const SILENT = "根据已摄入的资料无法确定。"; const key = r => `${r.edition} · ${r.run}`; const esc = s => String(s).replace(/[&<>"]/g, c => ({ "&": "&", "<": "<", ">": ">", '"': """ }[c])); const runs = [...new Set(ROWS.map(key))]; $("run").innerHTML = runs.map(r => ``).join(""); $("kind").innerHTML = ["all", ...[...new Set(ROWS.map(r => r.kind))].sort()].map(k => ``).join(""); function view() { const run = $("run").value, kind = $("kind").value, vd = $("verdict").value; const rows = ROWS.filter(r => key(r) === run && (kind === "all" || r.kind === kind) && (vd === "all" || r.verdict === vd)); const emit = rows.filter(r => r.verdict === "emit").length, fab = rows.reduce((a, r) => a + (r.fabricated || 0), 0); const core = rows.filter(r => ["n_start", "n_mid", "n_end"].includes(r.qid)), coreOk = core.filter(r => r.pass === true).length; $("cards").innerHTML = [[rows.length, "turns shown", "b"], [`${emit} / ${rows.length - emit}`, "answered / silent", "t"], [core.length ? `${coreOk}/${core.length}` : "—", "core questions correct", "g"], [fab, "hallucinated tokens", "g"]] .map(([v, l, c]) => `
${r.kind}Failed to load: ${e}
`));