Keep live Whisper segments on screen without a page refresh.
Treat streamed chunks as appends, stop Livewire from remorphing the Alpine tree, and hydrate from HTTP while a run is active so segment cards appear as they arrive.
This commit is contained in:
@@ -60,7 +60,7 @@ class ShowTest extends TestCase
|
||||
$this->assertDatabaseMissing('recordings', ['id' => $recording->id]);
|
||||
}
|
||||
|
||||
public function test_show_polls_while_transcription_is_queued(): void
|
||||
public function test_show_uses_alpine_hydrate_while_transcription_is_queued(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
$this->actingAs($user);
|
||||
@@ -79,12 +79,13 @@ class ShowTest extends TestCase
|
||||
]);
|
||||
|
||||
Livewire::test(Show::class, ['recording' => $recording])
|
||||
->assertSee('wire:poll', false)
|
||||
->assertDontSee('echo-private', false)
|
||||
->assertDontSee('wire:poll', false)
|
||||
->assertSee('wire:ignore', false)
|
||||
->assertSee('transcriptionMonitor', false)
|
||||
->assertSee('Queued — waiting to start…');
|
||||
}
|
||||
|
||||
public function test_show_does_not_poll_while_transcription_is_processing(): void
|
||||
public function test_show_does_not_use_livewire_poll_while_transcription_is_processing(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
$this->actingAs($user);
|
||||
@@ -104,6 +105,7 @@ class ShowTest extends TestCase
|
||||
|
||||
Livewire::test(Show::class, ['recording' => $recording])
|
||||
->assertDontSee('wire:poll', false)
|
||||
->assertSee('wire:ignore', false)
|
||||
->assertSee('userId', false);
|
||||
}
|
||||
|
||||
@@ -166,6 +168,7 @@ class ShowTest extends TestCase
|
||||
Livewire::test(Show::class, ['recording' => $recording])
|
||||
->assertSee('whisper.segments', false)
|
||||
->assertSee('whisper.language', false)
|
||||
->assertSee('segmentDomKey', false)
|
||||
->assertSee('Hello');
|
||||
}
|
||||
|
||||
@@ -274,7 +277,7 @@ class ShowTest extends TestCase
|
||||
]);
|
||||
|
||||
Livewire::test(Show::class, ['recording' => $recording])
|
||||
->assertSee('wire:ignore.self', false)
|
||||
->assertSee('wire:ignore', false)
|
||||
->assertSee('transcription-ui-'.$recording->id.'-processing-', false)
|
||||
->assertDontSee('transcription-ui-'.$recording->id.'-processing-62', false);
|
||||
}
|
||||
|
||||
@@ -330,6 +330,35 @@ class TranscriptionBroadcastTest extends TestCase
|
||||
$this->assertSame(-0.1, $recording->transcription_verbose['segments'][0]['avg_logprob']);
|
||||
}
|
||||
|
||||
public function test_consecutive_live_whisper_segments_are_appended(): void
|
||||
{
|
||||
Event::fake([RecordingTranscriptionUpdated::class]);
|
||||
|
||||
$recording = Recording::query()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'title' => 'Append live',
|
||||
'original_filename' => 'append.mp3',
|
||||
'file_path' => 'recordings/append.mp3',
|
||||
'file_size_bytes' => 100,
|
||||
'transcription_status' => 'processing',
|
||||
'transcription_driver' => 'local',
|
||||
'transcription_started_at' => now(),
|
||||
]);
|
||||
|
||||
$recording->reportProgress('Transcribing locally…', 40, partialTranscript: "didn't I wasn't aware", whisperDelta: [
|
||||
'language' => 'en',
|
||||
'segment' => ['id' => 0, 'text' => "didn't I wasn't aware", 'start' => 254.5, 'end' => 260.8],
|
||||
]);
|
||||
$recording->refresh()->reportProgress('Transcribing locally…', 45, partialTranscript: "didn't I wasn't aware other people", whisperDelta: [
|
||||
'language' => 'en',
|
||||
'segment' => ['id' => 0, 'text' => 'other people', 'start' => 260.8, 'end' => 267.4],
|
||||
]);
|
||||
|
||||
$recording->refresh();
|
||||
$this->assertCount(2, $recording->transcription_verbose['segments']);
|
||||
$this->assertSame('other people', $recording->transcription_verbose['segments'][1]['text']);
|
||||
}
|
||||
|
||||
public function test_oversized_transcript_delta_is_not_broadcast(): void
|
||||
{
|
||||
$recording = Recording::query()->create([
|
||||
|
||||
Reference in New Issue
Block a user