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:
@@ -457,6 +457,12 @@ p {
|
|||||||
|
|
||||||
.trace-status.running {
|
.trace-status.running {
|
||||||
background: var(--amber);
|
background: var(--amber);
|
||||||
|
animation: trace-pulse 1.4s ease-in-out infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes trace-pulse {
|
||||||
|
0%, 100% { opacity: 1; transform: scale(1); }
|
||||||
|
50% { opacity: 0.4; transform: scale(0.7); }
|
||||||
}
|
}
|
||||||
|
|
||||||
.trace-status.warning {
|
.trace-status.warning {
|
||||||
|
|||||||
+32
-1
@@ -564,7 +564,19 @@ async function runTranscribe() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setBusy(true);
|
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 {
|
try {
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
@@ -595,10 +607,29 @@ async function runTranscribe() {
|
|||||||
els.status.textContent = error.message;
|
els.status.textContent = error.message;
|
||||||
renderTrace([{ label: 'Transcription error', detail: error.message, status: 'warning' }]);
|
renderTrace([{ label: 'Transcription error', detail: error.message, status: 'warning' }]);
|
||||||
} finally {
|
} finally {
|
||||||
|
clearInterval(timer);
|
||||||
setBusy(false);
|
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 1–3 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) {
|
function renderTranscriptResults(data) {
|
||||||
const speakerRoles = data.speaker_roles || {};
|
const speakerRoles = data.speaker_roles || {};
|
||||||
const segments = data.segments || [];
|
const segments = data.segments || [];
|
||||||
|
|||||||
Reference in New Issue
Block a user