add auto-review button that approves every high-confidence pending item
All checks were successful
Build and Push Docker Image / build (push) Successful in 1m0s

one-click for the common case: anything whose language came from
radarr/sonarr (confidence='high') is trusted enough to skip manual
review. low-confidence items stay pending.

- POST /api/review/auto-approve filters on rp.confidence='high' and
  enqueues audio jobs through the same dedup-guarded helper
- ColumnShell now takes actions[] instead of a single action, so the
  Review header can show Auto Review + Skip all side by side
This commit is contained in:
2026-04-14 07:40:38 +02:00
parent 4f1433437b
commit 9b03a33e24
7 changed files with 67 additions and 21 deletions

View File

@@ -504,6 +504,24 @@ app.post("/approve-all", (c) => {
return c.json({ ok: true, count: pending.length });
});
// ─── Auto-approve high-confidence ────────────────────────────────────────────
// Approves every pending plan whose original language came from an authoritative
// source (radarr/sonarr). Anything with low confidence keeps needing a human.
app.post("/auto-approve", (c) => {
const db = getDb();
const pending = db
.prepare(
"SELECT rp.*, mi.id as item_id FROM review_plans rp JOIN media_items mi ON mi.id = rp.item_id WHERE rp.status = 'pending' AND rp.is_noop = 0 AND rp.confidence = 'high'",
)
.all() as (ReviewPlan & { item_id: number })[];
for (const plan of pending) {
db.prepare("UPDATE review_plans SET status = 'approved', reviewed_at = datetime('now') WHERE id = ?").run(plan.id);
const { item, streams, decisions } = loadItemDetail(db, plan.item_id);
if (item) enqueueAudioJob(db, plan.item_id, buildCommand(item, streams, decisions));
}
return c.json({ ok: true, count: pending.length });
});
// ─── Detail ───────────────────────────────────────────────────────────────────
app.get("/:id", (c) => {