Speakr is a personal, self-hosted web application designed for transcribing audio recordings
Python
seeking
Murtaza Nasir7a91ef0c0519
diff --git a/app.py b/app.pyindex 4b7cf710..805a06ff 100644--- a/app.py+++ b/app.py@@ -416,7 +416,7 @@ def transcribe_audio_asr(app_context, recording_id, filepath, original_filename,params = {'encode': ASR_ENCODE,'task': ASR_TASK,- 'output': 'txt'+ 'output': 'json'}if language:params['language'] = language@@ -435,6 +435,8 @@ def transcribe_audio_asr(app_context, recording_id, filepath, original_filename,with httpx.Client() as client:response = client.post(url, params=params, files=files, timeout=None)response.raise_for_status()+ # The ASR service now returns JSON as a string.+ # We will store it directly. The frontend will parse it.recording.transcription = response.textapp.logger.info(f"ASR transcription completed for recording {recording_id}.")@@ -677,26 +679,56 @@ def update_speakers(recording_id):if not speaker_map:return jsonify({'error': 'No speaker map provided'}), 400- transcription = recording.transcription- new_participants = []+ transcription_text = recording.transcription+ is_json = False+ try:+ transcription_data = json.loads(transcription_text)+ is_json = isinstance(transcription_data, dict) and 'segments' in transcription_data+ except (json.JSONDecodeError, TypeError):+ is_json = False+speaker_names_used = []- for speaker_label, new_name_info in speaker_map.items():- new_name = new_name_info['name']- if new_name_info.get('isMe'):- new_name = current_user.name or 'Me'+ if is_json:+ # Handle JSON transcript+ for segment in transcription_data.get('segments', []):+ original_speaker_label = segment.get('speaker')+ if original_speaker_label in speaker_map:+ new_name_info = speaker_map[original_speaker_label]+ new_name = new_name_info.get('name', '').strip()+ if new_name_info.get('isMe'):+ new_name = current_user.name or 'Me'++ if new_name:+ segment['speaker'] = new_name+ if new_name not in speaker_names_used:+ speaker_names_used.append(new_name)- if new_name:- # Regex to handle variations like [SPEAKER_00], [ SPEAKER_00 ], etc.- transcription = re.sub(r'\[\s*' + re.escape(speaker_label) + r'\s*\]', f'[{new_name}]', transcription)- if new_name not in new_participants:- new_participants.append(new_name)- speaker_names_used.append(new_name)-- recording.transcription = transcription- if new_participants:- recording.participants = ', '.join(new_participants)-+ recording.transcription = json.dumps(transcription_data)++ # Update participants from the final list of speakers in the JSON+ if transcription_data.get('segments'):+ final_speakers = set(seg.get('speaker') for seg in transcription_data['segments'] if seg.get('speaker'))+ recording.participants = ', '.join(sorted(list(final_speakers)))++ else:+ # Handle plain text transcript+ new_participants = []+ for speaker_label, new_name_info in speaker_map.items():+ new_name = new_name_info.get('name', '').strip()+ if new_name_info.get('isMe'):+ new_name = current_user.name or 'Me'++ if new_name:+ transcription_text = re.sub(r'\[\s*' + re.escape(speaker_label) + r'\s*\]', f'[{new_name}]', transcription_text, flags=re.IGNORECASE)+ if new_name not in new_participants:+ new_participants.append(new_name)++ recording.transcription = transcription_text+ if new_participants:+ recording.participants = ', '.join(new_participants)+ speaker_names_used = new_participants+# Update speaker usage statisticsif speaker_names_used:update_speaker_usage(speaker_names_used)diff --git a/static/js/app.js b/static/js/app.jsindex ea879877..40197819 100644--- a/static/js/app.js+++ b/static/js/app.js@@ -66,6 +66,7 @@ document.addEventListener('DOMContentLoaded', () => {const isMobileUserMenuOpen = ref(false); // Mobile user icon dropdown menu stateconst windowWidth = ref(window.innerWidth); // For reactive screen sizeconst useAsrEndpoint = ref(false);+ const currentUserName = ref('');// --- Audio Recording State ---const isRecording = ref(false);@@ -173,14 +174,35 @@ document.addEventListener('DOMContentLoaded', () => {if (!selectedRecording.value?.transcription) {return [];}- // Match both [SPEAKER_XX] and [Name] patterns- const speakerRegex = /\[([^\]]+)\]:/g;- const speakers = new Set();- let match;- while ((match = speakerRegex.exec(selectedRecording.value.transcription)) !== null) {- speakers.add(match[1]);++ const transcription = selectedRecording.value.transcription;+ let transcriptionData;++ try {+ transcriptionData = JSON.parse(transcription);+ } catch (e) {+ transcriptionData = null;+ }++ if (transcriptionData && transcriptionData.segments) {+ // JSON format - extract speakers from segments+ const speakers = new Set();+ transcriptionData.segments.forEach(segment => {+ if (segment.speaker) {+ speakers.add(segment.speaker);+ }+ });+ return Array.from(speakers);+ } else {+ // Plain text format - use regex to find speaker patterns+ const speakerRegex = /\[([^\]]+)\]:/g;+ const speakers = new Set();+ let match;+ while ((match = speakerRegex.exec(transcription)) !== null) {+ speakers.add(match[1]);+ }+ return Array.from(speakers);}- return Array.from(speakers);});const processedTranscription = computed(() => {@@ -189,129 +211,157 @@ document.addEventListener('DOMContentLoaded', () => {}const transcription = selectedRecording.value.transcription;-- // Check if transcription has speaker labels- const speakerRegex = /\[([^\]]+)\]:\s*/g;- const hasDialogue = speakerRegex.test(transcription);-- if (!hasDialogue) {- return {- hasDialogue: false,- content: transcription,- speakers: [],- simpleSegments: [],- bubbleRows: []- };- }+ let transcriptionData;- // Reset regex for processing- speakerRegex.lastIndex = 0;-- // Extract speakers and assign colors- const speakers = new Set();- let match;- const tempTranscription = transcription;- while ((match = speakerRegex.exec(tempTranscription)) !== null) {- speakers.add(match[1]);+ try {+ transcriptionData = JSON.parse(transcription);+ } catch (e) {+ transcriptionData = null;}-- const speakerList = Array.from(speakers);- const speakerColors = {};- speakerList.forEach((speaker, index) => {- speakerColors[speaker] = `speaker-color-${(index % 8) + 1}`;- });- // Process transcription into dialogue segments- const segments = [];- const lines = transcription.split('\n');- let currentSpeaker = null;- let currentText = '';+ if (transcriptionData && transcriptionData.segments) {+ // JSON processing logic+ const speakerColors = {};+ const speakerList = Array.from(new Set(transcriptionData.segments.map(seg => seg.speaker)));+ speakerList.forEach((speaker, index) => {+ speakerColors[speaker] = `speaker-color-${(index % 8) + 1}`;+ });- for (const line of lines) {- const speakerMatch = line.match(/^\[([^\]]+)\]:\s*(.*)$/);-- if (speakerMatch) {- // Save previous segment if exists- if (currentSpeaker && currentText.trim()) {- segments.push({- speaker: currentSpeaker,- text: currentText.trim(),- color: speakerColors[currentSpeaker] || 'speaker-color-1'+ const simpleSegments = transcriptionData.segments.map(segment => ({+ speaker: (speakerMap.value[segment.speaker]?.name || segment.speaker),+ text: segment.text,+ words: segment.words.map((word, index) => ({+ ...word,+ // Add a click handler or data attribute for seeking+ 'data-start-time': word.start,+ // Add space after word unless it's the last word in the segment+ displayWord: word.word + (index < segment.words.length - 1 ? ' ' : '')+ })),+ color: speakerColors[segment.speaker] || 'speaker-color-1'+ }));++ // Process simple segments to add showSpeaker flag for proper display+ const processedSimpleSegments = [];+ let lastSpeaker = null;+ simpleSegments.forEach(segment => {+ processedSimpleSegments.push({+ ...segment,+ showSpeaker: segment.speaker !== lastSpeaker+ });+ lastSpeaker = segment.speaker;+ });++ const bubbleRows = [];+ let lastBubbleSpeaker = null;+ simpleSegments.forEach(segment => {+ if (segment.speaker !== lastBubbleSpeaker) {+ bubbleRows.push({+ speaker: segment.speaker,+ color: segment.color,+ isMe: segment.speaker && segment.speaker.toLowerCase().includes('me'),+ bubbles: []});+ lastBubbleSpeaker = segment.speaker;}-- // Start new segment- currentSpeaker = speakerMatch[1];- currentText = speakerMatch[2];- } else if (currentSpeaker && line.trim()) {- // Continue current speaker's text- currentText += ' ' + line.trim();- } else if (!currentSpeaker && line.trim()) {- // Text without speaker (shouldn't happen in dialogue, but handle gracefully)- segments.push({- speaker: null,- text: line.trim(),- color: 'speaker-color-1'+ bubbleRows[bubbleRows.length - 1].bubbles.push({+ text: segment.text,+ words: segment.words,+ color: segment.color});+ });++ return {+ hasDialogue: true,+ isJson: true,+ segments: simpleSegments,+ simpleSegments: processedSimpleSegments,+ bubbleRows: bubbleRows,+ speakers: speakerList.map(speaker => ({+ name: (speakerMap.value[speaker]?.name || speaker),+ color: speakerColors[speaker] || 'speaker-color-1'+ }))+ };++ } else {+ // Fallback for plain text transcription+ const speakerRegex = /\[([^\]]+)\]:\s*/g;+ const hasDialogue = speakerRegex.test(transcription);++ if (!hasDialogue) {+ return {+ hasDialogue: false,+ isJson: false,+ content: transcription,+ speakers: [],+ simpleSegments: [],+ bubbleRows: []+ };}- }- // Don't forget the last segment- if (currentSpeaker && currentText.trim()) {- segments.push({- speaker: currentSpeaker,- text: currentText.trim(),- color: speakerColors[currentSpeaker] || 'speaker-color-1'- });- }+ speakerRegex.lastIndex = 0;+ const speakers = new Set();+ let match;+ while ((match = speakerRegex.exec(transcription)) !== null) {+ speakers.add(match[1]);+ }- // Process segments for simple view (only show speaker icon when speaker changes)- const simpleSegments = [];- let lastSpeaker = null;-- segments.forEach(segment => {- simpleSegments.push({- ...segment,- showSpeaker: segment.speaker !== lastSpeaker+ const speakerList = Array.from(speakers);+ const speakerColors = {};+ speakerList.forEach((speaker, index) => {+ speakerColors[speaker] = `speaker-color-${(index % 8) + 1}`;});- lastSpeaker = segment.speaker;- });- // Process segments for bubble view (group consecutive segments by speaker)- const bubbleRows = [];- let currentRow = null;-- segments.forEach(segment => {- // Split long text into smaller chunks for better bubble layout- const maxChunkLength = 200; // Increased for better bundling- const chunks = [];-- if (segment.text.length <= maxChunkLength) {- chunks.push(segment.text);- } else {- // Split by sentences first, then by length if needed- const sentences = segment.text.split(/(?<=[.!?])\s+/);- let currentChunk = '';-- sentences.forEach(sentence => {- if (currentChunk.length + sentence.length <= maxChunkLength) {- currentChunk += (currentChunk ? ' ' : '') + sentence;- } else {- if (currentChunk) chunks.push(currentChunk);- currentChunk = sentence;+ const segments = [];+ const lines = transcription.split('\n');+ let currentSpeaker = null;+ let currentText = '';++ for (const line of lines) {+ const speakerMatch = line.match(/^\[([^\]]+)\]:\s*(.*)$/);+ if (speakerMatch) {+ if (currentSpeaker && currentText.trim()) {+ segments.push({+ speaker: currentSpeaker,+ text: currentText.trim(),+ color: speakerColors[currentSpeaker] || 'speaker-color-1'+ });}+ currentSpeaker = speakerMatch[1];+ currentText = speakerMatch[2];+ } else if (currentSpeaker && line.trim()) {+ currentText += ' ' + line.trim();+ } else if (!currentSpeaker && line.trim()) {+ segments.push({+ speaker: null,+ text: line.trim(),+ color: 'speaker-color-1'+ });+ }+ }++ if (currentSpeaker && currentText.trim()) {+ segments.push({+ speaker: currentSpeaker,+ text: currentText.trim(),+ color: speakerColors[currentSpeaker] || 'speaker-color-1'});-- if (currentChunk) chunks.push(currentChunk);}-- chunks.forEach((chunk, chunkIndex) => {- // Check if we need a new row (different speaker only)- // Remove the bubble count limit to allow better bundling++ const simpleSegments = [];+ let lastSpeaker = null;+ segments.forEach(segment => {+ simpleSegments.push({+ ...segment,+ showSpeaker: segment.speaker !== lastSpeaker+ });+ lastSpeaker = segment.speaker;+ });++ const bubbleRows = [];+ let currentRow = null;+ segments.forEach(segment => {if (!currentRow || currentRow.speaker !== segment.speaker) {-if (currentRow) bubbleRows.push(currentRow);-currentRow = {speaker: segment.speaker,color: segment.color,@@ -319,27 +369,25 @@ document.addEventListener('DOMContentLoaded', () => {isMe: segment.speaker && segment.speaker.toLowerCase().includes('me')};}-currentRow.bubbles.push({- text: chunk,+ text: segment.text,color: segment.color});});- });-- // Don't forget the last row- if (currentRow) bubbleRows.push(currentRow);-- return {- hasDialogue: true,- segments: segments,- simpleSegments: simpleSegments,- bubbleRows: bubbleRows,- speakers: speakerList.map(speaker => ({- name: speaker,- color: speakerColors[speaker] || 'speaker-color-1'- }))- };+ if (currentRow) bubbleRows.push(currentRow);++ return {+ hasDialogue: true,+ isJson: false,+ segments: segments,+ simpleSegments: simpleSegments,+ bubbleRows: bubbleRows,+ speakers: speakerList.map(speaker => ({+ name: speaker,+ color: speakerColors[speaker] || 'speaker-color-1'+ }))+ };+ }});const highlightedTranscript = computed(() => {@@ -1172,6 +1220,7 @@ document.addEventListener('DOMContentLoaded', () => {if (appDiv) {const asrFlag = appDiv.dataset.useAsrEndpoint;useAsrEndpoint.value = asrFlag === 'True' || asrFlag === 'true';+ currentUserName.value = appDiv.dataset.currentUserName || '';}loadRecordings();initializeDarkMode(); // Initialize dark mode on load@@ -1473,6 +1522,14 @@ document.addEventListener('DOMContentLoaded', () => {}}, { deep: true });+ watch(speakerMap, (newMap) => {+ for (const speakerId in newMap) {+ if (newMap[speakerId].isMe) {+ newMap[speakerId].name = currentUserName.value || 'Me';+ }+ }+ }, { deep: true });+// --- Reprocessing functionality ---const confirmReprocess = (type, recording) => {@@ -1643,15 +1700,22 @@ document.addEventListener('DOMContentLoaded', () => {const highlightSpeakerInTranscript = (speakerId) => {highlightedSpeaker.value = speakerId;- nextTick(() => {- const modalTranscript = document.querySelector('.speaker-modal-transcript');- if (modalTranscript) {- const firstInstance = modalTranscript.querySelector(`.speaker-tag[data-speaker-id="${speakerId}"]`);- if (firstInstance) {- firstInstance.scrollIntoView({ behavior: 'smooth', block: 'center' });+ // Scroll to the first instance in the transcript when a speaker is focused+ if (speakerId) {+ nextTick(() => {+ const modalTranscript = document.querySelector('div.speaker-modal-transcript');+ if (modalTranscript) {+ const firstInstance = modalTranscript.querySelector(`[data-speaker-id="${speakerId}"]`);+ if (firstInstance) {+ firstInstance.scrollIntoView({ behavior: 'smooth', block: 'center' });+ }}- }- });+ });+ }+ };++ const clearSpeakerHighlight = () => {+ highlightedSpeaker.value = null;};const autoIdentifySpeakers = async () => {@@ -2093,6 +2157,44 @@ document.addEventListener('DOMContentLoaded', () => {transcriptionViewMode.value = transcriptionViewMode.value === 'simple' ? 'bubble' : 'simple';};+ const seekAudio = (time, context = 'main') => {+ let audioPlayer = null;+ if (context === 'modal') {+ // The audio player in the modal has the class directly on the audio element+ audioPlayer = document.querySelector('audio.speaker-modal-transcript');+ } else {+ audioPlayer = document.querySelector('.main-content-area audio');+ }++ if (audioPlayer) {+ audioPlayer.currentTime = time;+ audioPlayer.play();+ } else {+ console.warn(`Audio player not found for context: ${context}`);+ // Fallback to old method if new one fails+ const oldPlayer = document.querySelector('audio');+ if(oldPlayer) {+ oldPlayer.currentTime = time;+ oldPlayer.play();+ }+ }+ };++ const seekAudioFromEvent = (event) => {+ const wordSpan = event.target.closest('[data-start-time]');+ if (!wordSpan) return;++ const time = parseFloat(wordSpan.dataset.startTime);+ if (isNaN(time)) return;++ // Determine context by checking if we're inside the speaker modal+ // The speaker modal has a specific structure with showSpeakerModal condition+ const isInSpeakerModal = event.target.closest('.speaker-modal-transcript') !== null;+ const context = isInSpeakerModal ? 'modal' : 'main';++ seekAudio(time, context);+ };+return {// StatecurrentView, dragover, recordings, selectedRecording, // currentRecording removed@@ -2161,7 +2263,9 @@ document.addEventListener('DOMContentLoaded', () => {closeSpeakerModal,saveSpeakerNames,highlightedTranscript,+ highlightedSpeaker,highlightSpeakerInTranscript,+ clearSpeakerHighlight,useAsrEndpoint,// Mobile tabsselectedMobileTab,@@ -2178,7 +2282,9 @@ document.addEventListener('DOMContentLoaded', () => {autoIdentifySpeakers,isAutoIdentifying,// Main column resizer refs (not needed in template but good practice if they were)- // leftMainColumn, rightMainColumn, mainColumnResizer, mainContentColumns+ // leftMainColumn, rightMainColumn, mainColumnResizer, mainContentColumns,+ seekAudio,+ seekAudioFromEvent}},delimiters: ['${', '}'] // Keep Vue delimiters distinct from Flask's Jinjadiff --git a/templates/index.html b/templates/index.htmlindex 25f4ee12..318d91c5 100644--- a/templates/index.html+++ b/templates/index.html@@ -18,7 +18,8 @@id="app"class="container mx-auto px-4 sm:px-6 lg:px-8 py-6 flex flex-col":class="{ 'use-asr-endpoint': useAsrEndpoint }"- data-use-asr-endpoint="{{ use_asr_endpoint }}">+ data-use-asr-endpoint="{{ use_asr_endpoint }}"+ data-current-user-name="{{ current_user.name or '' }}"><header class="flex justify-between items-center mb-6 pb-4 border-b border-[var(--border-primary)]"><h1 class="text-3xl font-bold text-[var(--text-primary)] cursor-pointer flex items-center" @click="switchToGalleryView" title="Go to Gallery"><img src="{{ url_for('static', filename='img/favicon.svg') }}" alt="Speakr Logo" class="h-9 w-9 mr-2">@@ -263,7 +264,7 @@</span></div><label class="flex items-center text-sm text-[var(--text-muted)]">- <input type="checkbox" v-model="speakerMap[speaker].isMe" @focus="highlightSpeakerInTranscript(speaker)" class="h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500">+ <input type="checkbox" v-model="speakerMap[speaker].isMe" @focus="highlightSpeakerInTranscript(speaker)" @blur="clearSpeakerHighlight" class="h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500"><span class="ml-2">Me</span></label></div>@@ -275,7 +276,7 @@v-model="speakerMap[speaker].name"@input="searchSpeakers($event.target.value, speaker)"@focus="highlightSpeakerInTranscript(speaker)"- @blur="setTimeout(() => speakerSuggestions[speaker] = [], 200)"+ @blur="clearSpeakerHighlight(); setTimeout(() => speakerSuggestions[speaker] = [], 200)":disabled="speakerMap[speaker].isMe"class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md shadow-sm focus:outline-none focus:ring-[var(--border-focus)] focus:border-[var(--border-focus)] sm:text-sm bg-[var(--bg-input)] text-[var(--text-primary)] disabled:bg-[var(--bg-tertiary)] disabled:text-[var(--text-muted)] disabled:cursor-not-allowed":placeholder="speakerMap[speaker].isMe ? 'Me' : 'Enter name for ' + speaker"@@ -315,14 +316,27 @@<div class="mb-4 flex-shrink-0"><h4 class="font-semibold text-[var(--text-secondary)] mb-2">Audio Player</h4><div class="bg-[var(--bg-audio-player)] p-3 rounded-lg shadow border border-[var(--border-primary)]">- <audio controls class="w-full h-10" :key="selectedRecording.id" :src="'/audio/' + selectedRecording.id">+ <audio controls class="w-full h-10 speaker-modal-transcript" :key="selectedRecording.id" :src="'/audio/' + selectedRecording.id">Your browser does not support the audio element.</audio></div></div><!-- Transcript Section -->- <div class="flex-grow overflow-y-auto custom-scrollbar speaker-modal-transcript" v-html="highlightedTranscript">+ <div class="flex-grow overflow-y-auto custom-scrollbar speaker-modal-transcript">+ <div v-if="processedTranscription.isJson">+ <div v-for="(segment, index) in processedTranscription.simpleSegments" :key="index" class="speaker-segment mb-2">+ <div v-if="segment.showSpeaker"+ :class="[segment.color, 'speaker-tablet', 'font-semibold', 'mb-1', { 'speaker-highlight': highlightedSpeaker === segment.speaker }]"+ :data-speaker-id="segment.speaker">+ ${ segment.speaker }+ </div>+ <div class="speaker-text" @click="seekAudioFromEvent">+ <span v-for="word in segment.words" :key="word.start" class="word cursor-pointer hover:bg-[var(--bg-accent)] hover:text-[var(--text-accent)] rounded px-0.5" :data-start-time="word.start">${ word.displayWord }</span>+ </div>+ </div>+ </div>+ <div v-else v-html="highlightedTranscript" @click="seekAudioFromEvent"></div></div></div></div>@@ -523,17 +537,26 @@<!-- Transcription Content --><div v-if="processedTranscription.hasDialogue"><!-- Simple View -->- <div v-if="transcriptionViewMode === 'simple'" class="transcription-simple-view">+ <div v-if="transcriptionViewMode === 'simple'" class="transcription-simple-view" @click="seekAudioFromEvent"><div v-for="(segment, index) in processedTranscription.simpleSegments" :key="index" class="speaker-segment"><div v-if="segment.showSpeaker" :class="[segment.color, 'speaker-tablet']">${ segment.speaker }</div>- <div class="speaker-text">${ segment.text }</div>+ <div class="speaker-text">+ <span v-if="processedTranscription.isJson" v-for="word in segment.words" :key="word.start" class="word" :data-start-time="word.start">${ word.displayWord }</span>+ <span v-else>${ segment.text }</span>+ </div></div></div><!-- Bubble View -->- <div v-else class="transcription-with-speakers">- <div v-for="(segment, index) in processedTranscription.segments" :key="index"- :class="[segment.color, 'speaker-bubble', { 'speaker-me': segment.speaker && segment.speaker.toLowerCase().includes('me') }]">- <div class="speaker-bubble-content">${ segment.text }</div>+ <div v-else class="transcription-with-speakers" @click="seekAudioFromEvent">+ <div v-for="(row, index) in processedTranscription.bubbleRows" :key="index"+ :class="['bubble-row', { 'speaker-me': row.isMe }]">+ <div v-for="(bubble, bubbleIndex) in row.bubbles" :key="bubbleIndex"+ :class="[row.color, 'speaker-bubble', { 'speaker-me': row.isMe }]">+ <div class="speaker-bubble-content">+ <span v-if="processedTranscription.isJson" v-for="word in bubble.words" :key="word.start" class="word" :data-start-time="word.start">${ word.displayWord }</span>+ <span v-else>${ bubble.text }</span>+ </div>+ </div></div></div></div>@@ -961,21 +984,27 @@</div><!-- Transcription Content -->- <div v-if="processedTranscription.hasDialogue">+ <div v-if="processedTranscription.hasDialogue" @click="seekAudioFromEvent"><!-- Simple View --><div v-if="transcriptionViewMode === 'simple'" class="transcription-simple-view"><div v-for="(segment, index) in processedTranscription.simpleSegments" :key="index" class="speaker-segment"><div v-if="segment.showSpeaker" :class="[segment.color, 'speaker-tablet']">${ segment.speaker }</div>- <div class="speaker-text">${ segment.text }</div>+ <div class="speaker-text">+ <span v-if="processedTranscription.isJson" v-for="word in segment.words" :key="word.start" class="word" :data-start-time="word.start">${ word.displayWord }</span>+ <span v-else>${ segment.text }</span>+ </div></div></div><!-- Bubble View --><div v-else class="transcription-with-speakers">- <div v-for="(row, index) in processedTranscription.bubbleRows" :key="index"+ <div v-for="(row, index) in processedTranscription.bubbleRows" :key="index":class="['bubble-row', { 'speaker-me': row.isMe }]">- <div v-for="(bubble, bubbleIndex) in row.bubbles" :key="bubbleIndex"+ <div v-for="(bubble, bubbleIndex) in row.bubbles" :key="bubbleIndex":class="[row.color, 'speaker-bubble', { 'speaker-me': row.isMe }]">- <div class="speaker-bubble-content">${ bubble.text }</div>+ <div class="speaker-bubble-content">+ <span v-if="processedTranscription.isJson" v-for="word in bubble.words" :key="word.start" class="word" :data-start-time="word.start">${ word.displayWord }</span>+ <span v-else>${ bubble.text }</span>+ </div></div></div></div>