From 9b95c632fa3c1f8324d18ce503d0cf0ef5705f9c Mon Sep 17 00:00:00 2001 From: mARTin-B78 Date: Tue, 9 Jun 2026 20:42:22 +0200 Subject: [PATCH] feat: show last benchmark time+accuracy on selected STT engine (v2.02.01) After running a benchmark, each engine's best result (time, accuracy) is persisted to config and shown as a small info line in the Engines tab when that engine is selected. Updates live as the benchmark runs. Co-Authored-By: Claude Sonnet 4.6 --- linux/blitztext/__init__.py | 2 +- linux/blitztext/config.py | 3 +++ linux/blitztext/gtksettings.py | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/linux/blitztext/__init__.py b/linux/blitztext/__init__.py index 9910d5f..7fec7e0 100644 --- a/linux/blitztext/__init__.py +++ b/linux/blitztext/__init__.py @@ -6,4 +6,4 @@ counterpart to the macOS Blitztext menu bar app: it runs natively on the host (not in a container) so it can type into any application via xdotool. """ -__version__ = "2.02.00" +__version__ = "2.02.01" diff --git a/linux/blitztext/config.py b/linux/blitztext/config.py index 1b08fd8..6df20bc 100644 --- a/linux/blitztext/config.py +++ b/linux/blitztext/config.py @@ -124,6 +124,7 @@ class Config: bench_wav: str = "" bench_ref: str = "" bench_expand_models: bool = False + bench_last: dict = field(default_factory=dict) # {engine_name: {seconds, accuracy, ok}} # workflows workflows: list[Workflow] = field(default_factory=list) @@ -243,6 +244,7 @@ def load(path: Path = CONFIG_PATH) -> Config: bench_wav=data.get("benchmark", {}).get("wav", ""), bench_ref=data.get("benchmark", {}).get("ref", ""), bench_expand_models=bool(data.get("benchmark", {}).get("expand_models", False)), + bench_last=dict(data.get("benchmark", {}).get("last", {})), ) for entry in data.get("workflow", []): @@ -382,6 +384,7 @@ def save(cfg: Config, path: Path = CONFIG_PATH) -> None: "wav": cfg.bench_wav, "ref": cfg.bench_ref, "expand_models": cfg.bench_expand_models, + "last": cfg.bench_last, }, "wakeword_engine": [ {"name": e.name, "uri": e.uri, "model": e.model} for e in cfg.wakeword_engines diff --git a/linux/blitztext/gtksettings.py b/linux/blitztext/gtksettings.py index d71a61b..71fc1f8 100644 --- a/linux/blitztext/gtksettings.py +++ b/linux/blitztext/gtksettings.py @@ -1210,6 +1210,12 @@ notebook.bt-nb tab:checked label { self.stt_result.set_valign(Gtk.Align.START) test_row.pack_start(self.stt_result, True, True, 0) box.pack_start(test_row, False, False, 2) + + self.stt_bench_info = Gtk.Label(xalign=0.0) + self.stt_bench_info.set_use_markup(True) + self.stt_bench_info.set_margin_top(2) + box.pack_start(self.stt_bench_info, False, False, 0) + self._stt_load(self.stt_combo.get_active()) return box @@ -1278,6 +1284,22 @@ notebook.bt-nb tab:checked label { else: _fill_combo(self.stt_model, [], e.model) self._stt_idx = idx + self._stt_update_bench_info(e.name) + + def _stt_update_bench_info(self, engine_name: str) -> None: + if not hasattr(self, "stt_bench_info"): + return + last = self.cfg.bench_last.get(engine_name) + if not last: + self.stt_bench_info.set_markup("") + return + if last.get("ok"): + self.stt_bench_info.set_markup( + f'Last benchmark: ' + f'{last["seconds"]:.2f}s ยท {last["accuracy"]:.1f}% accuracy') + else: + self.stt_bench_info.set_markup( + 'Last benchmark: failed') def _stt_commit(self) -> None: idx = self._stt_idx @@ -2174,6 +2196,16 @@ notebook.bt-nb tab:checked label { lang_display = stt.fmt_languages(row.languages) self.bench_store.append([row.engine, url_display, row.model, row.device, row.best_for, lang_display, f"{row.seconds:.2f}", acc, out_friendly, tooltip]) + # Persist result so Engines tab can show it + self.cfg.bench_last[row.engine] = { + "seconds": row.seconds, "accuracy": row.accuracy, "ok": row.ok, + } + save(self.cfg) + # Refresh info label if this engine is currently selected in Engines tab + if hasattr(self, "stt_name"): + cur = self.cfg.stt_engines[self._stt_idx].name if 0 <= self._stt_idx < len(self.cfg.stt_engines) else "" + if cur == row.engine: + self._stt_update_bench_info(row.engine) return False def _bench_done(self, rows) -> bool: