diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index a68bcdb..f216e13 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -183,6 +183,7 @@ async fn discover_models(adapter: String, url: String, api_key_env: String) -> R } /// Startet einen Batch mit den angegebenen Modellen (Anzeigenamen) und Aufgaben-IDs. +/// Mit `batch_id` wird ein bestehender Batch fortgesetzt: fertige Läufe werden übersprungen. /// Fortschritt kommt als Ereignis `batch-event`. Das Ergebnis ist die Zusammenfassung. #[tauri::command] async fn start_batch( @@ -194,6 +195,7 @@ async fn start_batch( task_ids: Vec, repeats: u32, note: String, + batch_id: Option, ) -> Result { if models.is_empty() || task_ids.is_empty() { return Err("Mindestens ein Modell und eine Aufgabe wählen.".into()); @@ -262,7 +264,7 @@ async fn start_batch( let on_event = |e: &Event| { let _ = emitter.emit(EVENT_NAME, e); }; - runner::run_batch(&mut store, &run_cfg, None, ¬e, repeats, &jobs, &cancel, &on_event) + runner::run_batch(&mut store, &run_cfg, batch_id, ¬e, repeats, &jobs, &cancel, &on_event) }) .await .map_err(|e| format!("Batch-Thread abgebrochen: {e}"))?; diff --git a/src/lib/BenchPanel.svelte b/src/lib/BenchPanel.svelte index 8dd1e02..5e59f6f 100644 --- a/src/lib/BenchPanel.svelte +++ b/src/lib/BenchPanel.svelte @@ -160,7 +160,7 @@ return (tasks?.tasks ?? []).filter((t) => chosenTasks.includes(t.id)); } - async function start() { + async function start(resumeBatch: number | null = null) { error = ""; log = []; progress = null; @@ -170,7 +170,7 @@ for (const m of chosenModels) for (const t of chosenTaskInfos()) cells[key(m, t.id)] = { state: "planned", n: 0, sum: 0, cls: "" }; running = true; 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, "", resumeBatch); finishedBatch = s.batch_id; cancelled = s.cancelled; } catch (e) { @@ -182,6 +182,10 @@ } } + // Offen ist, was nicht fertig gewertet wurde: abgebrochen oder durch einen Ausfall nicht gewertet. + let openCells = $derived(Object.values(cells).filter((c) => c.state !== "done" && c.state !== "skipped").length); + let canResume = $derived(!running && finishedBatch !== null && openCells > 0); + function cellOf(model: string, task: string): Cell | undefined { return cells[key(model, task)]; } @@ -347,8 +351,11 @@ {#if error}

{error}

{/if} {#if finishedBatch !== null}

- {cancelled ? "Abgebrochen." : "Fertig."} + {cancelled ? "Abgebrochen." : openCells > 0 ? `Fertig, aber ${openCells} Zelle(n) offen oder nicht gewertet.` : "Fertig."} + {#if canResume} + · + {/if}

{/if} {#if log.length > 0} @@ -384,7 +391,7 @@ Durchläufe - + {#if progress}
diff --git a/src/lib/api.ts b/src/lib/api.ts index 6afcfd6..601f0fb 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -108,8 +108,8 @@ export const api = { discoverModels: (adapter: string, url: string, apiKeyEnv: string) => invoke("discover_models", { adapter, url, apiKeyEnv }), testModel: (name: string) => invoke("test_model", { name }), - startBatch: (models: string[], taskIds: string[], repeats: number, note: string) => - invoke("start_batch", { models, taskIds, repeats, note }), + startBatch: (models: string[], taskIds: string[], repeats: number, note: string, batchId: number | null = null) => + invoke("start_batch", { models, taskIds, repeats, note, batchId }), cancelBatch: () => invoke("cancel_batch"), batches: () => invoke("list_batches"), results: (batchId: number) => invoke("batch_results", { batchId }),