Add transcription progress handling and local Whisper integration.
Implement a new method for calculating elapsed transcription time in the Recording model. Enhance the TranscriptionService to handle local Whisper requests, including asynchronous processing and progress reporting. Update the recordings index view to display transcription progress percentage. Add unit tests for the new transcription service functionality.
This commit is contained in:
@@ -165,6 +165,18 @@ class Recording extends Model
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Seconds since the current transcription run started.
|
||||
*/
|
||||
public function transcriptionElapsedSeconds(): ?int
|
||||
{
|
||||
if ($this->transcription_started_at === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return max(0, now()->getTimestamp() - $this->transcription_started_at->getTimestamp());
|
||||
}
|
||||
|
||||
/**
|
||||
* Search title, metadata, and stored transcript text.
|
||||
*/
|
||||
@@ -556,7 +568,7 @@ class Recording extends Model
|
||||
public function transcriptionStatusPayload(): array
|
||||
{
|
||||
$startedAt = $this->transcription_started_at;
|
||||
$elapsed = $startedAt ? (int) round($startedAt->diffInSeconds(now())) : null;
|
||||
$elapsed = $this->transcriptionElapsedSeconds();
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
|
||||
Reference in New Issue
Block a user