Add transcribe progress indicator — elapsed timer and progressive trace messages

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-13 19:12:09 +02:00
parent e81b8f8ecc
commit aa2d64b599
2 changed files with 38 additions and 1 deletions
+32 -1
View File
@@ -564,7 +564,19 @@ async function runTranscribe() {
return;
}
setBusy(true);
renderTrace([{ label: 'Sending to Whisper', detail: 'Uploading audio to cuttlefish GPU…', status: 'running' }]);
const startTime = Date.now();
let elapsed = 0;
updateTranscribeTrace(0);
els.status.textContent = 'Transcribing…';
const timer = setInterval(() => {
elapsed = Math.floor((Date.now() - startTime) / 1000);
const m = Math.floor(elapsed / 60);
const s = elapsed % 60;
els.status.textContent = m > 0 ? `Transcribing… ${m}:${pad2(s)}` : `Transcribing… ${s}s`;
updateTranscribeTrace(elapsed);
}, 1000);
try {
const formData = new FormData();
@@ -595,10 +607,29 @@ async function runTranscribe() {
els.status.textContent = error.message;
renderTrace([{ label: 'Transcription error', detail: error.message, status: 'warning' }]);
} finally {
clearInterval(timer);
setBusy(false);
}
}
function updateTranscribeTrace(elapsed) {
let label, detail;
if (elapsed < 10) {
label = 'Uploading to Whisper';
detail = 'Sending audio to cuttlefish GPU…';
} else if (elapsed < 60) {
label = 'Processing on GPU';
detail = 'Whisper is transcribing. Large files take 13 minutes.';
} else if (elapsed < 120) {
label = 'Still processing…';
detail = `${Math.floor(elapsed / 60)} min elapsed — Whisper is working through the audio.`;
} else {
label = 'Still processing…';
detail = `${Math.floor(elapsed / 60)} min ${pad2(elapsed % 60)}s — long recordings can take several minutes.`;
}
renderTrace([{ label, detail, status: 'running' }]);
}
function renderTranscriptResults(data) {
const speakerRoles = data.speaker_roles || {};
const segments = data.segments || [];