GUI: Aufgabenkarten mit Beschreibung, Plan-und-Stand-Matrix, feste Startleiste mit Zeitschätzung, Hinweis bei wenigen Durchläufen, klickbare Ergebnis-Zellen

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-07 17:54:17 +01:00
parent 0832b8c96f
commit 10b0b1ce8e
6 changed files with 469 additions and 99 deletions

View File

@ -422,6 +422,7 @@ mod tests {
check_timeout_s: 30, check_timeout_s: 30,
}, },
dir: PathBuf::from("/x"), dir: PathBuf::from("/x"),
prompt: String::new(),
} }
} }

View File

@ -45,6 +45,8 @@ pub struct Task {
#[serde(flatten)] #[serde(flatten)]
pub meta: TaskToml, pub meta: TaskToml,
pub dir: PathBuf, pub dir: PathBuf,
/// Inhalt von `prompt.md`, damit die Oberfläche zeigen kann, was die Aufgabe verlangt.
pub prompt: String,
} }
/// Ein Fehler bei einer Aufgabe, mit Ordner und Grund. /// Ein Fehler bei einer Aufgabe, mit Ordner und Grund.
@ -164,6 +166,7 @@ pub fn load_one(dir: &Path) -> Result<Task, Vec<String>> {
(Some(meta), true) => Ok(Task { (Some(meta), true) => Ok(Task {
meta, meta,
dir: dir.to_path_buf(), dir: dir.to_path_buf(),
prompt: fs::read_to_string(dir.join(PROMPT_FILE)).unwrap_or_default(),
}), }),
_ => Err(errs), _ => Err(errs),
} }

View File

@ -157,3 +157,4 @@ th {
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; } td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); } input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
.small { font-size: 0.8rem; }

View File

@ -1,7 +1,19 @@
<script lang="ts"> <script lang="ts">
import { onMount, onDestroy } from "svelte"; import { onMount, onDestroy } from "svelte";
import { listen, type UnlistenFn } from "@tauri-apps/api/event"; import { listen, type UnlistenFn } from "@tauri-apps/api/event";
import { api, errorLabel, groupLabel, type BatchEvent, type LoadReport, type ModelInfo, type TaskInfo } from "$lib/api"; import {
api,
errorLabel,
fmtPct,
groupLabel,
isInfrastructure,
pctColor,
type BatchEvent,
type LoadReport,
type ModelInfo,
type Ranking,
type TaskInfo,
} from "$lib/api";
let { let {
models, models,
@ -25,10 +37,29 @@
let current = $state(""); let current = $state("");
let finishedBatch = $state<number | null>(null); let finishedBatch = $state<number | null>(null);
let cancelled = $state(false); let cancelled = $state(false);
let expanded = $state<string[]>([]);
// Was die letzte Messung ergeben hat: Grundlage für „zuletzt“ und die Zeitschätzung.
let last = $state<Ranking | null>(null);
// Stand je Modell und Aufgabe im aktuellen Lauf.
type Cell = { state: "planned" | "running" | "done" | "skipped" | "infra"; n: number; sum: number; cls: string };
let cells = $state<Record<string, Cell>>({});
const key = (model: string, task: string) => `${model}\u0001${task}`;
let unlisten: UnlistenFn | null = null; let unlisten: UnlistenFn | null = null;
async function loadLast() {
try {
const b = await api.batches();
last = b.length > 0 ? await api.ranking(b[0].id) : null;
} catch {
last = null;
}
}
onMount(async () => { onMount(async () => {
loadLast();
unlisten = await listen<BatchEvent>("batch-event", (ev) => onEvent(ev.payload)); unlisten = await listen<BatchEvent>("batch-event", (ev) => onEvent(ev.payload));
}); });
onDestroy(() => unlisten?.()); onDestroy(() => unlisten?.());
@ -40,13 +71,20 @@
} }
if (e.kind === "model_unavailable") { if (e.kind === "model_unavailable") {
log.push({ text: `${e.model}: nicht erreichbar (${e.reason})`, cls: "error" }); log.push({ text: `${e.model}: nicht erreichbar (${e.reason})`, cls: "error" });
for (const t of chosenTasks) {
const c = cells[key(e.model, t)];
if (c && c.state !== "done") c.state = "infra";
}
return; return;
} }
const label = `${e.model} · ${e.task} · Durchlauf ${e.repeat}`; const label = `${e.model} · ${e.task} · Durchlauf ${e.repeat}`;
const c = cells[key(e.model, e.task)];
if (e.kind === "run_started") { if (e.kind === "run_started") {
current = label; current = label;
if (c) c.state = "running";
} else if (e.kind === "run_skipped") { } else if (e.kind === "run_skipped") {
log.push({ text: `übersprungen: ${label}`, cls: "muted" }); log.push({ text: `übersprungen: ${label}`, cls: "muted" });
if (c && c.state === "planned") c.state = "skipped";
} else if (e.kind === "run_finished") { } else if (e.kind === "run_finished") {
const ok = e.class === "ok"; const ok = e.class === "ok";
log.push({ log.push({
@ -54,6 +92,17 @@
cls: ok ? "ok" : "error", cls: ok ? "ok" : "error",
}); });
current = ""; current = "";
if (c) {
if (isInfrastructure(e.class)) {
c.state = "infra";
c.cls = e.class;
} else {
c.n += 1;
c.sum += e.score;
c.state = c.n >= repeats ? "done" : "planned";
c.cls = e.class;
}
}
} }
} }
@ -73,20 +122,52 @@
function groupAll(group: string, on: boolean) { function groupAll(group: string, on: boolean) {
const ids = (byGroup.find(([g]) => g === group)?.[1] ?? []).map((t) => t.id); const ids = (byGroup.find(([g]) => g === group)?.[1] ?? []).map((t) => t.id);
chosenTasks = on chosenTasks = on ? [...new Set([...chosenTasks, ...ids])] : chosenTasks.filter((id) => !ids.includes(id));
? [...new Set([...chosenTasks, ...ids])] }
: chosenTasks.filter((id) => !ids.includes(id));
function allModels(on: boolean) {
chosenModels = on ? models.map((m) => m.name) : [];
}
function lastTask(id: string): { models: number; mean: number } | null {
const cs = last?.cells.filter((c) => c.task_id === id) ?? [];
if (cs.length === 0) return null;
return { models: cs.length, mean: (100 * cs.reduce((a, c) => a + c.mean_score, 0)) / cs.length };
}
function lastCell(model: string, task: string): number | null {
const c = last?.cells.find((c) => c.model === model && c.task_id === task);
return c ? c.mean_score * 100 : null;
}
function lastRank(model: string) {
return last?.models.find((m) => m.model === model) ?? null;
} }
let totalRuns = $derived(chosenModels.length * chosenTasks.length * repeats); let totalRuns = $derived(chosenModels.length * chosenTasks.length * repeats);
let canStart = $derived(!running && chosenModels.length > 0 && chosenTasks.length > 0 && repeats >= 1); let canStart = $derived(!running && chosenModels.length > 0 && chosenTasks.length > 0 && repeats >= 1);
// Geschätzte Dauer aus den Median-Laufzeiten früherer Läufe. Fehlt ein Modell, zählt der Schnitt der übrigen.
let estimate = $derived.by(() => {
const known = chosenModels.map((m) => lastRank(m)?.median_duration_ms).filter((x): x is number => typeof x === "number" && x > 0);
if (known.length === 0 || totalRuns === 0) return null;
const avg = known.reduce((a, b) => a + b, 0) / known.length;
const ms = chosenModels.reduce((sum, m) => sum + (lastRank(m)?.median_duration_ms || avg) * chosenTasks.length * repeats, 0);
return { minutes: Math.max(1, Math.round(ms / 60000)), basis: known.length, of: chosenModels.length };
});
function chosenTaskInfos(): TaskInfo[] {
return (tasks?.tasks ?? []).filter((t) => chosenTasks.includes(t.id));
}
async function start() { async function start() {
error = ""; error = "";
log = []; log = [];
progress = null; progress = null;
finishedBatch = null; finishedBatch = null;
cancelled = false; cancelled = false;
cells = {};
for (const m of chosenModels) for (const t of chosenTaskInfos()) cells[key(m, t.id)] = { state: "planned", n: 0, sum: 0, cls: "" };
running = true; running = true;
try { try {
const s = await api.startBatch($state.snapshot(chosenModels), $state.snapshot(chosenTasks), repeats, ""); const s = await api.startBatch($state.snapshot(chosenModels), $state.snapshot(chosenTasks), repeats, "");
@ -97,31 +178,54 @@
} finally { } finally {
running = false; running = false;
current = ""; current = "";
loadLast();
} }
} }
function cellOf(model: string, task: string): Cell | undefined {
return cells[key(model, task)];
}
</script> </script>
{#if models.length === 0} {#if models.length === 0}
<section class="card"> <section class="card empty">
<h2>Noch kein Modell angebunden</h2> <h2>Noch kein Modell angebunden</h2>
<p class="muted">Bevor ein Benchmark laufen kann, braucht coding-bench mindestens ein Modell.</p> <p class="muted">Bevor ein Benchmark laufen kann, braucht coding-bench mindestens ein Modell.</p>
<ol class="muted steps">
<li>Modell mit Adapter und Server-URL anlegen</li>
<li>Container-Image bauen (einmalig)</li>
<li>Hier Modelle und Aufgaben wählen und starten</li>
</ol>
<button class="primary" onclick={ongotosettings}>Modell in den Einstellungen anlegen</button> <button class="primary" onclick={ongotosettings}>Modell in den Einstellungen anlegen</button>
</section> </section>
{:else} {:else}
<section class="card"> <section class="card">
<h2>1. Modelle</h2> <div class="head">
<div class="choices"> <h2>1. Modelle</h2>
<button class="link" disabled={running} onclick={() => allModels(true)}>alle</button>
<button class="link" disabled={running} onclick={() => allModels(false)}>keine</button>
</div>
<div class="model-grid">
{#each models as m (m.name)} {#each models as m (m.name)}
<label class="choice"> {@const r = lastRank(m.name)}
<label class="mcard" class:on={chosenModels.includes(m.name)}>
<input <input
type="checkbox" type="checkbox"
checked={chosenModels.includes(m.name)} checked={chosenModels.includes(m.name)}
disabled={running} disabled={running}
onchange={() => (chosenModels = toggle(chosenModels, m.name))} onchange={() => (chosenModels = toggle(chosenModels, m.name))}
/> />
<span> <span class="mtext">
<strong>{m.name}</strong> <strong>{m.name}</strong>
<span class="muted">{m.adapter === "ollama" ? "Ollama" : "OpenAI-kompatibel"} · {m.url}</span> <span class="muted small">{m.adapter === "ollama" ? "Ollama" : "OpenAI-kompatibel"} · {m.url}</span>
{#if r}
<span class="small" style:color={pctColor(r.total_percent)}>zuletzt {fmtPct(r.total_percent)} gesamt</span>
{:else}
<span class="muted small">noch nicht gemessen</span>
{/if}
{#if m.api_key_env && !m.api_key_set}
<span class="error small">Schlüssel-Variable {m.api_key_env} nicht gesetzt</span>
{/if}
</span> </span>
</label> </label>
{/each} {/each}
@ -137,22 +241,43 @@
{/if} {/if}
{#each byGroup as [group, list] (group)} {#each byGroup as [group, list] (group)}
<div class="group"> <div class="group">
<div class="group-head"> <div class="head">
<h3>{group} · {groupLabel(group)} <span class="muted">({list.length})</span></h3> <h3><span class="gbadge">{group}</span> {groupLabel(group)} <span class="muted">({list.length})</span></h3>
<button class="link" disabled={running} onclick={() => groupAll(group, true)}>alle</button> <button class="link" disabled={running} onclick={() => groupAll(group, true)}>alle</button>
<button class="link" disabled={running} onclick={() => groupAll(group, false)}>keine</button> <button class="link" disabled={running} onclick={() => groupAll(group, false)}>keine</button>
</div> </div>
{#each list as t (t.id)} <div class="task-grid">
<label class="choice"> {#each list as t (t.id)}
<input {@const lt = lastTask(t.id)}
type="checkbox" {@const open = expanded.includes(t.id)}
checked={chosenTasks.includes(t.id)} <div class="tcard" class:on={chosenTasks.includes(t.id)}>
disabled={running} <label class="thead">
onchange={() => (chosenTasks = toggle(chosenTasks, t.id))} <input
/> type="checkbox"
<span><strong>{t.id}</strong> {t.title}</span> checked={chosenTasks.includes(t.id)}
</label> disabled={running}
{/each} onchange={() => (chosenTasks = toggle(chosenTasks, t.id))}
/>
<span><strong>{t.title}</strong> <span class="muted small">{t.id}</span></span>
</label>
<p class="desc" class:clamp={!open}>{t.prompt.trim() || "Keine Beschreibung."}</p>
<div class="chips">
<span class="chip" title="Höchstzahl der Agentenschritte">≤ {t.max_steps} Schritte</span>
<span class="chip" title="Zeitlimit je Lauf">{t.timeout_s} s</span>
{#if t.weight !== 1}<span class="chip" title="Gewicht in der Bewertung">Gewicht {t.weight}</span>{/if}
<span class="chip" title="Container-Image">{t.image}</span>
</div>
<div class="tfoot">
{#if lt}
<span class="small" style:color={pctColor(lt.mean)}>zuletzt ∅ {fmtPct(lt.mean)} ({lt.models} Modell{lt.models === 1 ? "" : "e"})</span>
{:else}
<span class="muted small">noch nie gelaufen</span>
{/if}
<button class="link" onclick={() => (expanded = toggle(expanded, t.id))}>{open ? "weniger" : "Aufgabentext"}</button>
</div>
</div>
{/each}
</div>
</div> </div>
{/each} {/each}
{#if tasks && tasks.errors.length > 0} {#if tasks && tasks.errors.length > 0}
@ -167,108 +292,248 @@
{/if} {/if}
</section> </section>
<section class="card"> {#if chosenModels.length > 0 && chosenTasks.length > 0}
<h2>3. Starten</h2> <section class="card">
<div class="start"> <h2>Plan und Stand</h2>
<label> <p class="muted small">
Durchläufe je Aufgabe Jede Zelle ist ein Modell bei einer Aufgabe. Vor dem Start steht dort, was zuletzt gemessen wurde. Beim Lauf füllt sie
<input type="number" min="1" max="20" bind:value={repeats} disabled={running} /> sich live.
</label>
<p class="muted">
{#if totalRuns > 0}{totalRuns} Läufe: {chosenModels.length} Modell(e) × {chosenTasks.length} Aufgabe(n) × {repeats}.{:else}Wähle Modelle und Aufgaben.{/if}
Mehr Durchläufe machen die Prozentwerte verlässlicher.
</p> </p>
<div class="buttons"> <div class="scroll">
<button class="primary" onclick={start} disabled={!canStart}>Benchmark starten</button> <table class="plan">
<button class="danger" onclick={() => api.cancelBatch()} disabled={!running}>Abbrechen</button> <thead>
<tr>
<th>Modell</th>
{#each chosenTaskInfos() as t (t.id)}<th class="num" title={t.title}>{t.id}</th>{/each}
</tr>
</thead>
<tbody>
{#each chosenModels as m (m)}
<tr>
<td>{m}</td>
{#each chosenTaskInfos() as t (t.id)}
{@const c = cellOf(m, t.id)}
{@const lc = lastCell(m, t.id)}
<td class="num cell" class:running={c?.state === "running"}>
{#if c?.state === "done"}
{@const p = (100 * c.sum) / c.n}
<span class="done" style:background={`color-mix(in srgb, ${pctColor(p)} 30%, transparent)`}>{fmtPct(p)}</span>
{:else if c?.state === "running"}
<span class="pulse">läuft …</span>
{:else if c?.state === "infra"}
<span class="error small" title="Server oder Umgebung ausgefallen, nicht gewertet">nicht gewertet</span>
{:else if c?.state === "skipped"}
<span class="muted small">schon vorhanden</span>
{:else if c?.state === "planned"}
<span class="muted small">geplant{c.n > 0 ? ` ${c.n}/${repeats}` : ""}</span>
{:else if lc !== null}
<span class="muted small">zuletzt {fmtPct(lc)}</span>
{:else}
<span class="muted small">neu</span>
{/if}
</td>
{/each}
</tr>
{/each}
</tbody>
</table>
</div> </div>
</div> </section>
{/if}
{#if log.length > 0 || error || finishedBatch !== null}
<section class="card">
<h2>Verlauf</h2>
{#if error}<p class="error">{error}</p>{/if}
{#if finishedBatch !== null}
<p>
{cancelled ? "Abgebrochen." : "Fertig."}
<button class="link" onclick={() => onfinished(finishedBatch!)}>Ergebnisse ansehen</button>
</p>
{/if}
{#if log.length > 0}
<ul class="log">
{#each log as l, i (i)}
<li class={l.cls}>{l.text}</li>
{/each}
</ul>
{/if}
</section>
{/if}
<div class="startbar">
<div class="summary">
{#if totalRuns > 0}
<strong>{totalRuns} Läufe</strong>
<span class="muted">{chosenModels.length} Modell(e) × {chosenTasks.length} Aufgabe(n) × {repeats}</span>
{#if estimate}
<span class="muted" title="Median-Laufzeit früherer Läufe, {estimate.basis} von {estimate.of} Modellen gemessen">
≈ {estimate.minutes} min
</span>
{:else}
<span class="muted">Dauer unbekannt, noch keine Messung</span>
{/if}
{:else}
<span class="muted">Wähle Modelle und Aufgaben.</span>
{/if}
{#if repeats < 3 && totalRuns > 0}
<span class="warn small">Bei weniger als 3 Durchläufen können Unterschiede zwischen Modellen Zufall sein.</span>
{/if}
</div>
<label class="rep">
Durchläufe
<input type="number" min="1" max="20" bind:value={repeats} disabled={running} />
</label>
<button class="primary" onclick={start} disabled={!canStart}>Benchmark starten</button>
<button class="danger" onclick={() => api.cancelBatch()} disabled={!running}>Abbrechen</button>
{#if progress} {#if progress}
<div class="bar" role="progressbar" aria-valuenow={progress.done} aria-valuemax={progress.total}> <div class="progress">
<div class="fill" style:width="{progress.total ? (100 * progress.done) / progress.total : 0}%"></div> <div class="bar" role="progressbar" aria-valuenow={progress.done} aria-valuemax={progress.total}>
<div class="fill" style:width="{progress.total ? (100 * progress.done) / progress.total : 0}%"></div>
</div>
<span class="small muted">{progress.done} von {progress.total}{current ? ` · läuft: ${current}` : ""}</span>
</div> </div>
<p class="muted">{progress.done} von {progress.total} Läufen fertig</p>
{/if} {/if}
{#if current}<p>Läuft: <strong>{current}</strong></p>{/if} </div>
{#if error}<p class="error">{error}</p>{/if}
{#if finishedBatch !== null}
<p>
{cancelled ? "Abgebrochen." : "Fertig."}
<button class="link" onclick={() => onfinished(finishedBatch!)}>Ergebnisse ansehen</button>
</p>
{/if}
{#if log.length > 0}
<ul class="log">
{#each log as l, i (i)}
<li class={l.cls}>{l.text}</li>
{/each}
</ul>
{/if}
</section>
{/if} {/if}
<style> <style>
.choices { .head {
display: grid;
gap: 0.4rem;
}
.choice {
display: flex;
align-items: baseline;
gap: 0.6rem;
padding: 0.25rem 0;
}
.choice .muted {
margin-left: 0.5rem;
font-size: 0.85rem;
}
.group {
margin-bottom: 0.9rem;
}
.group-head {
display: flex; display: flex;
align-items: baseline; align-items: baseline;
gap: 0.8rem; gap: 0.8rem;
margin-bottom: 0.6rem;
} }
.group-head h3 { .head h2,
.head h3 {
flex: 1; flex: 1;
margin: 0; margin: 0;
} }
.start label { .small {
font-size: 0.8rem;
}
.warn {
color: var(--accent);
}
.empty .steps {
padding-left: 1.2rem;
}
.model-grid,
.task-grid {
display: grid;
gap: 0.7rem;
}
.model-grid {
grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
}
.task-grid {
grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
}
.mcard,
.tcard {
border: 1px solid var(--border);
border-radius: 12px;
background: var(--surface-2);
padding: 0.75rem 0.9rem;
transition: border-color 0.12s, background 0.12s;
}
.mcard {
display: flex;
gap: 0.7rem;
align-items: flex-start;
cursor: pointer;
}
.mcard.on,
.tcard.on {
border-color: var(--accent);
background: color-mix(in srgb, var(--accent) 8%, var(--surface-2));
}
.mtext {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 0.2rem; gap: 0.1rem;
width: 12rem; min-width: 0;
font-size: 0.85rem; overflow-wrap: anywhere;
color: var(--muted);
} }
.start input { .group {
color: var(--text); margin-bottom: 1.1rem;
font-size: 1rem;
} }
.buttons { .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;
}
.thead input,
.mcard input {
flex-shrink: 0;
}
.thead .small {
white-space: nowrap;
}
.thead {
display: flex; display: flex;
gap: 0.6rem; gap: 0.6rem;
margin-top: 0.6rem; align-items: baseline;
cursor: pointer;
} }
.bar { .desc {
height: 10px; margin: 0.5rem 0;
background: var(--surface-2); font-size: 0.88rem;
border-radius: 999px; color: var(--muted);
white-space: pre-wrap;
overflow-wrap: anywhere;
}
.desc.clamp {
display: -webkit-box;
-webkit-line-clamp: 3;
line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden; overflow: hidden;
margin-top: 1rem;
} }
.fill { .chips {
height: 100%; display: flex;
background: var(--accent); flex-wrap: wrap;
transition: width 0.3s; gap: 0.35rem;
}
.tfoot {
display: flex;
justify-content: space-between;
align-items: baseline;
margin-top: 0.5rem;
}
.scroll {
overflow-x: auto;
}
.plan .cell {
white-space: nowrap;
}
.done {
display: inline-block;
padding: 0.05rem 0.5rem;
border-radius: 6px;
font-weight: 600;
}
.pulse {
color: var(--accent);
animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse {
50% {
opacity: 0.35;
}
} }
.log { .log {
list-style: none; list-style: none;
padding: 0.6rem; padding: 0.6rem;
margin: 0.8rem 0 0; margin: 0.8rem 0 0;
max-height: 18rem; max-height: 14rem;
overflow-y: auto; overflow-y: auto;
background: var(--bg); background: var(--bg);
border: 1px solid var(--border); border: 1px solid var(--border);
@ -276,4 +541,56 @@
font-family: ui-monospace, Menlo, monospace; font-family: ui-monospace, Menlo, monospace;
font-size: 0.85rem; font-size: 0.85rem;
} }
.startbar {
position: sticky;
bottom: 0.8rem;
z-index: 4;
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 0.7rem 1rem;
padding: 0.8rem 1.1rem;
background: color-mix(in srgb, var(--surface) 90%, transparent);
backdrop-filter: blur(10px);
border: 1px solid var(--border);
border-radius: var(--radius);
box-shadow: var(--shadow);
}
.summary {
flex: 1;
min-width: 14rem;
display: flex;
flex-wrap: wrap;
gap: 0.1rem 0.8rem;
align-items: baseline;
}
.summary .warn {
flex-basis: 100%;
}
.rep {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: 0.85rem;
color: var(--muted);
}
.rep input {
width: 4.2rem;
color: var(--text);
}
.progress {
flex-basis: 100%;
}
.bar {
height: 8px;
background: var(--bg);
border-radius: 999px;
overflow: hidden;
margin-bottom: 0.25rem;
}
.fill {
height: 100%;
background: var(--accent);
transition: width 0.3s;
}
</style> </style>

View File

@ -66,6 +66,20 @@
detail = { run, steps: await api.steps(selected, run) }; detail = { run, steps: await api.steps(selected, run) };
} }
// 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);
async function openCell(model: string, task: string) {
const r = rows.find((x) => x.model === model && x.task_id === task);
if (!r) return;
try {
await showSteps(r);
setTimeout(() => document.getElementById("run-detail")?.scrollIntoView({ behavior: "smooth", block: "start" }), 50);
} catch (e) {
error = String(e);
}
}
function cell(model: string, task: string) { function cell(model: string, task: string) {
return ranking?.cells.find((c) => c.model === model && c.task_id === task); return ranking?.cells.find((c) => c.model === model && c.task_id === task);
} }
@ -145,6 +159,13 @@
{/each} {/each}
</div> </div>
{#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
zwischen Modellen Zufall sein, und die Rangfolge ist nur ein Hinweis. Für belastbare Werte mindestens 3 Durchläufe wählen.
</p>
{/if}
{#if ranking.excluded_runs > 0} {#if ranking.excluded_runs > 0}
<p class="muted"> <p class="muted">
{ranking.excluded_runs} Lauf/Läufe sind nicht gewertet, weil der Modell-Server oder die Umgebung ausfiel. Sie {ranking.excluded_runs} Lauf/Läufe sind nicht gewertet, weil der Modell-Server oder die Umgebung ausfiel. Sie
@ -172,7 +193,7 @@
</ul> </ul>
</details> </details>
<h3>Aufgaben im Detail</h3> <h3>Aufgaben im Detail <span class="muted small">Zelle anklicken öffnet den Lauf</span></h3>
<div class="scroll"> <div class="scroll">
<table class="matrix"> <table class="matrix">
<thead> <thead>
@ -190,7 +211,8 @@
{#each ranking.tasks as t (t.id)} {#each ranking.tasks as t (t.id)}
{@const c = cell(m.model, t.id)} {@const c = cell(m.model, t.id)}
<td <td
class="num" class="num clickable"
onclick={() => openCell(m.model, t.id)}
style:background={c ? `color-mix(in srgb, ${pctColor(c.mean_score * 100)} 28%, transparent)` : ""} style:background={c ? `color-mix(in srgb, ${pctColor(c.mean_score * 100)} 28%, transparent)` : ""}
title={c ? `${Math.round(c.mean_score * 100)} %, ${c.successes} von ${c.runs} bestanden` : "keine Läufe"} title={c ? `${Math.round(c.mean_score * 100)} %, ${c.successes} von ${c.runs} bestanden` : "keine Läufe"}
> >
@ -244,7 +266,7 @@
{/if} {/if}
{#if detail} {#if detail}
<div class="detail"> <div class="detail" id="run-detail">
<h3> <h3>
Schritte: {detail.run.model} · {detail.run.task_id} · Durchlauf {detail.run.repeat_idx} Schritte: {detail.run.model} · {detail.run.task_id} · Durchlauf {detail.run.repeat_idx}
<button class="link" onclick={() => (detail = null)}>schließen</button> <button class="link" onclick={() => (detail = null)}>schließen</button>
@ -378,6 +400,21 @@
.n.few { .n.few {
color: var(--danger); color: var(--danger);
} }
.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 0 1rem;
font-size: 0.9rem;
}
td.clickable {
cursor: pointer;
}
td.clickable:hover {
outline: 2px solid var(--accent);
outline-offset: -2px;
}
.how { .how {
margin: 0.5rem 0 1.2rem; margin: 0.5rem 0 1.2rem;
color: var(--muted); color: var(--muted);

View File

@ -2,7 +2,18 @@ import { invoke } from "@tauri-apps/api/core";
export type Paths = { config_file: string; data_dir: string; tasks_dir: string }; export type Paths = { config_file: string; data_dir: string; tasks_dir: string };
export type TaskInfo = { id: string; title: string; group: string; dir: string; weight: number }; export type TaskInfo = {
id: string;
title: string;
group: string;
dir: string;
weight: number;
image: string;
max_steps: number;
timeout_s: number;
check_timeout_s: number;
prompt: string;
};
export type TaskError = { dir: string; message: string }; export type TaskError = { dir: string; message: string };
export type LoadReport = { tasks: TaskInfo[]; errors: TaskError[] }; export type LoadReport = { tasks: TaskInfo[]; errors: TaskError[] };