[id].astro (1930B)
1 --- 2 import Base from "../../layouts/Base.astro"; 3 import { loadAllRuns, loadTranscript, getAxisValues } from "../../lib/data"; 4 import RunDetail from "../../components/RunDetail"; 5 import fs from "node:fs"; 6 import path from "node:path"; 7 8 const allRuns = loadAllRuns(); 9 const axisValues = getAxisValues(allRuns); 10 11 export function getStaticPaths() { 12 const runs = loadAllRuns(); 13 const axisValues = getAxisValues(runs); 14 return runs.map((run) => { 15 // Load context file if context_file=provided 16 let contextContent = ""; 17 if (run.meta.context_file === "provided") { 18 try { 19 const ctxPath = path.resolve(process.cwd(), `../tasks/${run.meta.task}/context.md`); 20 contextContent = fs.readFileSync(ctxPath, "utf-8"); 21 } catch { /* not found */ } 22 } 23 return { 24 params: { id: run.meta.run_id }, 25 props: { run, axisValues, contextContent }, 26 }; 27 }); 28 } 29 30 const { run, axisValues: av, contextContent } = Astro.props; 31 const transcriptLines = loadTranscript(run.meta.run_id); 32 33 const parts = run.meta.run_id.split("_run"); 34 const runNum = parts.length > 1 ? `Run #${parts[parts.length - 1]}` : ""; 35 --- 36 37 <Base title={`${run.meta.task} - ${run.meta.model} - ${run.meta.prompt_style}`}> 38 <div style="margin-bottom: 16px;"> 39 <a href="/" style="font-size: 0.875rem;">Back to Grid</a> 40 </div> 41 <div style="display: flex; align-items: baseline; gap: 12px; margin-bottom: 4px;"> 42 <h1 style="font-size: 1.5rem;">{run.meta.task}</h1> 43 <span style="color: var(--text-muted); font-size: 0.875rem;">{runNum}</span> 44 </div> 45 <p style="color: var(--text-muted); margin-bottom: 24px; font-size: 0.8rem;"> 46 {run.meta.completed_at || "in progress"} 47 </p> 48 49 <RunDetail client:load run={run} transcriptLines={transcriptLines} axisValues={av} contextContent={contextContent} /> 50 </Base> 51 52 <style> 53 :global(.container) { 54 max-width: none !important; 55 padding: 0 32px !important; 56 } 57 </style>