Stream Whisper segments so the UI can show live transcript text.

Consume faster-whisper SSE instead of blocking on one JSON response, persist growing text and progress over Reverb, and drop the fake percent heartbeat.
This commit is contained in:
ben
2026-08-13 12:34:47 +02:00
parent 5cea5192c2
commit 4c73620458
9 changed files with 574 additions and 138 deletions
+6 -4
View File
@@ -76,9 +76,11 @@ class TranscribeRecording implements ShouldQueue
try {
$text = $transcription->transcribe(
$this->recording,
function (string $message, int $percent): void {
$this->reportIfOwned($message, $percent);
function (string $message, int $percent, ?string $partialTranscript = null): void {
$this->reportIfOwned($message, $percent, $partialTranscript);
},
fn (): bool => Recording::query()->find($this->recording->id)
?->ownsTranscriptionRun($this->runStartedAt) ?? false,
);
if (! $this->claimSuccessfulTranscript($text)) {
@@ -170,12 +172,12 @@ class TranscribeRecording implements ShouldQueue
return false;
}
private function reportIfOwned(string $message, int $percent): void
private function reportIfOwned(string $message, int $percent, ?string $partialTranscript = null): void
{
if (! $this->recording->ownsTranscriptionRun($this->runStartedAt)) {
return;
}
$this->recording->reportProgress($message, $percent);
$this->recording->reportProgress($message, $percent, partialTranscript: $partialTranscript);
}
}