diff --git a/dashboard/src/App.jsx b/dashboard/src/App.jsx index 81005bd..e8baad6 100644 --- a/dashboard/src/App.jsx +++ b/dashboard/src/App.jsx @@ -255,6 +255,9 @@ function App() { const [downloadingAll, setDownloadingAll] = useState(false); // Pre-flight quality gate: { info: {max_height, min_height, cookies_invalid}, data } const [qualityGate, setQualityGate] = useState(null); + // True while the optional cadence handoff ZIP is being uploaded, before the + // process request is sent. Drives the small status line in the left panel. + const [handoffUploading, setHandoffUploading] = useState(false); const [logs, setLogs] = useState([]); // When each server log line arrived (epoch s, parallel to logs), from /api/status. const [logTimes, setLogTimes] = useState([]); @@ -678,6 +681,40 @@ function App() { channel: data.channel || null, }; + // Optional cadence handoff bundle: reserve a slot, PUT the ZIP, then pass + // its id to /api/process. A failure throws and is caught below, aborting + // the job rather than silently re-transcribing the master. + let handoffId = null; + if (data.handoffFile) { + setHandoffUploading(true); + setLogs((l) => [...l, `Uploading handoff bundle (${data.handoffFile.name})…`]); + try { + const createRes = await apiFetch('/api/uploads', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ filename: data.handoffFile.name, kind: 'handoff' }), + }); + if (!createRes.ok) throw new Error(`Handoff upload failed: ${readableError(await createRes.text())}`); + const slot = await createRes.json(); + if (!slot?.upload_url) throw new Error('Handoff upload failed: the server returned no upload URL.'); + const putRes = await apiFetch(slot.upload_url, { + method: slot.method || 'PUT', + headers: { 'Content-Type': 'application/zip' }, + body: data.handoffFile, + }); + if (!putRes.ok) throw new Error(`Handoff upload failed: ${readableError(await putRes.text())}`); + const putData = await putRes.json().catch(() => ({})); + handoffId = putData.upload_id || slot.upload_id || null; + if (!handoffId) throw new Error('Handoff upload failed: the server returned no upload id.'); + setLogs((l) => [...l, 'Handoff bundle attached — transcription will be skipped.']); + } finally { + setHandoffUploading(false); + } + } + // Only travels when a bundle was attached, so the default request is + // byte-identical to today's. + if (handoffId) advanced.handoff_id = handoffId; + if (data.type === 'url') { headers['Content-Type'] = 'application/json'; body = JSON.stringify({ @@ -1203,6 +1240,13 @@ function App() { + {handoffUploading && ( +
Output format