Speakr is a personal, self-hosted web application designed for transcribing audio recordings
Python
ui: render Inquire citations as numbered chips (times inline, title on hover) with a deduplicated Sources list per answer; prompt no longer repeats titles in prose
Murtaza Nasird2145bbea661
diff --git a/src/services/inquire_agent.py b/src/services/inquire_agent.pyindex 4ca23577..18d8ed1f 100644--- a/src/services/inquire_agent.py+++ b/src/services/inquire_agent.py@@ -570,7 +570,10 @@ Never invent content that is not in the tool results; say clearly when somethingseek_seconds, link directly to that moment: [Title @ m:ss](/recordings/<recording_id>?t=<seek_seconds>) \— for example [Weekly Sync @ 12:34](/recordings/73?t=754). Without a timestamp, link the recording: \[Title](/recordings/<recording_id>). Cite the recording each substantive point came from, at most \-one citation per bullet or paragraph. These links open the recording and start playback at that moment.+one citation per bullet or paragraph. These links open the recording and start playback at that \+moment. The interface renders citations as compact numbered markers with a source list at the end, \+so do NOT also write the recording's title in the prose around a citation; let the citation itself \+identify the recording.- Order information from the most recent recordings first unless the question implies otherwise."""diff --git a/static/locales/de.json b/static/locales/de.jsonindex 4871317b..b2cbd644 100644--- a/static/locales/de.json+++ b/static/locales/de.json@@ -1078,6 +1078,7 @@"placeholder": "Stellen Sie Fragen zu Ihren gefilterten Transkriptionen...","selectFilters": "Wählen Sie Filter auf der linken Seite aus, um Ihre Transkriptionen einzugrenzen, und stellen Sie dann Fragen, um Einblicke aus Ihren Aufnahmen zu erhalten.","sendHint": "Enter zum Senden • Strg+Enter für neue Zeile",+ "sources": "Quellen","speakerRequirement": "Sprecheridentifikation erfordert Aufnahmen mit mehreren Sprechern","speakers": "Sprecher","speakersCount": "Sprecher",diff --git a/static/locales/en.json b/static/locales/en.jsonindex fe209c5f..8a251e0a 100644--- a/static/locales/en.json+++ b/static/locales/en.json@@ -1078,6 +1078,7 @@"placeholder": "Ask questions about your filtered transcriptions...","selectFilters": "Select filters on the left to narrow down your transcriptions, then ask questions to get insights from your recordings.","sendHint": "Press Enter to send • Ctrl+Enter for new line",+ "sources": "Sources","speakerRequirement": "Speaker identification requires recordings with multiple speakers","speakers": "Speakers","speakersCount": "speakers",diff --git a/static/locales/es.json b/static/locales/es.jsonindex 903b705d..8618f472 100644--- a/static/locales/es.json+++ b/static/locales/es.json@@ -1078,6 +1078,7 @@"placeholder": "Haga preguntas sobre sus transcripciones filtradas...","selectFilters": "Seleccione filtros a la izquierda para reducir sus transcripciones, luego haga preguntas para obtener información de sus grabaciones.","sendHint": "Presione Enter para enviar • Ctrl+Enter para nueva línea",+ "sources": "Fuentes","speakerRequirement": "La identificación de oradores requiere grabaciones con múltiples oradores","speakers": "Oradores","speakersCount": "oradores",diff --git a/static/locales/fr.json b/static/locales/fr.jsonindex 4af4527d..c6ec740b 100644--- a/static/locales/fr.json+++ b/static/locales/fr.json@@ -1078,6 +1078,7 @@"placeholder": "Posez des questions sur vos transcriptions filtrées...","selectFilters": "Sélectionnez les filtres à gauche pour affiner vos transcriptions, puis posez des questions pour obtenir des informations à partir de vos enregistrements.","sendHint": "Appuyez sur Entrée pour envoyer • Ctrl+Entrée pour nouvelle ligne",+ "sources": "Sources","speakerRequirement": "L'identification des intervenants nécessite des enregistrements avec plusieurs intervenants","speakers": "Intervenants","speakersCount": "intervenants",diff --git a/static/locales/pt-BR.json b/static/locales/pt-BR.jsonindex 91123a49..fb60b518 100644--- a/static/locales/pt-BR.json+++ b/static/locales/pt-BR.json@@ -1078,6 +1078,7 @@"placeholder": "Faça perguntas sobre suas transcrições filtradas...","selectFilters": "Selecione filtros à esquerda para restringir suas transcrições e, em seguida, faça perguntas para obter insights de suas gravações.","sendHint": "Pressione Enter para enviar • Ctrl+Enter para nova linha",+ "sources": "Fontes","speakerRequirement": "A identificação de oradores requer gravações com múltiplos oradores","speakers": "Oradores","speakersCount": "oradores",diff --git a/static/locales/ru.json b/static/locales/ru.jsonindex f74885b1..ea10b1be 100644--- a/static/locales/ru.json+++ b/static/locales/ru.json@@ -1078,6 +1078,7 @@"placeholder": "Задавайте вопросы о ваших отфильтрованных транскрипциях...","selectFilters": "Выберите фильтры слева, чтобы сузить круг транскрипций, затем задавайте вопросы для получения информации из ваших записей.","sendHint": "Нажмите Enter для отправки • Ctrl+Enter для новой строки",+ "sources": "Источники","speakerRequirement": "Идентификация спикеров требует записей с несколькими спикерами","speakers": "Спикеры","speakersCount": "спикеров",diff --git a/static/locales/zh.json b/static/locales/zh.jsonindex efa96e6d..d3d1f58e 100644--- a/static/locales/zh.json+++ b/static/locales/zh.json@@ -1078,6 +1078,7 @@"placeholder": "询问关于您筛选的转录内容...","selectFilters": "在左侧选择筛选器以缩小转录范围,然后提问以从录音中获得见解。","sendHint": "按Enter发送 • Ctrl+Enter换行",+ "sources": "来源","speakerRequirement": "发言人识别需要包含多个发言人的录音","speakers": "发言人","speakersCount": "个发言人",diff --git a/templates/inquire.html b/templates/inquire.htmlindex 89727482..943c2f10 100644--- a/templates/inquire.html+++ b/templates/inquire.html@@ -168,6 +168,47 @@.chat-message .prose a[href^="/recordings/"]:hover {border-color: var(--border-focus);}++ /* Sources footer: numbered list mapping citation numbers to+ recording titles. Links here render as plain links, not chips. */+ .chat-message .citation-refs {+ margin-top: 1em;+ padding-top: 0.6em;+ border-top: 1px solid var(--border-primary);+ }+ .chat-message .citation-refs__label {+ font-size: 0.72em;+ font-weight: 600;+ text-transform: uppercase;+ letter-spacing: 0.06em;+ color: var(--text-muted);+ margin-bottom: 0.3em;+ }+ .chat-message .citation-refs ol {+ margin: 0;+ padding-left: 1.4em;+ font-size: 0.85em;+ }+ .chat-message .citation-refs li {+ margin: 0.15em 0;+ color: var(--text-secondary);+ }+ .chat-message .prose .citation-refs a[href^="/recordings/"] {+ display: inline;+ background: none;+ border: none;+ border-radius: 0;+ padding: 0;+ font-size: 1em;+ vertical-align: baseline;+ margin: 0;+ white-space: normal;+ color: var(--text-accent);+ text-decoration: none;+ }+ .chat-message .prose .citation-refs a[href^="/recordings/"]:hover {+ text-decoration: underline;+ }</style></head><body class="h-full bg-[var(--bg-primary)] text-[var(--text-primary)] transition-colors duration-300">@@ -905,6 +946,62 @@}};+ // Rewrite citation links into numbered chips plus a+ // trailing Sources list. The model emits+ // [Title @ m:ss](/recordings/<id>?t=s); repeating the full+ // title on every chip is noisy, so chips become+ // "<n> @ m:ss" (full title on hover), numbered by first+ // appearance per unique recording, with one Sources entry+ // per recording at the end. Deterministic here rather than+ // trusting the model to number consistently.+ const decorateCitations = (html) => {+ try {+ const tpl = document.createElement('template');+ tpl.innerHTML = html;+ const links = [...tpl.content.querySelectorAll('a[href^="/recordings/"]')];+ if (!links.length) return html;+ const refs = new Map(); // recording id -> {n, title, href}+ for (const a of links) {+ const m = (a.getAttribute('href') || '').match(/^\/recordings\/(\d+)/);+ if (!m) continue;+ const recId = m[1];+ const raw = (a.textContent || '').trim();+ const tm = raw.match(/@\s*(\d+:\d{2}(?::\d{2})?)\s*$/);+ const title = (tm ? raw.slice(0, tm.index) : raw).trim() || ('Recording ' + recId);+ if (!refs.has(recId)) {+ refs.set(recId, { n: refs.size + 1, title: title, href: '/recordings/' + recId });+ }+ const entry = refs.get(recId);+ if (title.length > entry.title.length) entry.title = title;+ a.textContent = tm ? (entry.n + ' @ ' + tm[1]) : String(entry.n);+ a.setAttribute('title', entry.title);+ }+ if (refs.size) {+ const wrap = document.createElement('div');+ wrap.className = 'citation-refs';+ const label = document.createElement('div');+ label.className = 'citation-refs__label';+ const tSources = t('inquire.sources');+ label.textContent = tSources !== 'inquire.sources' ? tSources : 'Sources';+ wrap.appendChild(label);+ const ol = document.createElement('ol');+ for (const entry of refs.values()) {+ const li = document.createElement('li');+ const link = document.createElement('a');+ link.href = entry.href;+ link.textContent = entry.title;+ li.appendChild(link);+ ol.appendChild(li);+ }+ wrap.appendChild(ol);+ tpl.content.appendChild(wrap);+ }+ return tpl.innerHTML;+ } catch (e) {+ return html;+ }+ };+const stopInquireChat = () => {// Aborting the fetch closes the SSE stream; the server// agent loop stops between steps when the client goes away.@@ -1027,7 +1124,7 @@assistantMessage.steps = agentSteps.value;}assistantMessage.content += data.delta;- assistantMessage.html = window.renderMarkdownSafe(assistantMessage.content);+ assistantMessage.html = decorateCitations(window.renderMarkdownSafe(assistantMessage.content));// Smart scroll during streamingawait nextTick();scrollToBottom();@@ -1036,7 +1133,7 @@// presenting the partial answer as complete (issue #349).if (data.truncated && messageAdded && assistantMessage.content) {assistantMessage.content += `\n\n_⚠️ ${t('chat.responseTruncated')}_`;- assistantMessage.html = window.renderMarkdownSafe(assistantMessage.content);+ assistantMessage.html = decorateCitations(window.renderMarkdownSafe(assistantMessage.content));}return;} else if (data.error) {