diff --git a/resources/js/transcription.js b/resources/js/transcription.js index 2e12631..53931e3 100644 --- a/resources/js/transcription.js +++ b/resources/js/transcription.js @@ -171,6 +171,32 @@ export function transcriptionMonitor({ statusUrl, initial, userId }) { return this.status.has_transcript ? 'Re-transcribe' : 'Start transcription'; }, + get whisperWords() { + return this.whisper.segments.flatMap((segment, segmentIndex) => { + if (Array.isArray(segment.words) && segment.words.length) { + return segment.words.map((word, wordIndex) => ({ + word: word.word, + start: word.start, + probability: word.probability, + key: [segmentIndex, wordIndex, word.start ?? '', word.word ?? ''].join(':'), + })); + } + + const text = typeof segment.text === 'string' ? segment.text.trim() : ''; + + if (text === '') { + return []; + } + + return [{ + word: text, + start: segment.start, + probability: null, + key: segmentIndex + ':text', + }]; + }); + }, + start() { this.leaveChannel = subscribeToRecording({ recordingId: this.status.id, @@ -421,10 +447,6 @@ export function transcriptionMonitor({ statusUrl, initial, userId }) { return segments.concat([segment]); }, - segmentDomKey(segment, index) { - return segmentKey(segment) + '#' + index; - }, - seekTo(seconds) { const player = this.$refs.player; diff --git a/resources/views/livewire/recordings/show.blade.php b/resources/views/livewire/recordings/show.blade.php index 28e8cd2..e1f652a 100644 --- a/resources/views/livewire/recordings/show.blade.php +++ b/resources/views/livewire/recordings/show.blade.php @@ -181,7 +181,7 @@
@@ -229,7 +229,7 @@

- - -
- Token logprobs -
    - -
-
+
+ +
$recording]) - ->assertSee('whisper.segments', false) + ->assertSee('whisperWords', false) ->assertSee('whisper.language', false) - ->assertSee('segmentDomKey', false) ->assertSee('Hello'); }