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:
@@ -502,14 +502,20 @@ class Recording extends Model
|
||||
/**
|
||||
* Update the live progress fields shown in the UI.
|
||||
*/
|
||||
public function reportProgress(string $message, int $percent, string $status = 'processing'): void
|
||||
public function reportProgress(string $message, int $percent, string $status = 'processing', ?string $partialTranscript = null): void
|
||||
{
|
||||
$this->forceFill([
|
||||
$attributes = [
|
||||
'transcription_status' => $status,
|
||||
'transcription_progress' => $message,
|
||||
'transcription_percent' => max(0, min(100, $percent)),
|
||||
'transcription_error' => null,
|
||||
])->save();
|
||||
];
|
||||
|
||||
if ($partialTranscript !== null) {
|
||||
$attributes['transcript'] = $partialTranscript;
|
||||
}
|
||||
|
||||
$this->forceFill($attributes)->save();
|
||||
|
||||
RecordingTranscriptionUpdated::dispatch($this->fresh());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user