Referenz: externe Läufe exportieren und importieren, Referenz ohne Rang mit Strich im Ranking, Reiter Referenz; Roadmap 0.1.1
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
269
src/lib/ReferencePanel.svelte
Normal file
269
src/lib/ReferencePanel.svelte
Normal file
@ -0,0 +1,269 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from "svelte";
|
||||
import { revealItemInDir } from "@tauri-apps/plugin-opener";
|
||||
import { api, groupLabel, type BatchInfo, type ExportResult, type ImportSummary, type LoadReport, type TaskInfo } from "$lib/api";
|
||||
|
||||
let { tasks, onimported }: { tasks: LoadReport | null; onimported: (batchId: number) => void } = $props();
|
||||
|
||||
// 1. Exportieren
|
||||
let chosen = $state<string[]>([]);
|
||||
let repeats = $state(1);
|
||||
let exporting = $state(false);
|
||||
let exported = $state<ExportResult | null>(null);
|
||||
let exportError = $state("");
|
||||
|
||||
let byGroup = $derived.by(() => {
|
||||
const m = new Map<string, TaskInfo[]>();
|
||||
for (const t of tasks?.tasks ?? []) {
|
||||
if (!m.has(t.group)) m.set(t.group, []);
|
||||
m.get(t.group)!.push(t);
|
||||
}
|
||||
return [...m.entries()].sort((a, b) => a[0].localeCompare(b[0]));
|
||||
});
|
||||
|
||||
function toggle(id: string) {
|
||||
chosen = chosen.includes(id) ? chosen.filter((x) => x !== id) : [...chosen, id];
|
||||
}
|
||||
|
||||
async function doExport() {
|
||||
exporting = true;
|
||||
exportError = "";
|
||||
exported = null;
|
||||
try {
|
||||
exported = await api.exportExternal($state.snapshot(chosen), repeats);
|
||||
} catch (e) {
|
||||
exportError = String(e);
|
||||
} finally {
|
||||
exporting = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function reveal(path: string) {
|
||||
try {
|
||||
await revealItemInDir(path);
|
||||
} catch {
|
||||
// Ohne Dateimanager bleibt der Pfad als Text sichtbar.
|
||||
}
|
||||
}
|
||||
|
||||
// 3. Importieren
|
||||
let batches = $state<BatchInfo[]>([]);
|
||||
let dir = $state("");
|
||||
let model = $state("Claude Code (extern)");
|
||||
let batchId = $state<number | null>(null);
|
||||
let importing = $state(false);
|
||||
let summary = $state<ImportSummary | null>(null);
|
||||
let importError = $state("");
|
||||
|
||||
onMount(async () => {
|
||||
try {
|
||||
batches = await api.batches();
|
||||
if (batches.length > 0) batchId = batches[0].id;
|
||||
} catch {
|
||||
batches = [];
|
||||
}
|
||||
});
|
||||
|
||||
// Nach einem Export liegt der Pfad nahe, den wir nach dem Lösen wieder brauchen.
|
||||
$effect(() => {
|
||||
if (exported && !dir) dir = exported.dir;
|
||||
});
|
||||
|
||||
async function doImport() {
|
||||
if (batchId === null) return;
|
||||
importing = true;
|
||||
importError = "";
|
||||
summary = null;
|
||||
try {
|
||||
summary = await api.importExternal(dir.trim(), model, batchId);
|
||||
} catch (e) {
|
||||
importError = String(e);
|
||||
} finally {
|
||||
importing = false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<section class="card">
|
||||
<h2>Referenz von Hand erzeugen</h2>
|
||||
<p class="muted">
|
||||
Modelle, die du nicht anbinden kannst (z. B. Claude über ein Abo), löst du mit einem Werkzeug deiner Wahl, etwa Claude Code.
|
||||
coding-bench exportiert die Aufgaben als Ordner, prüft deine Ergebnisse mit derselben <code>check.sh</code> wie bei lokalen
|
||||
Modellen und zeigt das Ergebnis als Referenz im Ranking.
|
||||
</p>
|
||||
<p class="notice">
|
||||
<strong>Achtung, anderes Harness:</strong> Die Referenz misst „Modell plus dein Werkzeug“. Es gibt kein Schrittlimit, kein
|
||||
Zeitlimit, und das Werkzeug hat eigene Tools und Anweisungen. Der Strich im Ranking ist ein Orientierungswert, kein
|
||||
Gleichstand der Bedingungen.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<h2>1. Aufgaben exportieren</h2>
|
||||
{#if !tasks || tasks.tasks.length === 0}
|
||||
<p class="muted">Keine Aufgaben geladen.</p>
|
||||
{/if}
|
||||
{#each byGroup as [group, list] (group)}
|
||||
<h3><span class="gbadge">{group}</span> {groupLabel(group)}</h3>
|
||||
<div class="list">
|
||||
{#each list as t (t.id)}
|
||||
<label class="choice">
|
||||
<input type="checkbox" checked={chosen.includes(t.id)} onchange={() => toggle(t.id)} />
|
||||
<span><strong>{t.title}</strong> <span class="muted small">{t.id}</span></span>
|
||||
</label>
|
||||
{/each}
|
||||
</div>
|
||||
{/each}
|
||||
<div class="row">
|
||||
<label class="rep">
|
||||
Durchläufe je Aufgabe
|
||||
<input type="number" min="1" max="10" bind:value={repeats} />
|
||||
</label>
|
||||
<span class="muted small">
|
||||
{chosen.length * repeats} Sitzung(en) von Hand. Mit weniger als 3 Durchläufen ist die Referenz nur ein grober Hinweis.
|
||||
</span>
|
||||
<span class="spacer"></span>
|
||||
<button class="primary" onclick={doExport} disabled={chosen.length === 0 || repeats < 1 || exporting}>
|
||||
{exporting ? "exportiere …" : "Exportieren"}
|
||||
</button>
|
||||
</div>
|
||||
{#if exportError}<p class="error">{exportError}</p>{/if}
|
||||
{#if exported}
|
||||
<p class="ok">
|
||||
{exported.folders} Ordner angelegt:
|
||||
<code>{exported.dir}</code>
|
||||
<button class="link" onclick={() => reveal(exported!.dir)}>im Dateimanager zeigen</button>
|
||||
</p>
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<h2>2. Lösen lassen</h2>
|
||||
<ol class="muted steps">
|
||||
<li>Im Exportordner steht eine <code>ANLEITUNG.md</code>. Lies sie kurz.</li>
|
||||
<li>
|
||||
Pro Durchlauf eine frische Sitzung in <code><aufgabe>/run-<n>/arbeit/</code> starten und den Inhalt von
|
||||
<code>AUFGABE.md</code> als Auftrag einfügen.
|
||||
</li>
|
||||
<li>Kein Web, keine Hinweise, nur den Ordner <code>arbeit/</code> verändern lassen.</li>
|
||||
</ol>
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<h2>3. Ergebnis importieren</h2>
|
||||
<div class="grid">
|
||||
<label class="wide">
|
||||
Exportordner mit den Ergebnissen
|
||||
<input bind:value={dir} placeholder="/home/…/exports/referenz-…" />
|
||||
</label>
|
||||
<label>
|
||||
Name der Referenz
|
||||
<input bind:value={model} />
|
||||
</label>
|
||||
<label>
|
||||
In welchen Batch?
|
||||
<select bind:value={batchId} disabled={batches.length === 0}>
|
||||
{#each batches as b (b.id)}
|
||||
<option value={b.id}>Batch {b.id} · {b.created_at.slice(0, 16)} · {b.runs} Läufe</option>
|
||||
{/each}
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
{#if batches.length === 0}
|
||||
<p class="muted small">Es gibt noch keinen Batch. Starte zuerst einen Benchmark mit lokalen Modellen, damit die Referenz einen Vergleich hat.</p>
|
||||
{/if}
|
||||
<div class="row">
|
||||
<span class="muted small">Die App kopiert die Ergebnisse in einen Container und lässt dort <code>check.sh</code> laufen. Bereits importierte Läufe mit gleichem Namen werden ersetzt.</span>
|
||||
<span class="spacer"></span>
|
||||
<button class="primary" onclick={doImport} disabled={importing || !dir.trim() || !model.trim() || batchId === null}>
|
||||
{importing ? "prüfe …" : "Prüfen und speichern"}
|
||||
</button>
|
||||
</div>
|
||||
{#if importError}<p class="error">{importError}</p>{/if}
|
||||
{#if summary}
|
||||
<p class={summary.imported > 0 ? "ok" : "error"}>
|
||||
{summary.imported} Lauf/Läufe geprüft, {summary.passed} bestanden.
|
||||
{#if batchId !== null}<button class="link" onclick={() => onimported(batchId!)}>Ergebnisse ansehen</button>{/if}
|
||||
</p>
|
||||
{#if summary.skipped.length > 0}
|
||||
<details open>
|
||||
<summary class="error">{summary.skipped.length} Ordner nicht geprüft</summary>
|
||||
<ul>
|
||||
{#each summary.skipped as s (s)}<li>{s}</li>{/each}
|
||||
</ul>
|
||||
</details>
|
||||
{/if}
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
<style>
|
||||
.notice {
|
||||
border: 1px solid color-mix(in srgb, var(--accent) 50%, var(--border));
|
||||
background: var(--accent-soft);
|
||||
border-radius: 10px;
|
||||
padding: 0.6rem 0.9rem;
|
||||
margin: 0.8rem 0 0;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
.gbadge {
|
||||
display: inline-grid;
|
||||
place-items: center;
|
||||
width: 1.5rem;
|
||||
height: 1.5rem;
|
||||
border-radius: 6px;
|
||||
background: var(--accent);
|
||||
color: var(--accent-text);
|
||||
font-size: 0.8rem;
|
||||
font-weight: 800;
|
||||
margin-right: 0.3rem;
|
||||
}
|
||||
.list {
|
||||
display: grid;
|
||||
gap: 0.25rem;
|
||||
margin-bottom: 0.8rem;
|
||||
}
|
||||
.choice {
|
||||
display: flex;
|
||||
gap: 0.6rem;
|
||||
align-items: baseline;
|
||||
}
|
||||
.row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.7rem 1rem;
|
||||
margin-top: 0.9rem;
|
||||
}
|
||||
.spacer {
|
||||
flex: 1;
|
||||
}
|
||||
.rep,
|
||||
.grid label {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.2rem;
|
||||
font-size: 0.85rem;
|
||||
color: var(--muted);
|
||||
}
|
||||
.rep input {
|
||||
width: 5rem;
|
||||
color: var(--text);
|
||||
}
|
||||
.grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 0.6rem 0.8rem;
|
||||
}
|
||||
.grid .wide {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
.grid input,
|
||||
.grid select {
|
||||
color: var(--text);
|
||||
font-size: 1rem;
|
||||
}
|
||||
.steps {
|
||||
padding-left: 1.2rem;
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
@ -66,6 +66,15 @@
|
||||
detail = { run, steps: await api.steps(selected, run) };
|
||||
}
|
||||
|
||||
// Angebundene Modelle zuerst, dann die Referenzen (von Hand gelöst, ohne Rang).
|
||||
let ordered = $derived(
|
||||
ranking ? [...ranking.models.filter((m) => !m.external), ...ranking.models.filter((m) => m.external)] : [],
|
||||
);
|
||||
let bestRef = $derived(ranking?.models.find((m) => m.external) ?? null);
|
||||
function refPct(group: string): number | null {
|
||||
return bestRef?.groups.find((g) => g.group === group)?.percent ?? null;
|
||||
}
|
||||
|
||||
// Kleinste Zahl gewerteter Durchläufe in einer Zelle der Matrix.
|
||||
let minRepeats = $derived(ranking && ranking.cells.length > 0 ? Math.min(...ranking.cells.map((c) => c.runs)) : 0);
|
||||
|
||||
@ -112,16 +121,25 @@
|
||||
|
||||
{#if ranking && ranking.models.length > 0}
|
||||
<div class="board">
|
||||
{#each ranking.models as m (m.model)}
|
||||
<article class="mcard" class:top={m.rank <= 3} data-rank={m.rank}>
|
||||
<div class="badge r{Math.min(m.rank, 4)}" aria-label="Platz {m.rank}">{m.rank}</div>
|
||||
{#each ordered as m (m.model)}
|
||||
<article class="mcard" class:ref={m.external} data-rank={m.rank}>
|
||||
<div class="badge r{m.external ? 5 : Math.min(m.rank, 4)}" aria-label={m.external ? "Referenz" : `Platz ${m.rank}`}>
|
||||
{m.external ? "R" : m.rank}
|
||||
</div>
|
||||
<div class="mhead">
|
||||
<h3 class="mname">{m.model}</h3>
|
||||
<h3 class="mname">
|
||||
{m.model}
|
||||
{#if m.external}<span class="chip" title="Von Hand außerhalb der App gelöst, anderes Harness, zählt nicht im Rang">Referenz · extern</span>{/if}
|
||||
</h3>
|
||||
<div class="stats">
|
||||
<span title="Bestandene Läufe">✔ {m.successes}/{m.runs}</span>
|
||||
<span title="Median der Laufzeit">⏱ {fmtDuration(m.median_duration_ms)}</span>
|
||||
<span title="Tokens pro Sekunde: Tokens geteilt durch die gesamte Laufzeit eines Laufs, also inklusive Tool- und Prüfzeit. Nicht die reine Erzeugungsgeschwindigkeit.">⚡ {fmtTps(m.median_tps)}</span>
|
||||
<span title="Durchschnittlich erzeugte Tokens je Lauf">∅ {Math.round(m.mean_completion_tokens)} Tokens</span>
|
||||
{#if !m.external}
|
||||
<span title="Median der Laufzeit">⏱ {fmtDuration(m.median_duration_ms)}</span>
|
||||
<span title="Tokens pro Sekunde: Tokens geteilt durch die gesamte Laufzeit eines Laufs, also inklusive Tool- und Prüfzeit. Nicht die reine Erzeugungsgeschwindigkeit.">⚡ {fmtTps(m.median_tps)}</span>
|
||||
<span title="Durchschnittlich erzeugte Tokens je Lauf">∅ {Math.round(m.mean_completion_tokens)} Tokens</span>
|
||||
{:else}
|
||||
<span>Zeit und Tokens nicht gemessen</span>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
<div class="total">
|
||||
@ -141,7 +159,10 @@
|
||||
</div>
|
||||
<div class="meter">
|
||||
{#if g.percent !== null}
|
||||
<div style:width="{g.percent}%" style:background={pctColor(g.percent)}></div>
|
||||
<div class="f" style:width="{g.percent}%" style:background={pctColor(g.percent)}></div>
|
||||
{/if}
|
||||
{#if !m.external && refPct(g.group) !== null}
|
||||
<div class="tick" style:left="{refPct(g.group)}%" title="Referenz {bestRef?.model}: {fmtPct(refPct(g.group))}"></div>
|
||||
{/if}
|
||||
</div>
|
||||
{#if g.percent !== null}
|
||||
@ -159,6 +180,12 @@
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
{#if bestRef}
|
||||
<p class="muted small legend">
|
||||
<span class="tick-demo"></span> Strich im Balken = Referenz <strong>{bestRef.model}</strong> (extern, von Hand gelöst, anderes Harness).
|
||||
</p>
|
||||
{/if}
|
||||
|
||||
{#if minRepeats < 3}
|
||||
<p class="notice">
|
||||
Pro Aufgabe {minRepeats === 1 ? "gab es nur 1 Durchlauf" : `gab es nur ${minRepeats} Durchläufe`}. Dann können Unterschiede
|
||||
@ -271,6 +298,9 @@
|
||||
Schritte: {detail.run.model} · {detail.run.task_id} · Durchlauf {detail.run.repeat_idx}
|
||||
<button class="link" onclick={() => (detail = null)}>schließen</button>
|
||||
</h3>
|
||||
{#if detail.run.external}
|
||||
<p class="muted">Extern gelöst, keine Schritte aufgezeichnet. Der Ergebnisordner steht unter <code>{detail.run.artifact_path ?? "unbekannt"}</code>.</p>
|
||||
{/if}
|
||||
{#if detail.run.check_output}
|
||||
<p class="muted">Prüfung (<code>check.sh</code>):</p>
|
||||
<pre>{detail.run.check_output}</pre>
|
||||
@ -384,13 +414,45 @@
|
||||
line-height: 1;
|
||||
}
|
||||
.meter {
|
||||
position: relative;
|
||||
height: 7px;
|
||||
background: var(--bg);
|
||||
border-radius: 999px;
|
||||
overflow: hidden;
|
||||
margin: 0.25rem 0;
|
||||
}
|
||||
.meter > div {
|
||||
.meter .f {
|
||||
border-radius: 999px;
|
||||
}
|
||||
.tick,
|
||||
.tick-demo {
|
||||
background: var(--text);
|
||||
border-radius: 2px;
|
||||
}
|
||||
.tick {
|
||||
position: absolute;
|
||||
top: -3px;
|
||||
bottom: -3px;
|
||||
width: 3px;
|
||||
margin-left: -1px;
|
||||
}
|
||||
.tick-demo {
|
||||
display: inline-block;
|
||||
width: 3px;
|
||||
height: 0.9rem;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.legend {
|
||||
margin: 0 0 0.8rem;
|
||||
}
|
||||
.mcard.ref {
|
||||
border-style: dashed;
|
||||
}
|
||||
.badge.r5 {
|
||||
background: var(--surface);
|
||||
color: var(--accent);
|
||||
border: 1px dashed var(--accent);
|
||||
}
|
||||
.meter .f {
|
||||
height: 100%;
|
||||
}
|
||||
.n {
|
||||
|
||||
@ -54,6 +54,8 @@ export type RunRow = {
|
||||
tps: number | null;
|
||||
summary: string | null;
|
||||
check_output: string;
|
||||
artifact_path: string | null;
|
||||
external: boolean;
|
||||
};
|
||||
|
||||
export type StepRow = {
|
||||
@ -67,7 +69,9 @@ export type StepRow = {
|
||||
|
||||
export type GroupScore = { group: string; percent: number | null; tasks: number; runs: number };
|
||||
export type ModelRank = {
|
||||
/** 0 bei Referenzen. */
|
||||
rank: number;
|
||||
external: boolean;
|
||||
model: string;
|
||||
total_percent: number;
|
||||
groups: GroupScore[];
|
||||
@ -97,6 +101,9 @@ export type BatchEvent =
|
||||
| { kind: "model_unavailable"; model: string; reason: string }
|
||||
| { kind: "progress"; done: number; total: number };
|
||||
|
||||
export type ExportResult = { dir: string; folders: number };
|
||||
export type ImportSummary = { imported: number; passed: number; skipped: string[] };
|
||||
|
||||
export const api = {
|
||||
paths: () => invoke<Paths>("get_paths"),
|
||||
tasks: () => invoke<LoadReport>("load_tasks"),
|
||||
@ -110,6 +117,9 @@ export const api = {
|
||||
testModel: (name: string) => invoke<ModelTest>("test_model", { name }),
|
||||
startBatch: (models: string[], taskIds: string[], repeats: number, note: string, batchId: number | null = null) =>
|
||||
invoke<BatchSummary>("start_batch", { models, taskIds, repeats, note, batchId }),
|
||||
exportExternal: (taskIds: string[], repeats: number) => invoke<ExportResult>("export_external", { taskIds, repeats }),
|
||||
importExternal: (dir: string, model: string, batchId: number) =>
|
||||
invoke<ImportSummary>("import_external", { dir, model, batchId }),
|
||||
cancelBatch: () => invoke<boolean>("cancel_batch"),
|
||||
batches: () => invoke<BatchInfo[]>("list_batches"),
|
||||
results: (batchId: number) => invoke<RunRow[]>("batch_results", { batchId }),
|
||||
|
||||
@ -2,10 +2,11 @@
|
||||
import { onMount } from "svelte";
|
||||
import { api, type LoadReport, type ModelInfo, type Paths, type RuntimeStatus } from "$lib/api";
|
||||
import BenchPanel from "$lib/BenchPanel.svelte";
|
||||
import ReferencePanel from "$lib/ReferencePanel.svelte";
|
||||
import ResultsPanel from "$lib/ResultsPanel.svelte";
|
||||
import SettingsPanel from "$lib/SettingsPanel.svelte";
|
||||
|
||||
type Tab = "bench" | "results" | "settings";
|
||||
type Tab = "bench" | "results" | "reference" | "settings";
|
||||
let tab = $state<Tab>("bench");
|
||||
|
||||
let loaded = $state(false);
|
||||
@ -35,6 +36,7 @@
|
||||
const tabs: { id: Tab; label: string }[] = [
|
||||
{ id: "bench", label: "Benchmark" },
|
||||
{ id: "results", label: "Ergebnisse" },
|
||||
{ id: "reference", label: "Referenz" },
|
||||
{ id: "settings", label: "Einstellungen" },
|
||||
];
|
||||
</script>
|
||||
@ -74,6 +76,9 @@
|
||||
<div hidden={tab !== "results"}>
|
||||
<ResultsPanel bind:selected={selectedBatch} />
|
||||
</div>
|
||||
<div hidden={tab !== "reference"}>
|
||||
<ReferencePanel {tasks} onimported={showResults} />
|
||||
</div>
|
||||
<div hidden={tab !== "settings"}>
|
||||
<SettingsPanel {models} {paths} {runtime} onsaved={(m) => (models = m)} />
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user