Add live transcription progress and Docker Whisper.

Surface stage, percent, and elapsed time while jobs run, and ship Compose so local confidential transcription can use faster-whisper on port 8090.
This commit is contained in:
ben
2026-08-12 14:32:56 +02:00
parent 67c1941833
commit e0400aadef
14 changed files with 695 additions and 177 deletions
+36 -7
View File
@@ -31,18 +31,32 @@ class TranscribeRecording implements ShouldQueue
*/
public function handle(TranscriptionService $transcription): void
{
$this->recording->update([
$this->recording->refresh();
$this->recording->forceFill([
'transcription_status' => 'processing',
]);
'transcription_started_at' => $this->recording->transcription_started_at ?? now(),
'transcription_error' => null,
])->save();
$this->recording->reportProgress('Preparing audio file…', 15);
try {
$text = $transcription->transcribe($this->recording);
$text = $transcription->transcribe(
$this->recording,
fn (string $message, int $percent) => $this->recording->reportProgress($message, $percent),
);
$this->recording->update([
$this->recording->reportProgress('Saving transcript…', 90);
$this->recording->forceFill([
'transcript' => $text,
'transcription_status' => 'done',
'transcription_progress' => 'Transcription complete',
'transcription_percent' => 100,
'transcription_error' => null,
'transcribed_at' => now(),
]);
])->save();
} catch (Throwable $e) {
Log::error('Transcription failed', [
'recording_id' => $this->recording->id,
@@ -50,11 +64,26 @@ class TranscribeRecording implements ShouldQueue
'message' => $e->getMessage(),
]);
$this->recording->update([
$this->recording->forceFill([
'transcription_status' => 'failed',
]);
'transcription_progress' => 'Transcription failed',
'transcription_percent' => $this->recording->transcription_percent ?: 0,
'transcription_error' => $e->getMessage(),
])->save();
throw $e;
}
}
/**
* Handle a job failure (timeouts, worker kill, etc.).
*/
public function failed(?Throwable $e): void
{
$this->recording->forceFill([
'transcription_status' => 'failed',
'transcription_progress' => 'Transcription failed',
'transcription_error' => $e?->getMessage() ?: 'Transcription stopped unexpectedly.',
])->save();
}
}