import { useMemo, useState } from "react"; import type { TaskDefinition } from "@shared/schema"; import { CHECKPOINT_ACCENT, CHECKPOINT_TAG, GRADER_TAG, SAMPLE_TASKS, TASK_GROUPS, type PaperGroupId, type SampleTask, } from "@/data/benchmarkContent"; import { ExternalLink } from "lucide-react"; type TaskExplorerProps = { taskDefs: TaskDefinition[]; selectedId?: string; onSelect?: (taskId: string) => void; }; function TaskCard({ task, selected, onClick, }: { task: SampleTask; selected: boolean; onClick: () => void; }) { const n = task.evaluationCheckpoints.length; return ( ); } function TaskDetail({ task, taskDef }: { task: SampleTask; taskDef?: TaskDefinition }) { const instruction = taskDef?.prompt ?? task.instruction; return (

Task instruction

{task.title}

{instruction || task.scenario}

View source paper

Evaluation checkpoints

{task.evaluationCheckpoints.map((cp) => (
{cp.id} {cp.title} {cp.category} {cp.grader}

{cp.description}

))}
{taskDef && (

Benchmark metrics

{taskDef.metrics.map((m) => ( {m} ))} Human agreement: {taskDef.agreement}
)}
); } export function TaskExplorer({ taskDefs, selectedId, onSelect }: TaskExplorerProps) { const [activeGroup, setActiveGroup] = useState("cmm-rx-llm"); const [internalId, setInternalId] = useState(SAMPLE_TASKS[0]?.id ?? ""); const groupTasks = useMemo( () => SAMPLE_TASKS.filter((t) => t.paperGroup === activeGroup), [activeGroup], ); const activeId = selectedId ?? internalId; const activeTask = SAMPLE_TASKS.find((t) => t.id === activeId && t.paperGroup === activeGroup) ?? groupTasks[0] ?? SAMPLE_TASKS[0]; const taskDef = taskDefs.find((t) => t.name === activeTask?.taskName); const select = (id: string) => { if (onSelect) onSelect(id); else setInternalId(id); }; const switchGroup = (groupId: PaperGroupId) => { setActiveGroup(groupId); const first = SAMPLE_TASKS.find((t) => t.paperGroup === groupId); if (first) select(first.id); }; if (!activeTask) return null; return (
{TASK_GROUPS.map((group) => ( ))}
{groupTasks.map((task) => ( select(task.id)} /> ))}
); }