Skip to content

Speakr is a personal, self-hosted web application designed for transcribing audio recordings

Python

Add speaker filtering and fix filter AND logic

Murtaza Nasir07298015c674
diff --git a/src/api/recordings.py b/src/api/recordings.py
index 78952994..b004498a 100644
--- a/src/api/recordings.py
+++ b/src/api/recordings.py
@@ -1331,6 +1331,8 @@ def get_recordings_paginated():
page = request.args.get('page', 1, type=int)
per_page = min(request.args.get('per_page', 25, type=int), 100) # Cap at 100 per page
search_query = request.args.get('q', '').strip()
+ show_archived = request.args.get('archived', '').lower() == 'true'
+ show_shared = request.args.get('shared', '').lower() == 'true'
# Get all accessible recording IDs (own + shared)
accessible_recording_ids = get_accessible_recording_ids(current_user.id)
@@ -1351,6 +1353,16 @@ def get_recordings_paginated():
# Build base query to include accessible recordings
stmt = select(Recording).where(Recording.id.in_(accessible_recording_ids))
+ # Apply archived filter (AND with other filters)
+ if show_archived:
+ # Only show recordings where audio has been deleted
+ stmt = stmt.where(Recording.audio_deleted_at.is_not(None))
+
+ # Apply shared filter (AND with other filters)
+ if show_shared:
+ # Only show recordings shared with current user (not owned by them)
+ stmt = stmt.where(Recording.user_id != current_user.id)
+
# Apply search filters if provided
if search_query:
# Extract date filters
@@ -1358,12 +1370,14 @@ def get_recordings_paginated():
date_from_filters = re.findall(r'date_from:(\S+)', search_query.lower())
date_to_filters = re.findall(r'date_to:(\S+)', search_query.lower())
tag_filters = re.findall(r'tag:(\S+)', search_query.lower())
+ speaker_filters = re.findall(r'speaker:(\S+)', search_query.lower())
# Remove special syntax to get text search
text_query = re.sub(r'date:\S+', '', search_query, flags=re.IGNORECASE)
text_query = re.sub(r'date_from:\S+', '', text_query, flags=re.IGNORECASE)
text_query = re.sub(r'date_to:\S+', '', text_query, flags=re.IGNORECASE)
- text_query = re.sub(r'tag:\S+', '', text_query, flags=re.IGNORECASE).strip()
+ text_query = re.sub(r'tag:\S+', '', text_query, flags=re.IGNORECASE)
+ text_query = re.sub(r'speaker:\S+', '', text_query, flags=re.IGNORECASE).strip()
# Apply date filters
for date_filter in date_filters:
@@ -1531,6 +1545,15 @@ def get_recordings_paginated():
stmt = stmt.join(RecordingTag).join(Tag).where(db.or_(*tag_conditions))
+ # Apply speaker filters
+ if speaker_filters:
+ speaker_conditions = []
+ for speaker_filter in speaker_filters:
+ # Replace underscores back to spaces for matching
+ speaker_name = speaker_filter.replace('_', ' ')
+ speaker_conditions.append(Recording.participants.ilike(f'%{speaker_name}%'))
+ stmt = stmt.where(db.or_(*speaker_conditions))
+
# Apply text search
if text_query:
from src.models.sharing import SharedRecordingState
diff --git a/static/js/app.modular.js b/static/js/app.modular.js
index 2302af37..05993b89 100644
--- a/static/js/app.modular.js
+++ b/static/js/app.modular.js
@@ -85,6 +85,9 @@ document.addEventListener('DOMContentLoaded', async () => {
// Advanced filter state
const showAdvancedFilters = ref(false);
const filterTags = ref([]);
+ const filterSpeakers = ref([]);
+ const filterTagSearch = ref('');
+ const filterSpeakerSearch = ref('');
const filterDateRange = ref({ start: '', end: '' });
const filterDatePreset = ref('');
const filterTextQuery = ref('');
@@ -407,7 +410,8 @@ document.addEventListener('DOMContentLoaded', async () => {
isLoadingRecordings, globalError, csrfToken,
// Filters
- showAdvancedFilters, filterTags, filterDateRange, filterDatePreset, filterTextQuery,
+ showAdvancedFilters, filterTags, filterSpeakers, filterTagSearch, filterSpeakerSearch,
+ filterDateRange, filterDatePreset, filterTextQuery,
showArchivedRecordings, showSharedWithMe, sortBy, selectedTagFilter,
// Pagination
@@ -997,6 +1001,24 @@ document.addEventListener('DOMContentLoaded', async () => {
);
});
+ // Filtered tags for sidebar filter (searches by name)
+ const filteredTagsForFilter = computed(() => {
+ if (!filterTagSearch.value) return availableTags.value;
+ const search = filterTagSearch.value.toLowerCase();
+ return availableTags.value.filter(tag =>
+ tag.name.toLowerCase().includes(search)
+ );
+ });
+
+ // Filtered speakers for sidebar filter (searches by name)
+ const filteredSpeakersForFilter = computed(() => {
+ if (!filterSpeakerSearch.value) return availableSpeakers.value;
+ const search = filterSpeakerSearch.value.toLowerCase();
+ return availableSpeakers.value.filter(speaker =>
+ speaker.name.toLowerCase().includes(search)
+ );
+ });
+
const selectedTags = computed(() => {
return selectedTagIds.value.map(id =>
availableTags.value.find(t => t.id === id)
@@ -1567,6 +1589,10 @@ document.addEventListener('DOMContentLoaded', async () => {
recordingsComposable.applyAdvancedFilters();
}, { deep: true });
+ watch(filterSpeakers, () => {
+ recordingsComposable.applyAdvancedFilters();
+ }, { deep: true });
+
watch(filterDatePreset, () => {
recordingsComposable.applyAdvancedFilters();
});
@@ -1582,7 +1608,10 @@ document.addEventListener('DOMContentLoaded', async () => {
}, 300);
});
- watch(showArchivedRecordings, () => {
+ watch(showArchivedRecordings, (newValue, oldValue) => {
+ // Prevent unnecessary reloads when being set by the other watcher
+ if (newValue === oldValue) return;
+
// Reload recordings when switching between archived/normal view
if (showArchivedRecordings.value) {
showSharedWithMe.value = false; // Can't show both at once
@@ -1590,7 +1619,10 @@ document.addEventListener('DOMContentLoaded', async () => {
recordingsComposable.loadRecordings(1, false, searchQuery.value);
});
- watch(showSharedWithMe, () => {
+ watch(showSharedWithMe, (newValue, oldValue) => {
+ // Prevent unnecessary reloads when being set by the other watcher
+ if (newValue === oldValue) return;
+
// Reload recordings when switching to/from shared view
if (showSharedWithMe.value) {
showArchivedRecordings.value = false; // Can't show both at once
@@ -1682,7 +1714,8 @@ document.addEventListener('DOMContentLoaded', async () => {
// Load initial data
await Promise.all([
recordingsComposable.loadRecordings(),
- recordingsComposable.loadTags()
+ recordingsComposable.loadTags(),
+ recordingsComposable.loadSpeakers()
]);
// Load config
@@ -1823,6 +1856,8 @@ document.addEventListener('DOMContentLoaded', async () => {
processedTranscription,
groupedRecordings,
filteredAvailableTags,
+ filteredTagsForFilter,
+ filteredSpeakersForFilter,
selectedTags,
colorSchemes,
dropdownPositions,
diff --git a/static/js/modules/composables/recordings.js b/static/js/modules/composables/recordings.js
index 504323da..38c7bd6d 100644
--- a/static/js/modules/composables/recordings.js
+++ b/static/js/modules/composables/recordings.js
@@ -8,8 +8,8 @@ export function useRecordings(state, utils, reprocessComposable) {
recordings, selectedRecording, isLoadingRecordings, isLoadingMore,
currentPage, perPage, totalRecordings, totalPages, hasNextPage, hasPrevPage,
showSharedWithMe, showArchivedRecordings, searchQuery, searchDebounceTimer,
- filterTags, filterDatePreset, filterDateRange, filterTextQuery,
- availableTags, selectedTagIds, uploadLanguage, uploadMinSpeakers, uploadMaxSpeakers,
+ filterTags, filterSpeakers, filterDatePreset, filterDateRange, filterTextQuery,
+ availableTags, availableSpeakers, selectedTagIds, uploadLanguage, uploadMinSpeakers, uploadMaxSpeakers,
useAsrEndpoint, globalError, uploadQueue, isProcessingActive, currentView,
isMobileScreen, isSidebarCollapsed, isRecording, audioBlobURL
} = state;
@@ -26,12 +26,7 @@ export function useRecordings(state, utils, reprocessComposable) {
}
try {
- let endpoint = '/api/recordings';
- if (showArchivedRecordings.value) {
- endpoint = '/api/recordings/archived';
- } else if (showSharedWithMe.value) {
- endpoint = '/api/recordings/shared-with-me';
- }
+ const endpoint = '/api/recordings';
const params = new URLSearchParams({
page: page.toString(),
@@ -42,12 +37,20 @@ export function useRecordings(state, utils, reprocessComposable) {
params.set('q', searchQueryParam.trim());
}
+ // Add archived/shared filters as query params (ANDed with other filters)
+ if (showArchivedRecordings.value) {
+ params.set('archived', 'true');
+ }
+ if (showSharedWithMe.value) {
+ params.set('shared', 'true');
+ }
+
const response = await fetch(`${endpoint}?${params}`);
const data = await response.json();
if (!response.ok) throw new Error(data.error || 'Failed to load recordings');
- const recordingsList = (showArchivedRecordings.value || showSharedWithMe.value) ? data : data.recordings;
- const pagination = (showArchivedRecordings.value || showSharedWithMe.value) ? null : data.pagination;
+ const recordingsList = data.recordings;
+ const pagination = data.pagination;
if (!Array.isArray(recordingsList)) {
console.error('Unexpected response format:', data);
@@ -68,7 +71,7 @@ export function useRecordings(state, utils, reprocessComposable) {
hasPrevPage.value = false;
}
- if (append && !showArchivedRecordings.value) {
+ if (append) {
recordings.value = [...recordings.value, ...recordingsList];
} else {
recordings.value = recordingsList;
@@ -131,6 +134,20 @@ export function useRecordings(state, utils, reprocessComposable) {
}
};
+ const loadSpeakers = async () => {
+ try {
+ const response = await fetch('/speakers');
+ if (response.ok) {
+ availableSpeakers.value = await response.json();
+ } else {
+ availableSpeakers.value = [];
+ }
+ } catch (error) {
+ console.warn('Error loading speakers:', error);
+ availableSpeakers.value = [];
+ }
+ };
+
const selectRecording = async (recording) => {
if (hasUnsavedRecording()) {
if (!confirm('You have an unsaved recording. Are you sure you want to leave?')) {
@@ -274,6 +291,13 @@ export function useRecordings(state, utils, reprocessComposable) {
query.push(...tagNames);
}
+ if (filterSpeakers.value.length > 0) {
+ const speakerNames = filterSpeakers.value.map(name =>
+ `speaker:${name.replace(/\s+/g, '_')}`
+ );
+ query.push(...speakerNames);
+ }
+
if (filterDatePreset.value) {
query.push(`date:${filterDatePreset.value}`);
} else if (filterDateRange.value.start || filterDateRange.value.end) {
@@ -294,6 +318,7 @@ export function useRecordings(state, utils, reprocessComposable) {
const clearAllFilters = () => {
filterTags.value = [];
+ filterSpeakers.value = [];
filterDateRange.value = { start: '', end: '' };
filterDatePreset.value = '';
filterTextQuery.value = '';
@@ -357,6 +382,7 @@ export function useRecordings(state, utils, reprocessComposable) {
performSearch,
debouncedSearch,
loadTags,
+ loadSpeakers,
selectRecording,
hasUnsavedRecording,
toggleInbox,
diff --git a/static/js/modules/composables/transcription.js b/static/js/modules/composables/transcription.js
index f594918b..09dba56e 100644
--- a/static/js/modules/composables/transcription.js
+++ b/static/js/modules/composables/transcription.js
@@ -106,7 +106,7 @@ export function useTranscription(state, utils) {
}
};
- const filterSpeakers = (index) => {
+ const filterSpeakerSuggestions = (index) => {
const segment = editingSegments.value[index];
if (segment) {
const query = segment.speaker?.toLowerCase() || '';
@@ -128,7 +128,7 @@ export function useTranscription(state, utils) {
});
editingSegments.value[index].showSuggestions = true;
- filterSpeakers(index);
+ filterSpeakerSuggestions(index);
updateDropdownPosition(index);
}
};
@@ -413,7 +413,7 @@ export function useTranscription(state, utils) {
// Segment management
adjustTime,
- filterSpeakers,
+ filterSpeakerSuggestions,
openSpeakerSuggestions,
closeSpeakerSuggestions,
closeAllSpeakerSuggestions,
diff --git a/static/js/modules/state/core.js b/static/js/modules/state/core.js
index 407501f1..f7f4468f 100644
--- a/static/js/modules/state/core.js
+++ b/static/js/modules/state/core.js
@@ -30,6 +30,7 @@ export function createCoreState(ref, computed) {
// Advanced filter state
const showAdvancedFilters = ref(false);
const filterTags = ref([]);
+ const filterSpeakers = ref([]); // Array of speaker names for filtering
const filterDateRange = ref({ start: '', end: '' });
const filterDatePreset = ref('');
const filterTextQuery = ref('');
@@ -49,6 +50,9 @@ export function createCoreState(ref, computed) {
const selectedTagIds = ref([]);
const uploadTagSearchFilter = ref('');
+ // Speaker Selection
+ const availableSpeakers = ref([]);
+
const selectedTags = computed(() => {
return selectedTagIds.value.map(tagId =>
availableTags.value.find(tag => tag.id == tagId)
@@ -103,6 +107,7 @@ export function createCoreState(ref, computed) {
selectedTagFilter,
showAdvancedFilters,
filterTags,
+ filterSpeakers,
filterDateRange,
filterDatePreset,
filterTextQuery,
@@ -123,6 +128,9 @@ export function createCoreState(ref, computed) {
uploadTagSearchFilter,
selectedTags,
filteredAvailableTagsForUpload,
- filteredRecordings
+ filteredRecordings,
+
+ // Speakers
+ availableSpeakers
};
}
diff --git a/static/locales/de.json b/static/locales/de.json
index d0462f96..95d8a227 100644
--- a/static/locales/de.json
+++ b/static/locales/de.json
@@ -904,7 +904,9 @@
"manageAllTags": "Alle Tags verwalten",
"noAvailableTags": "Keine verfügbaren Tags",
"noTags": "Keine Tags",
+ "noMatchingTags": "Keine passenden Tags",
"removeTag": "Tag entfernen",
+ "searchTags": "Suchen...",
"tagColor": "Tag-Farbe",
"tagName": "Tag-Name",
"title": "Tags"
@@ -916,6 +918,11 @@
"noTagsAssigned": "Dieser Aufnahme sind keine Tags zugewiesen",
"searchTags": "Tags suchen..."
},
+ "speakers": {
+ "filterBySpeaker": "Nach Sprecher filtern",
+ "searchSpeakers": "Suchen...",
+ "noMatchingSpeakers": "Keine passenden Sprecher"
+ },
"groups": {
"title": "Gruppenverwaltung",
"createTeam": "Team erstellen",
diff --git a/static/locales/en.json b/static/locales/en.json
index 4baa60d6..a160bc46 100644
--- a/static/locales/en.json
+++ b/static/locales/en.json
@@ -930,7 +930,9 @@
"manageAllTags": "Manage All Tags",
"noAvailableTags": "No available tags",
"noTags": "No tags",
+ "noMatchingTags": "No matching tags",
"removeTag": "Remove Tag",
+ "searchTags": "Search...",
"tagColor": "Tag Color",
"tagName": "Tag Name",
"title": "Tags"
@@ -942,6 +944,11 @@
"noTagsAssigned": "No tags assigned to this recording",
"searchTags": "Search tags..."
},
+ "speakers": {
+ "filterBySpeaker": "Filter by speaker",
+ "searchSpeakers": "Search...",
+ "noMatchingSpeakers": "No matching speakers"
+ },
"groups": {
"title": "Group Management",
"createTeam": "Create Group",
diff --git a/static/locales/es.json b/static/locales/es.json
index 66f08198..179d67ba 100644
--- a/static/locales/es.json
+++ b/static/locales/es.json
@@ -910,7 +910,9 @@
"manageAllTags": "Gestionar Todas las Etiquetas",
"noAvailableTags": "No hay etiquetas disponibles",
"noTags": "Sin etiquetas",
+ "noMatchingTags": "No hay etiquetas coincidentes",
"removeTag": "Eliminar Etiqueta",
+ "searchTags": "Buscar...",
"tagColor": "Color de Etiqueta",
"tagName": "Nombre de Etiqueta",
"title": "Etiquetas"
@@ -922,6 +924,11 @@
"noTagsAssigned": "No hay etiquetas asignadas a esta grabación",
"searchTags": "Buscar etiquetas..."
},
+ "speakers": {
+ "filterBySpeaker": "Filtrar por orador",
+ "searchSpeakers": "Buscar...",
+ "noMatchingSpeakers": "No hay oradores coincidentes"
+ },
"groups": {
"title": "Gestión de Grupos",
"createTeam": "Crear Equipo",
diff --git a/static/locales/fr.json b/static/locales/fr.json
index a28779b7..62b78367 100644
--- a/static/locales/fr.json
+++ b/static/locales/fr.json
@@ -904,7 +904,9 @@
"manageAllTags": "Gérer Toutes les Étiquettes",
"noAvailableTags": "Aucune étiquette disponible",
"noTags": "Aucune étiquette",
+ "noMatchingTags": "Aucune étiquette correspondante",
"removeTag": "Supprimer l'Étiquette",
+ "searchTags": "Rechercher...",
"tagColor": "Couleur de l'Étiquette",
"tagName": "Nom de l'Étiquette",
"title": "Étiquettes"
@@ -916,6 +918,11 @@
"noTagsAssigned": "Aucune étiquette assignée à cet enregistrement",
"searchTags": "Rechercher des étiquettes..."
},
+ "speakers": {
+ "filterBySpeaker": "Filtrer par intervenant",
+ "searchSpeakers": "Rechercher...",
+ "noMatchingSpeakers": "Aucun intervenant correspondant"
+ },
"groups": {
"title": "Gestion de Groupe",
"createTeam": "Créer une Équipe",
diff --git a/static/locales/zh.json b/static/locales/zh.json
index e65e43c7..30c5b29d 100644
--- a/static/locales/zh.json
+++ b/static/locales/zh.json
@@ -1035,7 +1035,9 @@
"manageAllTags": "管理所有标签",
"noAvailableTags": "没有可用标签",
"noTags": "无标签",
+ "noMatchingTags": "没有匹配的标签",
"removeTag": "删除标签",
+ "searchTags": "搜索...",
"tagColor": "标签颜色",
"tagName": "标签名称",
"title": "标签"
@@ -1047,6 +1049,11 @@
"noTagsAssigned": "此录音未分配标签",
"searchTags": "搜索标签..."
},
+ "speakers": {
+ "filterBySpeaker": "按发言人筛选",
+ "searchSpeakers": "搜索...",
+ "noMatchingSpeakers": "没有匹配的发言人"
+ },
"groups": {
"title": "群组管理",
"createTeam": "创建团队",
diff --git a/templates/components/sidebar.html b/templates/components/sidebar.html
index 95335690..5648d58a 100644
--- a/templates/components/sidebar.html
+++ b/templates/components/sidebar.html
@@ -33,16 +33,16 @@
class="flex-1 flex items-center justify-between px-3 py-2 bg-[var(--bg-input)] border border-[var(--border-secondary)] rounded-lg text-sm hover:bg-[var(--bg-tertiary)] transition-colors">
<span class="flex items-center">
<i class="fas fa-filter mr-2 text-[var(--text-muted)]"></i>
- <span v-if="!searchQuery && filterTags.length === 0 && !filterDatePreset && !filterDateRange.start && !filterDateRange.end && !filterTextQuery"
+ <span v-if="!searchQuery && filterTags.length === 0 && filterSpeakers.length === 0 && !filterDatePreset && !filterDateRange.start && !filterDateRange.end && !filterTextQuery"
v-text="t('sidebar.searchRecordings')">
</span>
<span v-else class="text-[var(--text-accent)]">
- Active filters (${ (filterTags.length > 0 ? 1 : 0) + (filterDatePreset || filterDateRange.start || filterDateRange.end ? 1 : 0) + (filterTextQuery ? 1 : 0) })
+ Active filters (${ (filterTags.length > 0 ? 1 : 0) + (filterSpeakers.length > 0 ? 1 : 0) + (filterDatePreset || filterDateRange.start || filterDateRange.end ? 1 : 0) + (filterTextQuery ? 1 : 0) })
</span>
</span>
<i :class="['fas fa-chevron-down transition-transform text-[var(--text-muted)]', showAdvancedFilters ? 'rotate-180' : '']"></i>
</button>
- <button v-if="searchQuery || filterTags.length > 0 || filterDatePreset || filterDateRange.start || filterDateRange.end || filterTextQuery"
+ <button v-if="searchQuery || filterTags.length > 0 || filterSpeakers.length > 0 || filterDatePreset || filterDateRange.start || filterDateRange.end || filterTextQuery"
@click="clearAllFilters"
class="px-3 py-2 bg-[var(--bg-input)] border border-[var(--border-secondary)] rounded-lg text-sm hover:bg-[var(--bg-tertiary)] hover:text-[var(--text-primary)] transition-colors"
:title="t('buttons.clearAllFilters')">
@@ -71,23 +71,66 @@
</div>
<!-- Tag Filter -->
- <div>
- <label class="block text-xs font-medium text-[var(--text-muted)] mb-1" v-text="t('tags.filterByTag')"></label>
- <div class="flex flex-wrap gap-1.5">
- <button v-for="tag in availableTags"
- :key="tag.id"
- @click="filterTags.includes(tag.id) ? filterTags = filterTags.filter(id => id !== tag.id) : filterTags.push(tag.id)"
- :class="[
- 'px-2 py-1 rounded-full text-xs font-medium transition-all',
- filterTags.includes(tag.id)
- ? 'bg-[var(--bg-accent)] text-[var(--text-accent)] ring-1 ring-[var(--border-accent)]'
- : 'bg-[var(--bg-secondary)] text-[var(--text-secondary)] hover:bg-[var(--bg-input)]'
- ]">
- <span class="inline-block w-2 h-2 rounded-full mr-1" :style="{ backgroundColor: tag.color || '#6B7280' }"></span>
- ${ tag.name }
- </button>
+ <div class="bg-[var(--bg-secondary)] rounded-lg p-2.5 border border-[var(--border-primary)]">
+ <div class="flex items-center justify-between gap-2 mb-2">
+ <label class="text-xs font-medium text-[var(--text-muted)] whitespace-nowrap" v-text="t('tags.filterByTag')"></label>
+ <div class="relative flex-1 max-w-[140px]" v-if="availableTags.length > 5">
+ <input v-model="filterTagSearch"
+ type="text"
+ :placeholder="t('tags.searchTags')"
+ class="w-full px-2 py-1 pl-7 bg-[var(--bg-input)] border border-[var(--border-secondary)] rounded text-xs focus:outline-none focus:ring-1 focus:ring-[var(--ring-focus)]">
+ <i class="fas fa-search absolute left-2 top-1/2 transform -translate-y-1/2 text-[var(--text-muted)]" style="font-size: 10px;"></i>
+ </div>
+ </div>
+ <div class="max-h-24 overflow-y-auto scrollbar-thin pr-1">
+ <div class="flex flex-wrap gap-1.5">
+ <button v-for="tag in filteredTagsForFilter"
+ :key="tag.id"
+ @click="filterTags.includes(tag.id) ? filterTags = filterTags.filter(id => id !== tag.id) : filterTags.push(tag.id)"
+ :class="[
+ 'px-2 py-1 rounded-full text-xs font-medium transition-all',
+ filterTags.includes(tag.id)
+ ? 'bg-[var(--bg-accent)] text-[var(--text-accent)] ring-1 ring-[var(--border-accent)]'
+ : 'bg-[var(--bg-input)] text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)]'
+ ]">
+ <span class="inline-block w-2 h-2 rounded-full mr-1" :style="{ backgroundColor: tag.color || '#6B7280' }"></span>
+ ${ tag.name }
+ </button>
+ </div>
</div>
<p v-if="availableTags.length === 0" class="text-xs text-[var(--text-muted)] italic" v-text="t('tags.noTags')"></p>
+ <p v-else-if="filteredTagsForFilter.length === 0" class="text-xs text-[var(--text-muted)] italic py-1" v-text="t('tags.noMatchingTags')"></p>
+ </div>
+
+ <!-- Speaker Filter -->
+ <div v-if="availableSpeakers.length > 0" class="bg-[var(--bg-secondary)] rounded-lg p-2.5 border border-[var(--border-primary)]">
+ <div class="flex items-center justify-between gap-2 mb-2">
+ <label class="text-xs font-medium text-[var(--text-muted)] whitespace-nowrap" v-text="t('speakers.filterBySpeaker')"></label>
+ <div class="relative flex-1 max-w-[140px]" v-if="availableSpeakers.length > 5">
+ <input v-model="filterSpeakerSearch"
+ type="text"
+ :placeholder="t('speakers.searchSpeakers')"
+ class="w-full px-2 py-1 pl-7 bg-[var(--bg-input)] border border-[var(--border-secondary)] rounded text-xs focus:outline-none focus:ring-1 focus:ring-[var(--ring-focus)]">
+ <i class="fas fa-search absolute left-2 top-1/2 transform -translate-y-1/2 text-[var(--text-muted)]" style="font-size: 10px;"></i>
+ </div>
+ </div>
+ <div class="max-h-24 overflow-y-auto scrollbar-thin pr-1">
+ <div class="flex flex-wrap gap-1.5">
+ <button v-for="speaker in filteredSpeakersForFilter"
+ :key="speaker.id"
+ @click="filterSpeakers.includes(speaker.name) ? filterSpeakers = filterSpeakers.filter(n => n !== speaker.name) : filterSpeakers.push(speaker.name)"
+ :class="[
+ 'px-2 py-1 rounded-full text-xs font-medium transition-all',
+ filterSpeakers.includes(speaker.name)
+ ? 'bg-[var(--bg-accent)] text-[var(--text-accent)] ring-1 ring-[var(--border-accent)]'
+ : 'bg-[var(--bg-input)] text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)]'
+ ]">
+ <i class="fas fa-user mr-1" style="font-size: 9px;"></i>
+ ${ speaker.name }
+ </button>
+ </div>
+ </div>
+ <p v-if="filteredSpeakersForFilter.length === 0 && filterSpeakerSearch" class="text-xs text-[var(--text-muted)] italic py-1" v-text="t('speakers.noMatchingSpeakers')"></p>
</div>
<!-- Date Filter -->
diff --git a/templates/modals/asr-editor-modal.html b/templates/modals/asr-editor-modal.html
index c64ecd5d..c42a66a3 100644
--- a/templates/modals/asr-editor-modal.html
+++ b/templates/modals/asr-editor-modal.html
@@ -40,7 +40,7 @@
<div class="relative h-full" :ref="'speakerDropdown' + index">
<div class="flex items-center h-full">
<input type="text" v-model="segment.speaker"
- @input="filterSpeakers(index); openSpeakerSuggestions(index)"
+ @input="filterSpeakerSuggestions(index); openSpeakerSuggestions(index)"
@focus="openSpeakerSuggestions(index)"
class="w-full h-full px-3 py-2.5 pr-7 bg-transparent border-0 focus:outline-none text-sm text-[var(--text-primary)]" />
<button type="button" @click.stop="openSpeakerSuggestions(index)"