Add a paged lyrics quality queue
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
// Explicit Whisper requests produce reviewable drafts, never published notes.
|
||||
import { randomUUID } from 'node:crypto';
|
||||
import { db as sql } from './db.js';
|
||||
import { audit } from './audit-log.js';
|
||||
const ID = /^([\w-]{11}|upl_[a-f0-9]{12})$/;
|
||||
const LEASE_MS = 120000;
|
||||
function publicJob(row) {
|
||||
@@ -34,6 +35,7 @@ export function registerTranscriptionRoutes(app, { db, adminAuth, workerAuth, wo
|
||||
SELECT ?,?,?,?,? WHERE (SELECT COUNT(*) FROM lyric_transcriptions WHERE status IN ('queued','running')) < 25`,
|
||||
args: [randomUUID(), id, notes.lyrics?.rev || 0, time, time] });
|
||||
const row = (await sql.execute({ sql: "SELECT * FROM lyric_transcriptions WHERE video_id=? AND status IN ('queued','running')", args: [id] })).rows[0];
|
||||
if (row) await audit(db, 'admin', 'lyrics.whisper.enqueue', id, { jobId: row.id });
|
||||
return row ? c.json({ ok: true, job: publicJob(row) }, 202) : c.json({ ok: false, error: 'The transcription queue is full.' }, 429);
|
||||
});
|
||||
app.get('/api/admin/transcriptions/:video', adminAuth, async c => {
|
||||
|
||||
Reference in New Issue
Block a user