From 373aee84235e5451a424f614fb09cdfb096a2419 Mon Sep 17 00:00:00 2001 From: mARTin-B78 Date: Sun, 28 Jun 2026 00:20:15 +0200 Subject: [PATCH] feat: sync batch benchmark results into My Voices (v1.12.16) After a batch benchmark completes, successful entries are saved to each voice's meta.json via POST /api/voice/meta. window.loadVoiceLibrary() is then called so My Voices Factor + WPM columns update instantly without a manual reload. Co-Authored-By: Claude Sonnet 4.6 --- CHANGELOG.md | 7 +++++++ static/index.html | 4 ++-- static/js/benchmark.js | 25 +++++++++++++++++++++++++ static/js/voice-library.js | 2 ++ 4 files changed, 36 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b20510..0027dfb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,13 @@ Follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) · versioned wi --- +## [1.12.16] — 2026-06-28 + +### Added +- **Batch benchmark → My Voices sync** — after a batch benchmark run completes, results are automatically saved to each voice's `meta.json` via `POST /api/voice/meta`, and My Voices Factor + WPM columns update immediately without a manual page refresh. + +--- + ## [1.12.15] — 2026-06-28 ### Added diff --git a/static/index.html b/static/index.html index e21ebeb..ad5d487 100644 --- a/static/index.html +++ b/static/index.html @@ -26,7 +26,7 @@ - + @@ -336,7 +336,7 @@ - + diff --git a/static/js/benchmark.js b/static/js/benchmark.js index 0236648..c8b0b87 100644 --- a/static/js/benchmark.js +++ b/static/js/benchmark.js @@ -403,6 +403,31 @@ (best ? `, best RTF ${best.avgRtf.toFixed(2)} (${best.voice})` : ''), ok.length < batchResults.length ? 'error' : 'success' ); + + // Sync results into voice meta so My Voices Factor/WPM columns update + const syncable = batchResults.filter(r => r.ok && r.avgRtf > 0 && r.avgAudio > 0); + if (syncable.length && typeof window.loadVoiceLibrary === 'function') { + const benchText = ($('perf-text')?.value || '').trim(); + await Promise.allSettled(syncable.map(r => + fetch('/api/voice/meta', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ + voice_id: r.voice, + benchmark: { + ok: true, + text: benchText, + elapsed_sec: r.avgLatency / 1000, + audio_sec: r.avgAudio, + speed: 1 / r.avgRtf, + rtf: r.avgRtf, + ttfa_ms: r.minLatency, + } + }) + }) + )); + await window.loadVoiceLibrary(); + } } batchRunBtn.addEventListener('click', runBatchBenchmark); diff --git a/static/js/voice-library.js b/static/js/voice-library.js index dec742e..5411dba 100644 --- a/static/js/voice-library.js +++ b/static/js/voice-library.js @@ -926,6 +926,8 @@ function mergeBenchmarkResults(d) { if (hit && hit.benchmark) v.benchmark = hit.benchmark; }); } +window.loadVoiceLibrary = () => loadVoiceLibrary(); +window.mergeBenchmarkResults = mergeBenchmarkResults; function activeBenchmarkVoices() { return (_voices || []).filter(v => v.enabled !== false);