From 79be74ccd8d51fa6396183b36270d58d5eaae5f3 Mon Sep 17 00:00:00 2001 From: pyr0ball Date: Fri, 27 Feb 2026 15:48:47 -0800 Subject: [PATCH] =?UTF-8?q?feat:=20discard=20button=20=E2=80=94=20removes?= =?UTF-8?q?=20email=20from=20queue=20without=20writing=20to=20score=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/label_tool.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/label_tool.py b/tools/label_tool.py index 74d1857..be7ea99 100644 --- a/tools/label_tool.py +++ b/tools/label_tool.py @@ -534,7 +534,7 @@ with tab_label: # ── Navigation ──────────────────────────────────────────────────── st.markdown("") - nav_cols = st.columns([2, 1, 1]) + nav_cols = st.columns([2, 1, 1, 1]) remaining = len(unlabeled) - 1 nav_cols[0].caption(f"**{remaining}** remaining · Keys: 1–9 = label, 0 = other, S = skip, U = undo") @@ -556,6 +556,16 @@ with tab_label: st.session_state.idx = next_idx st.rerun() + if nav_cols[3].button("🗑️ Discard", use_container_width=True): + # Remove from queue entirely — not written to score file + st.session_state.queue = [e for e in queue if _entry_key(e) != _entry_key(entry)] + _save_jsonl(_QUEUE_FILE, st.session_state.queue) + next_idx = min(idx, len(st.session_state.queue) - 1) + while next_idx < len(st.session_state.queue) and _entry_key(st.session_state.queue[next_idx]) in labeled_keys: + next_idx += 1 + st.session_state.idx = max(next_idx, 0) + st.rerun() + # Keyboard shortcut capture (JS → hidden button click) st.components.v1.html( """