Ergebnisse: Token-Verbrauch je Modell und Batch, Fehlergrund je Lauf, Ergebnisdateien mit Vorschau und Ordner öffnen
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@ -113,3 +113,15 @@ für einen Block aufweichen; das steht dann im Todo.
|
||||
| provider2modell.1 | Reiter „Benchmark“, bei „1. Anbieter“ einen Anbieter anhaken | Unter „2. Modelle“ erscheint die Modell-Liste des Anbieters mit Filterfeld | manuell |
|
||||
| provider2modell.2 | Im Filter einen Teil eines Modellnamens eingeben, zwei Modelle anhaken | Die Liste wird gefiltert, gewählte Modelle stehen oben, unten steht „Gewählt: …“ mit Anbieter | manuell |
|
||||
| provider2modell.3 | App schließen und neu starten | Anbieter, Modelle, Aufgaben und Durchläufe sind wie zuletzt gewählt | manuell |
|
||||
|
||||
## lauf2dateien
|
||||
**Zweck:** Man sieht, wie viele Tokens ein Lauf gebraucht hat, warum er nicht bestanden hat und was das Modell erzeugt hat.
|
||||
**Deckt ab:** #1009
|
||||
**Voraussetzung:** Ein Batch mit mindestens einem nicht voll bestandenen Lauf.
|
||||
|
||||
| Test | Schritte | Erwartet | Art |
|
||||
| --- | --- | --- | --- |
|
||||
| lauf2dateien.1 | Reiter „Ergebnisse“, Karte und Zeile „Verbrauch in diesem Batch“ ansehen | Tokens je Modell (Σ) und im Batch gesamt, gesendet und erzeugt getrennt | manuell |
|
||||
| lauf2dateien.2 | Bei einem nicht bestandenen Lauf „Schritte“ klicken | Kasten „Warum nicht voll bestanden?“ mit Grund aus der Prüfung | manuell |
|
||||
| lauf2dateien.3 | Im selben Detail bei „Ergebnisdateien“ eine Datei aufklappen, „im Dateimanager öffnen“ klicken | Inhalt der Datei wird angezeigt, der Ordner mit den Ergebnissen öffnet sich | manuell |
|
||||
|
||||
|
||||
@ -53,7 +53,7 @@ Zeichen: ✓ fertig · ◐ teilweise · ✗ offen · ? nicht geprüft.
|
||||
- [#1023] **SQLite-Speicher.** Umgesetzt in `src-tauri/src/store.rs`, Schema nach SPEC 8. Datei-Datenbank im Datenordner angebunden. Offen: Klicktest `lauf2ergebnis.2` mit Schritt-Ansicht (noch keine Oberfläche dafür). Tests `lauf2ergebnis.2`. → #1006
|
||||
- [#1024] **Aufgaben a-01 bis a-03, b-04 bis b-06 schreiben.** Geschrieben unter `tasks/`. b-06 mit Mutationstest; ein Fehler im Check (veralteter Bytecode bei Mutanten) ist behoben. Ergebnis: mit `qwen3.8-flash-next-q2_0` über strata 6 von 6 bestanden. Bericht in `testberichte/`. Offen: Zeitlimit von b-04 bei langsamen Modellen prüfen. → #1007
|
||||
- [#1025] **GUI Setup und Batch.** Zweimal neu gebaut (nach deiner Kritik und nach der Agenten-Prüfung): dunkles Theme mit orangem Akzent, Logo und Icons, Start auf „Benchmark“. Benchmark-Tab mit Modell- und Aufgabenkarten (Beschreibung, Limits, „zuletzt“), Matrix „Plan und Stand“ (live), fester Startleiste mit Zeitschätzung, Hinweis bei weniger als 3 Durchläufen und Fortsetzen. Einstellungen mit Bereitschafts-Ampel, einklappbaren Modellkarten, Server-Prüfung und Modell-Liste vom Server (`discover.rs`). Geprüft nur als Screenshot im Headless-Browser mit Beispieldaten und mit Unit-Tests (67 grün), nicht in der echten App. Offen: echte App im Fenster prüfen, Klicktests `batch2fortsetzen.1`, `lauf2ergebnis.2`, `aufgaben2plan.1–.2` und `einstellungen2bereitschaft.1–.2` manuell, laufender Schritt live anzeigen, Gewichte in der Oberfläche ändern (SPEC 9). → #1008
|
||||
- [#1026] **Rangliste und Matrix.** Gebaut (jetzt als Rangkarten mit Medaillen, Tok/s als Median, klickbare Matrix-Zellen): Prozent je Bereich und Gesamtnote (Entscheidung #1040), Schwächster Bereich, Matrix, Hinweis „grob“ bei weniger als 3 Aufgaben je Bereich, Erklärung „So wird bewertet“. Offen: Wilson-Intervall und „nicht unterscheidbar“ (F-12, Phase 2), Klicktest `ergebnis2detail.1` manuell. Tests `ergebnis2detail.1`. → #1009
|
||||
- [#1026] **Rangliste und Matrix.** Gebaut (jetzt als Rangkarten mit Medaillen, Tok/s als Median, klickbare Matrix-Zellen): Prozent je Bereich und Gesamtnote (Entscheidung #1040), Schwächster Bereich, Matrix, Hinweis „grob“ bei weniger als 3 Aufgaben je Bereich, Erklärung „So wird bewertet“. Offen: Wilson-Intervall und „nicht unterscheidbar“ (F-12, Phase 2), Klicktest `ergebnis2detail.1` manuell. Tests `ergebnis2detail.1`. → #1009 Ergänzt am 09.11.2026 nach dem ersten echten Lauf des Nutzers: Verbrauch an Tokens je Modell und je Batch, Spalte Tokens und Fehlergrund je Lauf („Warum nicht voll bestanden?“ aus der Prüfung), Ergebnisdateien des Modells im Lauf-Detail mit Vorschau und „im Dateimanager öffnen“ (`artifacts.rs`).
|
||||
|
||||
**P1b – Release 0.1.1, Referenz**
|
||||
- [#1053] **Externe Referenz-Läufe.** Aufgaben als Ordner exportieren (Startdateien plus `AUFGABE.md`, ohne `check.sh`), von Hand mit Claude Code oder ähnlichem lösen lassen, den Ordner zurückgeben; die App lässt `check.sh` im Container laufen und speichert den Lauf als „extern“. Ergebnisse erscheinen als Referenz mit Strich je Bereich. Tests `referenz2ranking.1–.3`. → #1052 Stand: gebaut und mit Podman geprüft, Klicktests offen. Offen: Dateidialog statt Pfad eintippen, Dauer und Tokens optional eintragen.
|
||||
|
||||
153
src-tauri/src/artifacts.rs
Normal file
153
src-tauri/src/artifacts.rs
Normal file
@ -0,0 +1,153 @@
|
||||
//! Ergebnisdateien eines Laufs anzeigen: die Dateien, die ein Modell in `/work` hinterlassen hat.
|
||||
//! Sie liegen nach dem Lauf unter `<datenordner>/runs/<batch>/<lauf>/work` und werden nur gelesen.
|
||||
|
||||
use serde::Serialize;
|
||||
use std::fs;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
const MAX_FILES: usize = 200;
|
||||
const MAX_DEPTH: usize = 8;
|
||||
/// Größte Textmenge je Datei, die an die Oberfläche geht.
|
||||
const MAX_TEXT_BYTES: usize = 64 * 1024;
|
||||
/// Namen, die kein Ergebnis des Modells sind.
|
||||
const SKIP_NAMES: [&str; 4] = ["__pycache__", ".pytest_cache", ".git", "node_modules"];
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Serialize)]
|
||||
pub struct FileEntry {
|
||||
/// Pfad relativ zum Ergebnisordner.
|
||||
pub path: String,
|
||||
pub size: u64,
|
||||
/// Inhalt, wenn es Text ist. `None` bei Binärdateien.
|
||||
pub text: Option<String>,
|
||||
/// Der Text wurde gekürzt.
|
||||
pub truncated: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Serialize)]
|
||||
pub struct FilesReport {
|
||||
/// Ordner mit den Ergebnissen (zum Öffnen im Dateimanager).
|
||||
pub dir: String,
|
||||
pub files: Vec<FileEntry>,
|
||||
/// Es gab mehr Dateien als angezeigt werden.
|
||||
pub more: bool,
|
||||
}
|
||||
|
||||
/// Liest die Dateien eines Ergebnisordners. Ist `allowed_base` gesetzt, muss der Ordner darunter liegen.
|
||||
pub fn list_files(dir: &Path, allowed_base: Option<&Path>) -> Result<FilesReport, String> {
|
||||
let real = dir.canonicalize().map_err(|_| format!("Ergebnisordner {} existiert nicht (mehr).", dir.display()))?;
|
||||
if let Some(base) = allowed_base {
|
||||
let base = base.canonicalize().map_err(|e| format!("Basisordner nicht lesbar: {e}"))?;
|
||||
if !real.starts_with(&base) {
|
||||
return Err("Der Ergebnisordner liegt außerhalb des Datenordners.".into());
|
||||
}
|
||||
}
|
||||
let mut files = Vec::new();
|
||||
let mut more = false;
|
||||
walk(&real, &real, 0, &mut files, &mut more);
|
||||
files.sort_by(|a: &FileEntry, b| a.path.cmp(&b.path));
|
||||
Ok(FilesReport { dir: real.display().to_string(), files, more })
|
||||
}
|
||||
|
||||
fn walk(root: &Path, dir: &Path, depth: usize, out: &mut Vec<FileEntry>, more: &mut bool) {
|
||||
if depth > MAX_DEPTH {
|
||||
return;
|
||||
}
|
||||
let Ok(rd) = fs::read_dir(dir) else { return };
|
||||
let mut entries: Vec<PathBuf> = rd.flatten().map(|e| e.path()).collect();
|
||||
entries.sort();
|
||||
for path in entries {
|
||||
let name = path.file_name().and_then(|n| n.to_str()).unwrap_or("");
|
||||
if SKIP_NAMES.contains(&name) {
|
||||
continue;
|
||||
}
|
||||
let Ok(meta) = fs::symlink_metadata(&path) else { continue };
|
||||
if meta.file_type().is_symlink() {
|
||||
continue;
|
||||
}
|
||||
if meta.is_dir() {
|
||||
walk(root, &path, depth + 1, out, more);
|
||||
} else if meta.is_file() {
|
||||
if out.len() >= MAX_FILES {
|
||||
*more = true;
|
||||
return;
|
||||
}
|
||||
out.push(read_entry(root, &path, meta.len()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn read_entry(root: &Path, path: &Path, size: u64) -> FileEntry {
|
||||
let rel = path.strip_prefix(root).unwrap_or(path).display().to_string();
|
||||
let mut text = None;
|
||||
let mut truncated = false;
|
||||
if let Ok(bytes) = fs::read(path) {
|
||||
let cut = bytes.len().min(MAX_TEXT_BYTES);
|
||||
truncated = bytes.len() > cut;
|
||||
let head = &bytes[..cut];
|
||||
if !head.contains(&0) {
|
||||
// Eine abgeschnittene Mehrbyte-Zeichenfolge am Ende ist kein Binärfund.
|
||||
text = match std::str::from_utf8(head) {
|
||||
Ok(t) => Some(t.to_string()),
|
||||
Err(e) if truncated && e.valid_up_to() + 4 > head.len() => Some(String::from_utf8_lossy(&head[..e.valid_up_to()]).to_string()),
|
||||
Err(_) => None,
|
||||
};
|
||||
}
|
||||
}
|
||||
FileEntry { path: rel, size, text, truncated }
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
fn scratch(tag: &str) -> PathBuf {
|
||||
let d = std::env::temp_dir().join(format!("cb-art-{tag}-{}", std::process::id()));
|
||||
let _ = fs::remove_dir_all(&d);
|
||||
fs::create_dir_all(&d).unwrap();
|
||||
d
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn dateien_werden_mit_text_gelistet_und_unwichtiges_ausgelassen() {
|
||||
let d = scratch("liste");
|
||||
fs::write(d.join("ergebnis.txt"), "4711\n").unwrap();
|
||||
fs::create_dir_all(d.join("sub")).unwrap();
|
||||
fs::write(d.join("sub/code.py"), "print(1)").unwrap();
|
||||
fs::create_dir_all(d.join("__pycache__")).unwrap();
|
||||
fs::write(d.join("__pycache__/x.pyc"), "x").unwrap();
|
||||
fs::write(d.join("bild.bin"), [0u8, 159, 146, 150]).unwrap();
|
||||
#[cfg(unix)]
|
||||
std::os::unix::fs::symlink("/etc/passwd", d.join("link")).unwrap();
|
||||
|
||||
let r = list_files(&d, None).unwrap();
|
||||
let names: Vec<&str> = r.files.iter().map(|f| f.path.as_str()).collect();
|
||||
assert_eq!(names, vec!["bild.bin", "ergebnis.txt", "sub/code.py"]);
|
||||
assert_eq!(r.files[1].text.as_deref(), Some("4711\n"));
|
||||
assert!(r.files[0].text.is_none(), "Binärdatei ohne Text");
|
||||
assert!(!r.more);
|
||||
let _ = fs::remove_dir_all(&d);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn grosse_datei_wird_gekuerzt() {
|
||||
let d = scratch("gross");
|
||||
fs::write(d.join("gross.txt"), "a".repeat(MAX_TEXT_BYTES + 100)).unwrap();
|
||||
let r = list_files(&d, None).unwrap();
|
||||
assert!(r.files[0].truncated);
|
||||
assert_eq!(r.files[0].text.as_ref().unwrap().len(), MAX_TEXT_BYTES);
|
||||
let _ = fs::remove_dir_all(&d);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ordner_ausserhalb_der_basis_wird_abgelehnt() {
|
||||
let base = scratch("basis");
|
||||
let inside = base.join("runs/1/x/work");
|
||||
fs::create_dir_all(&inside).unwrap();
|
||||
let outside = scratch("draussen");
|
||||
assert!(list_files(&inside, Some(&base)).is_ok());
|
||||
assert!(list_files(&outside, Some(&base)).is_err());
|
||||
assert!(list_files(&base.join("fehlt"), Some(&base)).is_err());
|
||||
let _ = fs::remove_dir_all(&base);
|
||||
let _ = fs::remove_dir_all(&outside);
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,5 @@
|
||||
mod agent;
|
||||
mod artifacts;
|
||||
mod config;
|
||||
mod discover;
|
||||
mod external;
|
||||
@ -515,6 +516,27 @@ fn run_steps(
|
||||
store.steps_for_run(batch_id, &model, &task_id, repeat_idx)
|
||||
}
|
||||
|
||||
/// Die Dateien, die ein Lauf in `/work` hinterlassen hat, zum Ansehen. Bei Läufen der App nur unterhalb
|
||||
/// des Datenordners, bei Importen (extern) der Ordner, den man selbst angegeben hat.
|
||||
#[tauri::command]
|
||||
fn run_files(
|
||||
paths: State<'_, AppPaths>,
|
||||
batch_id: i64,
|
||||
model: String,
|
||||
task_id: String,
|
||||
repeat_idx: u32,
|
||||
) -> Result<artifacts::FilesReport, String> {
|
||||
let store = Store::open(&paths.0.data_dir.join(DB_FILE))?;
|
||||
let run = store
|
||||
.runs_for_batch(batch_id)?
|
||||
.into_iter()
|
||||
.find(|r| r.model == model && r.task_id == task_id && r.repeat_idx == repeat_idx)
|
||||
.ok_or("Lauf nicht gefunden.")?;
|
||||
let dir = run.artifact_path.ok_or("Für diesen Lauf wurden keine Dateien gesichert.")?;
|
||||
let base = paths.0.data_dir.join("runs");
|
||||
artifacts::list_files(std::path::Path::new(&dir), if run.external { None } else { Some(base.as_path()) })
|
||||
}
|
||||
|
||||
/// Zustand der Container-Laufzeit (Podman) für das Setup.
|
||||
#[derive(Serialize)]
|
||||
pub struct RuntimeStatus {
|
||||
@ -610,6 +632,7 @@ pub fn run() {
|
||||
batch_results,
|
||||
batch_ranking,
|
||||
run_steps,
|
||||
run_files,
|
||||
runtime_status,
|
||||
image_status,
|
||||
build_image
|
||||
|
||||
@ -49,6 +49,9 @@ pub struct ModelRank {
|
||||
pub successes: usize,
|
||||
pub median_duration_ms: u128,
|
||||
pub mean_completion_tokens: f64,
|
||||
/// Summe der Prompt- und Ausgabe-Tokens aller gewerteten Läufe. Bei Referenzen (extern) 0.
|
||||
pub prompt_tokens_total: u64,
|
||||
pub completion_tokens_total: u64,
|
||||
/// Median der Tokens pro Sekunde über die Läufe (Tokens geteilt durch die gesamte Laufzeit,
|
||||
/// also inklusive Tool- und Prüfzeit, nicht die reine Erzeugungsgeschwindigkeit).
|
||||
pub median_tps: Option<f64>,
|
||||
@ -204,6 +207,8 @@ pub fn compute(batch_id: i64, all_runs: &[RunRecord], tasks: &BTreeMap<String, T
|
||||
successes: rs.iter().filter(|r| r.error_class == ErrorClass::Ok).count(),
|
||||
median_duration_ms: median_u128(&durations),
|
||||
mean_completion_tokens: mean_tokens,
|
||||
prompt_tokens_total: rs.iter().map(|r| r.prompt_tokens as u64).sum(),
|
||||
completion_tokens_total: rs.iter().map(|r| r.completion_tokens as u64).sum(),
|
||||
median_tps,
|
||||
}
|
||||
})
|
||||
|
||||
@ -1,16 +1,20 @@
|
||||
<script lang="ts">
|
||||
import { onMount, untrack } from "svelte";
|
||||
import { revealItemInDir } from "@tauri-apps/plugin-opener";
|
||||
import {
|
||||
api,
|
||||
errorLabel,
|
||||
fmtDuration,
|
||||
fmtPct,
|
||||
fmtTps,
|
||||
fmtTokens,
|
||||
failureReason,
|
||||
isInfrastructure,
|
||||
groupLabel,
|
||||
pctColor,
|
||||
type BatchInfo,
|
||||
type Ranking,
|
||||
type FilesReport,
|
||||
type RunRow,
|
||||
type StepRow,
|
||||
} from "$lib/api";
|
||||
@ -22,7 +26,7 @@
|
||||
let rows = $state<RunRow[]>([]);
|
||||
let error = $state("");
|
||||
let loading = $state(false);
|
||||
let detail = $state<{ run: RunRow; steps: StepRow[] } | null>(null);
|
||||
let detail = $state<{ run: RunRow; steps: StepRow[]; files: FilesReport | null; filesError: string } | null>(null);
|
||||
let showRuns = $state(false);
|
||||
|
||||
async function loadBatches() {
|
||||
@ -43,6 +47,7 @@
|
||||
error = "";
|
||||
try {
|
||||
[ranking, rows] = await Promise.all([api.ranking(id), api.results(id)]);
|
||||
showRuns = rows.length <= 40;
|
||||
} catch (e) {
|
||||
error = String(e);
|
||||
} finally {
|
||||
@ -63,9 +68,31 @@
|
||||
|
||||
async function showSteps(run: RunRow) {
|
||||
if (selected === null) return;
|
||||
detail = { run, steps: await api.steps(selected, run) };
|
||||
const steps = await api.steps(selected, run);
|
||||
detail = { run, steps, files: null, filesError: "" };
|
||||
// Die Ergebnisdateien kommen getrennt: Fehlen sie, soll die Schrittliste trotzdem erscheinen.
|
||||
try {
|
||||
const files = await api.files(selected, run);
|
||||
if (detail && detail.run === run) detail.files = files;
|
||||
} catch (e) {
|
||||
if (detail && detail.run === run) detail.filesError = String(e);
|
||||
}
|
||||
}
|
||||
|
||||
async function reveal(path: string) {
|
||||
try {
|
||||
await revealItemInDir(path);
|
||||
} catch {
|
||||
// Ohne Dateimanager bleibt der Pfad als Text sichtbar.
|
||||
}
|
||||
}
|
||||
|
||||
// Verbrauch im ganzen Batch (alle gespeicherten Läufe, auch nicht gewertete).
|
||||
let batchTokens = $derived({
|
||||
prompt: rows.reduce((a, r) => a + r.prompt_tokens, 0),
|
||||
completion: rows.reduce((a, r) => a + r.completion_tokens, 0),
|
||||
});
|
||||
|
||||
// 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)] : [],
|
||||
@ -136,7 +163,7 @@
|
||||
{#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>
|
||||
<span title="Verbrauch in diesem Batch: {fmtTokens(m.prompt_tokens_total)} Prompt-Tokens (gesendet) und {fmtTokens(m.completion_tokens_total)} Ausgabe-Tokens (erzeugt). Durchschnittlich {Math.round(m.mean_completion_tokens)} Ausgabe-Tokens je Lauf.">Σ {fmtTokens(m.prompt_tokens_total + m.completion_tokens_total)} Tokens</span>
|
||||
{:else}
|
||||
<span>Zeit und Tokens nicht gemessen</span>
|
||||
{/if}
|
||||
@ -180,6 +207,14 @@
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
{#if batchTokens.prompt + batchTokens.completion > 0}
|
||||
<p class="muted small legend">
|
||||
Verbrauch in diesem Batch: <strong>{fmtTokens(batchTokens.prompt + batchTokens.completion)} Tokens</strong>
|
||||
({fmtTokens(batchTokens.prompt)} gesendet, {fmtTokens(batchTokens.completion)} erzeugt). Bei Anbietern mit Kontingent
|
||||
(z. B. Ollama Cloud) zählt das gegen dein Limit.
|
||||
</p>
|
||||
{/if}
|
||||
|
||||
{#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).
|
||||
@ -267,6 +302,7 @@
|
||||
<th>Ergebnis</th>
|
||||
<th class="num">Score</th>
|
||||
<th class="num">Schritte</th>
|
||||
<th class="num">Tokens</th>
|
||||
<th class="num">Dauer</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
@ -280,9 +316,11 @@
|
||||
<td class={r.error_class === "ok" ? "ok" : isInfrastructure(r.error_class) ? "muted" : "error"}>
|
||||
{errorLabel(r.error_class)}
|
||||
{#if isInfrastructure(r.error_class)}<span class="chip" title="Zählt nicht in die Bewertung">nicht gewertet</span>{/if}
|
||||
{#if r.error_class !== "ok"}<div class="reason small">{failureReason(r)}</div>{/if}
|
||||
</td>
|
||||
<td class="num">{Math.round(r.score * 100)} %</td>
|
||||
<td class="num">{r.steps}</td>
|
||||
<td class="num" title="{r.prompt_tokens} gesendet, {r.completion_tokens} erzeugt">{r.external ? "–" : fmtTokens(r.prompt_tokens + r.completion_tokens)}</td>
|
||||
<td class="num">{fmtDuration(r.duration_ms)}</td>
|
||||
<td><button onclick={() => showSteps(r)}>Schritte</button></td>
|
||||
</tr>
|
||||
@ -301,10 +339,53 @@
|
||||
{#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.error_class !== "ok"}
|
||||
<div class="why">
|
||||
<strong>Warum nicht voll bestanden?</strong>
|
||||
{failureReason(detail.run)}
|
||||
<span class="muted small">({errorLabel(detail.run.error_class)}, Score {Math.round(detail.run.score * 100)} %)</span>
|
||||
</div>
|
||||
{/if}
|
||||
{#if detail.run.summary}
|
||||
<p class="muted">Antwort des Modells am Ende:</p>
|
||||
<pre>{detail.run.summary}</pre>
|
||||
{/if}
|
||||
<p class="muted small">
|
||||
Verbrauch: {fmtTokens(detail.run.prompt_tokens)} Tokens gesendet, {fmtTokens(detail.run.completion_tokens)} erzeugt,
|
||||
{detail.run.steps} Schritte, {fmtDuration(detail.run.duration_ms)}.
|
||||
</p>
|
||||
|
||||
<h4>Ergebnisdateien</h4>
|
||||
{#if detail.filesError}
|
||||
<p class="muted small">{detail.filesError}</p>
|
||||
{:else if !detail.files}
|
||||
<p class="muted small">Lade …</p>
|
||||
{:else}
|
||||
<p class="small">
|
||||
<code>{detail.files.dir}</code>
|
||||
<button class="link" onclick={() => reveal(detail!.files!.dir)}>im Dateimanager öffnen</button>
|
||||
</p>
|
||||
{#if detail.files.files.length === 0}
|
||||
<p class="muted small">Das Modell hat keine Dateien hinterlassen.</p>
|
||||
{/if}
|
||||
{#each detail.files.files as f (f.path)}
|
||||
<details class="file">
|
||||
<summary><code>{f.path}</code> <span class="muted small">{f.size} Bytes</span></summary>
|
||||
{#if f.text !== null}
|
||||
<pre>{f.text}{f.truncated ? "\n… gekürzt" : ""}</pre>
|
||||
{:else}
|
||||
<p class="muted small">Binärdatei, keine Vorschau.</p>
|
||||
{/if}
|
||||
</details>
|
||||
{/each}
|
||||
{#if detail.files.more}<p class="muted small">Es gibt weitere Dateien, die hier nicht angezeigt werden.</p>{/if}
|
||||
{/if}
|
||||
|
||||
{#if detail.run.check_output}
|
||||
<p class="muted">Prüfung (<code>check.sh</code>):</p>
|
||||
<h4>Ausgabe der Prüfung (<code>check.sh</code>)</h4>
|
||||
<pre>{detail.run.check_output}</pre>
|
||||
{/if}
|
||||
<h4>Schritte des Modells</h4>
|
||||
<ol class="steps">
|
||||
{#each detail.steps as st (st.idx)}
|
||||
<li>
|
||||
@ -477,6 +558,30 @@
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: -2px;
|
||||
}
|
||||
.reason {
|
||||
color: var(--muted);
|
||||
max-width: 26rem;
|
||||
white-space: normal;
|
||||
}
|
||||
.why {
|
||||
border: 1px solid color-mix(in srgb, var(--danger) 45%, var(--border));
|
||||
background: color-mix(in srgb, var(--danger) 10%, transparent);
|
||||
border-radius: 10px;
|
||||
padding: 0.6rem 0.9rem;
|
||||
margin: 0.6rem 0;
|
||||
}
|
||||
.file {
|
||||
margin: 0.2rem 0;
|
||||
}
|
||||
.file summary {
|
||||
cursor: pointer;
|
||||
}
|
||||
.detail h4 {
|
||||
margin: 1rem 0 0.3rem;
|
||||
}
|
||||
.small {
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
.how {
|
||||
margin: 0.5rem 0 1.2rem;
|
||||
color: var(--muted);
|
||||
|
||||
@ -88,6 +88,8 @@ export type ModelRank = {
|
||||
successes: number;
|
||||
median_duration_ms: number;
|
||||
mean_completion_tokens: number;
|
||||
prompt_tokens_total: number;
|
||||
completion_tokens_total: number;
|
||||
median_tps: number | null;
|
||||
};
|
||||
export type MatrixCell = { model: string; task_id: string; runs: number; successes: number; mean_score: number };
|
||||
@ -109,6 +111,8 @@ export type BatchEvent =
|
||||
| { kind: "model_unavailable"; model: string; reason: string }
|
||||
| { kind: "progress"; done: number; total: number };
|
||||
|
||||
export type FileEntry = { path: string; size: number; text: string | null; truncated: boolean };
|
||||
export type FilesReport = { dir: string; files: FileEntry[]; more: boolean };
|
||||
export type ExportResult = { dir: string; folders: number };
|
||||
export type ImportSummary = { imported: number; passed: number; skipped: string[] };
|
||||
|
||||
@ -132,6 +136,8 @@ export const api = {
|
||||
batches: () => invoke<BatchInfo[]>("list_batches"),
|
||||
results: (batchId: number) => invoke<RunRow[]>("batch_results", { batchId }),
|
||||
ranking: (batchId: number) => invoke<Ranking>("batch_ranking", { batchId }),
|
||||
files: (batchId: number, r: RunRow) =>
|
||||
invoke<FilesReport>("run_files", { batchId, model: r.model, taskId: r.task_id, repeatIdx: r.repeat_idx }),
|
||||
steps: (batchId: number, r: RunRow) =>
|
||||
invoke<StepRow[]>("run_steps", { batchId, model: r.model, taskId: r.task_id, repeatIdx: r.repeat_idx }),
|
||||
};
|
||||
@ -189,3 +195,26 @@ export function fmtDuration(ms: number): string {
|
||||
export function fmtTps(t: number | null): string {
|
||||
return t === null ? "–" : `${t < 10 ? t.toFixed(1) : Math.round(t)} Tok/s`;
|
||||
}
|
||||
|
||||
/** Tokens lesbar: 1 234 oder 12,3 Tsd. */
|
||||
export function fmtTokens(n: number): string {
|
||||
return n >= 100000 ? `${(n / 1000).toFixed(0)} Tsd.` : n.toLocaleString("de-DE");
|
||||
}
|
||||
|
||||
/** Warum ein Lauf nicht voll bestanden hat, in einem Satz. Leer bei bestandenen Läufen. */
|
||||
export function failureReason(r: { error_class: string; score: number; check_output: string; summary: string | null }): string {
|
||||
if (r.error_class === "ok") return "";
|
||||
if (r.error_class === "check_failed") {
|
||||
// `check.sh` darf als letzte Zeile {"score": …, "notes": "…"} schreiben.
|
||||
const last = r.check_output.split("\n").map((l) => l.trim()).filter(Boolean).pop() ?? "";
|
||||
try {
|
||||
const j = JSON.parse(last);
|
||||
if (j && typeof j.notes === "string" && j.notes) return j.notes;
|
||||
} catch {
|
||||
// keine JSON-Zeile
|
||||
}
|
||||
const lines = r.check_output.split("\n").map((l) => l.trim()).filter((l) => l && !l.startsWith("exit "));
|
||||
return lines.length > 0 ? lines.slice(-2).join(" ") : "Die Prüfung ist fehlgeschlagen.";
|
||||
}
|
||||
return errorLabel(r.error_class);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user