Skip to content

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

Python

Error display: one colour per level, not per cause

Murtaza Nasire87ac53e40a8
diff --git a/static/css/primitives.css b/static/css/primitives.css
index 332a78f5..d21b942d 100644
--- a/static/css/primitives.css
+++ b/static/css/primitives.css
@@ -883,10 +883,83 @@ html.dark select.field {
}
.banner--info { background: var(--bg-info-light); border-color: var(--border-accent); color: var(--text-info-strong, var(--text-primary)); }
.banner--success { background: var(--bg-success-light); border-color: var(--border-success, var(--border-primary)); color: var(--text-primary); }
-.banner--warn { background: var(--bg-warn-light); border-color: var(--border-accent); color: var(--text-primary); }
+.banner--warn { background: var(--tint-warn); border-color: var(--tint-warn-border); color: var(--text-primary); }
+.banner--warn > i { color: var(--tint-warn-fg); }
.banner--danger { background: var(--bg-danger-light); border-color: var(--border-danger); color: var(--text-danger-strong, var(--text-danger)); }
+/* ---- Notice -------------------------------------------------------------
+ *
+ * A message that takes the place of content inside a panel, such as a failed
+ * transcription. Levels, used the same way here and on .banner:
+ *
+ * notice--danger something failed and needs an action
+ * notice--warn it works, but something needs attention
+ * notice--info a state or an explanation, including the consequence
+ * of an error that is shown elsewhere on the page
+ * notice--success something finished
+ *
+ * Only the icon and the left border carry the level colour; the title and
+ * the text keep the text colours, so a notice reads the same in every theme.
+ * The cause of an error is told by its icon and title, never by a colour.
+ */
+.notice {
+ --notice-fg: var(--text-muted);
+ --notice-tint: var(--bg-tertiary);
+ display: flex;
+ align-items: flex-start;
+ gap: var(--sp-3);
+ padding: var(--sp-4);
+ border: var(--border-hairline) solid var(--border-primary);
+ border-left: 3px solid var(--notice-fg);
+ border-radius: var(--radius-md);
+}
+.notice--danger { --notice-fg: var(--tint-danger-fg); --notice-tint: var(--tint-danger); }
+.notice--warn { --notice-fg: var(--tint-warn-fg); --notice-tint: var(--tint-warn); }
+.notice--info { --notice-fg: var(--tint-info-fg); --notice-tint: var(--tint-info); }
+.notice--success { --notice-fg: var(--tint-success-fg); --notice-tint: var(--tint-success); }
+.notice__icon {
+ flex-shrink: 0;
+ width: 32px;
+ height: 32px;
+ border-radius: 9999px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ background: var(--notice-tint);
+ color: var(--notice-fg);
+}
+.notice__body { flex: 1; min-width: 0; }
+.notice__title {
+ margin: 0;
+ font-size: var(--fs-subhead);
+ font-weight: 600;
+ line-height: 32px;
+ color: var(--text-primary);
+}
+.notice__message { margin: 0; color: var(--text-primary); }
+.notice__hint { margin: var(--sp-1) 0 0; font-size: var(--fs-meta); color: var(--text-muted); }
+.notice__actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-4); }
+.notice__actions .btn { white-space: nowrap; }
+.notice__details { margin-top: var(--sp-3); font-size: var(--fs-meta); }
+.notice__details > summary { width: max-content; cursor: pointer; color: var(--text-muted); }
+.notice__details > summary:hover { color: var(--text-secondary); }
+.notice__details-body { position: relative; margin-top: var(--sp-2); }
+.notice__details pre {
+ margin: 0;
+ max-height: 12rem;
+ overflow: auto;
+ padding: var(--sp-3) 40px var(--sp-3) var(--sp-3);
+ white-space: pre-wrap;
+ overflow-wrap: anywhere;
+ font-size: 12px;
+ color: var(--text-secondary);
+ background: var(--bg-tertiary);
+ border-radius: var(--radius-sm);
+}
+.notice__copy { position: absolute; top: var(--sp-1); right: var(--sp-1); }
+
+
/* ---- Modal / dialog ----------------------------------------------------
*
* Standard modal grammar:
diff --git a/static/css/styles.css b/static/css/styles.css
index 6dd6cc29..ae19c1aa 100644
--- a/static/css/styles.css
+++ b/static/css/styles.css
@@ -42,7 +42,7 @@ body.unloaded {
--bg-danger-hover: #b91c1c; /* red-700 */
--bg-danger-light: #fce4e4; /* muted red */
--bg-info-light: #c3d9f7; /* muted blue */
- --bg-warn-light: #d4e8f5; /* soft blue */
+ --bg-warn-light: #fef3c7; /* amber-100 */
--bg-success-light: #c6f0dc; /* muted green */
--bg-pending-light: #eeeeec; /* stone */
--bg-input: #fafbfc; /* slightly gray white */
@@ -57,7 +57,7 @@ body.unloaded {
--text-danger: #b91c1c; /* red-700 */
--text-danger-strong: #991b1b; /* red-800 */
--text-info-strong: #1e40af; /* blue-800 */
- --text-warn-strong: #0369a1; /* sky-700 - friendly blue tone */
+ --text-warn-strong: #b45309; /* amber-700 */
--text-success-strong: #065f46; /* green-800 */
--text-pending-strong: #44403c; /* stone-700 */
@@ -181,7 +181,7 @@ body.unloaded {
--bg-danger-hover: #ef4444; /* red-500 */
--bg-danger-light: #7f1d1d; /* red-900 */
--bg-info-light: #1e3a8a; /* blue-900 */
- --bg-warn-light: #164e63; /* cyan-800 - soft, friendly dark blue */
+ --bg-warn-light: #78350f; /* amber-900 */
--bg-success-light: #064e3b; /* green-900 */
--bg-pending-light: #292524; /* stone-800 */
--bg-input: #374151; /* gray-700 */
@@ -196,7 +196,7 @@ body.unloaded {
--text-danger: #f87171; /* red-400 */
--text-danger-strong: #fca5a5; /* red-300 */
--text-info-strong: #93c5fd; /* blue-300 */
- --text-warn-strong: #67e8f9; /* cyan-300 - soft, friendly cyan text */
+ --text-warn-strong: #fcd34d; /* amber-300 */
--text-success-strong: #6ee7b7; /* green-300 */
--text-pending-strong: #d6d3d1; /* stone-300 */
diff --git a/static/js/modules/utils/errorDisplay.js b/static/js/modules/utils/errorDisplay.js
deleted file mode 100644
index 6c54a4fc..00000000
--- a/static/js/modules/utils/errorDisplay.js
+++ /dev/null
@@ -1,306 +0,0 @@
-/**
- * Error Display Utility
- *
- * Parses and displays user-friendly error messages from the backend.
- * Handles both JSON-formatted errors (ERROR_JSON:...) and plain text errors.
- */
-
-import { errorTextMatches } from './error-patterns.js';
-
-/**
- * Parse a stored error message from the backend.
- * @param {string} text - The stored transcription/error text
- * @returns {Object|null} - Parsed error object or null if not an error
- */
-export function parseStoredError(text) {
- if (!text) return null;
-
- // Check for JSON-formatted error
- if (text.startsWith('ERROR_JSON:')) {
- try {
- const jsonStr = text.substring(11); // Remove 'ERROR_JSON:' prefix
- const data = JSON.parse(jsonStr);
- return {
- title: data.t || 'Error',
- message: data.m || 'An error occurred',
- guidance: data.g || '',
- icon: data.i || 'fa-exclamation-circle',
- type: data.y || 'unknown',
- isKnown: data.k || false,
- technical: data.d || '',
- isFormattedError: true
- };
- } catch (e) {
- console.error('Failed to parse error JSON:', e);
- }
- }
-
- // Check for legacy error format (starts with common error prefixes)
- const errorPrefixes = [
- 'Transcription failed:',
- 'Processing failed:',
- 'ASR processing failed:',
- 'Audio extraction failed:',
- 'Error:'
- ];
-
- for (const prefix of errorPrefixes) {
- if (text.startsWith(prefix)) {
- // Parse the error using pattern matching
- return parseUnformattedError(text);
- }
- }
-
- return null;
-}
-
-/**
- * Parse an unformatted error message and try to make it user-friendly.
- * @param {string} text - The raw error text
- * @returns {Object} - Parsed error object
- */
-function parseUnformattedError(text) {
- const lowerText = text.toLowerCase();
-
- // Known error patterns
- const patterns = [
- {
- // Reverse-proxy 413 (nginx default "Request Entity Too Large", Apache
- // "Request body is too large", Nginx Proxy Manager defaults). The
- // request never reached Speakr, so enabling chunking on the Speakr
- // side cannot help; the proxy must allow a larger body. Match this
- // BEFORE the generic 413/file-too-large pattern below.
- patterns: ['request entity too large', 'request body is too large', '413 request entity too large'],
- title: 'Upload Blocked by Reverse Proxy',
- message: 'The reverse proxy in front of Speakr rejected the upload before it reached Speakr.',
- guidance: 'Increase the client body size limit on your reverse proxy. For nginx, set client_max_body_size to a value larger than your audio file. For Nginx Proxy Manager the default is 2000m and is adjustable per host in the Advanced tab. The chunking and compression options in Speakr do not apply here because the upload is rejected before Speakr sees it.',
- icon: 'fa-shield-halved',
- type: 'proxy_limit'
- },
- {
- // Speakr's own MAX_FILE_SIZE_MB rejection (returns JSON with a
- // specific "File too large. Max: N MB" payload) and downstream
- // transcription-service size limits (e.g. OpenAI Whisper 25 MB).
- // Both are addressable from the Speakr side via chunking.
- patterns: ['maximum content size limit', 'file too large', 'payload too large', 'exceeded', 'content too large'],
- title: 'File Too Large',
- message: 'The audio file exceeds the maximum size allowed by the transcription service.',
- guidance: 'Enable audio chunking in your admin settings if it is off, or compress the audio file before uploading. If chunking is already enabled, the file may still exceed the per-chunk limit; lower the chunk size or compress the source.',
- icon: 'fa-file-audio',
- type: 'size_limit'
- },
- {
- patterns: ['timed out', 'timeout', 'deadline exceeded'],
- title: 'Processing Timeout',
- message: 'The transcription took too long to complete.',
- guidance: 'This can happen with very long recordings. Try splitting the audio into smaller parts.',
- icon: 'fa-clock',
- type: 'timeout'
- },
- {
- patterns: ['401', 'unauthorized', 'invalid api key', 'authentication failed', 'incorrect api key'],
- title: 'Authentication Error',
- message: 'The transcription service rejected the API credentials.',
- guidance: 'Please check that the API key is correct and has not expired.',
- icon: 'fa-key',
- type: 'auth'
- },
- {
- patterns: ['rate limit', 'too many requests', '429', 'quota exceeded'],
- title: 'Rate Limit Exceeded',
- message: 'Too many requests were sent to the transcription service.',
- guidance: 'Please wait a few minutes and try reprocessing.',
- icon: 'fa-hourglass-half',
- type: 'rate_limit'
- },
- {
- patterns: ['connection refused', 'connection reset', 'could not connect', 'network unreachable'],
- title: 'Connection Error',
- message: 'Could not connect to the transcription service.',
- guidance: 'Check your internet connection and ensure the service is available.',
- icon: 'fa-wifi',
- type: 'connection'
- },
- {
- patterns: ['503', '502', '500', 'service unavailable', 'server error', 'internal server error'],
- title: 'Service Unavailable',
- message: 'The transcription service is temporarily unavailable.',
- guidance: 'This is usually temporary. Please try again in a few minutes.',
- icon: 'fa-server',
- type: 'service_error'
- },
- {
- patterns: ['invalid file format', 'unsupported format', 'could not decode', 'corrupt', 'not valid audio'],
- title: 'Invalid Audio Format',
- message: 'The audio file format is not supported or the file may be corrupted.',
- guidance: 'Try converting the audio to MP3 or WAV format before uploading.',
- icon: 'fa-file-audio',
- type: 'format'
- },
- {
- patterns: ['audio extraction failed', 'ffmpeg failed', 'no audio stream'],
- title: 'Audio Extraction Failed',
- message: 'Could not extract audio from the uploaded file.',
- guidance: 'Try converting the file to a standard audio format (MP3, WAV) before uploading.',
- icon: 'fa-file-video',
- type: 'extraction'
- }
- ];
-
- // Check patterns
- for (const pattern of patterns) {
- for (const p of pattern.patterns) {
- if (errorTextMatches(lowerText, p)) {
- return {
- title: pattern.title,
- message: pattern.message,
- guidance: pattern.guidance,
- icon: pattern.icon,
- type: pattern.type,
- isKnown: true,
- technical: text,
- isFormattedError: true
- };
- }
- }
- }
-
- // Unknown error - clean it up as best we can
- let cleanMessage = text;
- for (const prefix of ['Transcription failed:', 'Processing failed:', 'Error:', 'ASR processing failed:']) {
- if (cleanMessage.startsWith(prefix)) {
- cleanMessage = cleanMessage.substring(prefix.length).trim();
- }
- }
-
- // Truncate if too long
- if (cleanMessage.length > 200) {
- cleanMessage = cleanMessage.substring(0, 200) + '...';
- }
-
- return {
- title: 'Processing Error',
- message: cleanMessage,
- guidance: 'If this error persists, try reprocessing the recording.',
- icon: 'fa-exclamation-circle',
- type: 'unknown',
- isKnown: false,
- technical: text,
- isFormattedError: true
- };
-}
-
-/**
- * Check if a transcription text is actually an error message.
- * @param {string} text - The transcription text
- * @returns {boolean}
- */
-export function isErrorMessage(text) {
- if (!text) return false;
-
- if (text.startsWith('ERROR_JSON:')) return true;
-
- const errorPrefixes = [
- 'Transcription failed:',
- 'Processing failed:',
- 'ASR processing failed:',
- 'Audio extraction failed:'
- ];
-
- return errorPrefixes.some(prefix => text.startsWith(prefix));
-}
-
-/**
- * Generate HTML for displaying an error nicely.
- * @param {Object} error - Parsed error object from parseStoredError
- * @param {boolean} showTechnical - Whether to show technical details
- * @returns {string} - HTML string
- */
-export function generateErrorHTML(error, showTechnical = false) {
- if (!error) return '';
-
- const typeColors = {
- size_limit: 'amber',
- timeout: 'orange',
- auth: 'red',
- rate_limit: 'yellow',
- connection: 'blue',
- service_error: 'purple',
- format: 'pink',
- extraction: 'indigo',
- billing: 'red',
- model: 'gray',
- unknown: 'gray'
- };
-
- // Full literal class names per color. The Tailwind stylesheet is compiled at
- // build time from complete class strings in the source files; names assembled
- // from a color variable are absent from it.
- const colorClasses = {
- amber: { box: 'bg-amber-500/10 border-amber-500/30', badge: 'bg-amber-500/20', icon: 'text-amber-500', title: 'text-amber-600 dark:text-amber-400' },
- orange: { box: 'bg-orange-500/10 border-orange-500/30', badge: 'bg-orange-500/20', icon: 'text-orange-500', title: 'text-orange-600 dark:text-orange-400' },
- red: { box: 'bg-red-500/10 border-red-500/30', badge: 'bg-red-500/20', icon: 'text-red-500', title: 'text-red-600 dark:text-red-400' },
- yellow: { box: 'bg-yellow-500/10 border-yellow-500/30', badge: 'bg-yellow-500/20', icon: 'text-yellow-500', title: 'text-yellow-600 dark:text-yellow-400' },
- blue: { box: 'bg-blue-500/10 border-blue-500/30', badge: 'bg-blue-500/20', icon: 'text-blue-500', title: 'text-blue-600 dark:text-blue-400' },
- purple: { box: 'bg-purple-500/10 border-purple-500/30', badge: 'bg-purple-500/20', icon: 'text-purple-500', title: 'text-purple-600 dark:text-purple-400' },
- pink: { box: 'bg-pink-500/10 border-pink-500/30', badge: 'bg-pink-500/20', icon: 'text-pink-500', title: 'text-pink-600 dark:text-pink-400' },
- indigo: { box: 'bg-indigo-500/10 border-indigo-500/30', badge: 'bg-indigo-500/20', icon: 'text-indigo-500', title: 'text-indigo-600 dark:text-indigo-400' },
- gray: { box: 'bg-gray-500/10 border-gray-500/30', badge: 'bg-gray-500/20', icon: 'text-gray-500', title: 'text-gray-600 dark:text-gray-400' }
- };
-
- const color = typeColors[error.type] || 'gray';
- const cls = colorClasses[color] || colorClasses.gray;
-
- let html = `
- <div class="error-display border ${cls.box} rounded-lg p-4">
- <div class="flex items-start gap-3">
- <div class="flex-shrink-0 w-10 h-10 rounded-full ${cls.badge} flex items-center justify-center">
- <i class="fas ${error.icon} ${cls.icon}"></i>
- </div>
- <div class="flex-1 min-w-0">
- <h3 class="text-lg font-semibold ${cls.title} mb-1">
- ${escapeHtml(error.title)}
- </h3>
- <p class="text-[var(--text-primary)] mb-2">
- ${escapeHtml(error.message)}
- </p>
- ${error.guidance ? `
- <div class="flex items-start gap-2 text-sm text-[var(--text-secondary)] bg-[var(--bg-tertiary)]/50 rounded p-2">
- <i class="fas fa-lightbulb text-yellow-500 mt-0.5"></i>
- <span>${escapeHtml(error.guidance)}</span>
- </div>
- ` : ''}
- </div>
- </div>
- ${showTechnical && error.technical ? `
- <details class="mt-3 text-xs">
- <summary class="cursor-pointer text-[var(--text-muted)] hover:text-[var(--text-secondary)]">
- Technical details
- </summary>
- <pre class="mt-2 p-2 bg-[var(--bg-tertiary)] rounded overflow-x-auto text-[var(--text-muted)]">${escapeHtml(error.technical)}</pre>
- </details>
- ` : ''}
- </div>
- `;
-
- return html;
-}
-
-/**
- * Escape HTML special characters.
- * @param {string} text
- * @returns {string}
- */
-function escapeHtml(text) {
- if (!text) return '';
- const div = document.createElement('div');
- div.textContent = text;
- return div.innerHTML;
-}
-
-// Export for use in Vue components
-export default {
- parseStoredError,
- isErrorMessage,
- generateErrorHTML
-};
diff --git a/static/locales/de.json b/static/locales/de.json
index daa540d1..35fa7225 100644
--- a/static/locales/de.json
+++ b/static/locales/de.json
@@ -944,7 +944,8 @@
"uploadTimedOut": "Upload-Zeitüberschreitung",
"validationError": "Validierungsfehler",
"waitAndRetryGuidance": "Einige Minuten warten und erneut versuchen",
- "shareTarget_storage_quota": "Die geteilte Datei wurde nicht gespeichert, weil Ihr Speicher voll ist."
+ "shareTarget_storage_quota": "Die geteilte Datei wurde nicht gespeichert, weil Ihr Speicher voll ist.",
+ "technicalDetails": "Technische Details"
},
"eventExtraction": {
"description": "Wenn aktiviert, identifiziert die KI Meetings, Termine und Fristen in Ihren Aufnahmen und erstellt herunterladbare Kalenderereignisse.",
@@ -2032,7 +2033,8 @@
"summaryInProgress": "Zusammenfassung wird generiert...",
"title": "Zusammenfassung",
"customizePrompt": "Prompt anpassen",
- "editingSaveHint": "Bearbeitung — über die Tab-Leiste oben speichern"
+ "editingSaveHint": "Bearbeitung — über die Tab-Leiste oben speichern",
+ "needsTranscription": "Eine Zusammenfassung kann erstellt werden, sobald die Transkription erfolgreich war."
},
"summaryMode": {
"applyMode": "Anwendungsmodus",
diff --git a/static/locales/en.json b/static/locales/en.json
index 3b8ebb47..e7960240 100644
--- a/static/locales/en.json
+++ b/static/locales/en.json
@@ -944,7 +944,8 @@
"uploadTimedOut": "Upload timed out",
"validationError": "Validation error",
"waitAndRetryGuidance": "Wait a few minutes and try again",
- "shareTarget_storage_quota": "The shared file was not saved because your storage is full."
+ "shareTarget_storage_quota": "The shared file was not saved because your storage is full.",
+ "technicalDetails": "Technical details"
},
"eventExtraction": {
"description": "When enabled, the AI will identify meetings, appointments, and deadlines mentioned in your recordings and create downloadable calendar events.",
@@ -2032,7 +2033,8 @@
"summaryInProgress": "Summary generation in progress...",
"title": "Summary",
"customizePrompt": "Customise prompt",
- "editingSaveHint": "Editing — save from the tab bar above"
+ "editingSaveHint": "Editing — save from the tab bar above",
+ "needsTranscription": "A summary can be generated once the transcription has succeeded."
},
"summaryMode": {
"applyMode": "Apply mode",
diff --git a/static/locales/es.json b/static/locales/es.json
index 9e88b41c..4a5a3c4e 100644
--- a/static/locales/es.json
+++ b/static/locales/es.json
@@ -944,7 +944,8 @@
"uploadTimedOut": "Se agotó el tiempo de subida",
"validationError": "Error de validación",
"waitAndRetryGuidance": "Espere unos minutos y vuelva a intentarlo",
- "shareTarget_storage_quota": "El archivo compartido no se guardó porque su almacenamiento está lleno."
+ "shareTarget_storage_quota": "El archivo compartido no se guardó porque su almacenamiento está lleno.",
+ "technicalDetails": "Detalles técnicos"
},
"eventExtraction": {
"description": "Cuando está habilitado, la IA identificará reuniones, citas y plazos mencionados en tus grabaciones y creará eventos de calendario descargables.",
@@ -2032,7 +2033,8 @@
"summaryInProgress": "Generación de resumen en progreso...",
"title": "Resumen",
"customizePrompt": "Personalizar instrucción",
- "editingSaveHint": "Editando — guarda desde la barra de pestañas de arriba"
+ "editingSaveHint": "Editando — guarda desde la barra de pestañas de arriba",
+ "needsTranscription": "Se podrá generar un resumen cuando la transcripción se haya completado correctamente."
},
"summaryMode": {
"applyMode": "Modo de aplicación",
diff --git a/static/locales/fr.json b/static/locales/fr.json
index 77343c97..3addcf89 100644
--- a/static/locales/fr.json
+++ b/static/locales/fr.json
@@ -944,7 +944,8 @@
"uploadTimedOut": "Délai d’envoi dépassé",
"validationError": "Erreur de validation",
"waitAndRetryGuidance": "Patientez quelques minutes et réessayez",
- "shareTarget_storage_quota": "Le fichier partagé n'a pas été enregistré, car votre stockage est plein."
+ "shareTarget_storage_quota": "Le fichier partagé n'a pas été enregistré, car votre stockage est plein.",
+ "technicalDetails": "Détails techniques"
},
"eventExtraction": {
"description": "Lorsqu'activé, l'IA identifiera les réunions, rendez-vous et échéances mentionnés dans vos enregistrements et créera des événements de calendrier téléchargeables.",
@@ -2032,7 +2033,8 @@
"summaryInProgress": "Génération du résumé en cours...",
"title": "Résumé",
"customizePrompt": "Personnaliser le prompt",
- "editingSaveHint": "Modification — enregistrer depuis la barre d'onglets ci-dessus"
+ "editingSaveHint": "Modification — enregistrer depuis la barre d'onglets ci-dessus",
+ "needsTranscription": "Un résumé pourra être généré une fois la transcription réussie."
},
"summaryMode": {
"applyMode": "Mode d'application",
diff --git a/static/locales/pt-BR.json b/static/locales/pt-BR.json
index 69c7d06e..ff621dbe 100644
--- a/static/locales/pt-BR.json
+++ b/static/locales/pt-BR.json
@@ -944,7 +944,8 @@
"uploadTimedOut": "Tempo limite de envio excedido",
"validationError": "Erro de validação",
"waitAndRetryGuidance": "Aguarde alguns minutos e tente novamente",
- "shareTarget_storage_quota": "O arquivo compartilhado não foi salvo porque seu armazenamento está cheio."
+ "shareTarget_storage_quota": "O arquivo compartilhado não foi salvo porque seu armazenamento está cheio.",
+ "technicalDetails": "Detalhes técnicos"
},
"eventExtraction": {
"description": "Quando ativado, a IA identificará reuniões, compromissos e prazos mencionados em suas gravações e criará eventos de calendário para inserir na agenda.",
@@ -2032,7 +2033,8 @@
"summaryInProgress": "Geração de resumo em andamento...",
"title": "Resumo",
"customizePrompt": "Personalizar prompt",
- "editingSaveHint": "Editando — salvar na barra de abas acima"
+ "editingSaveHint": "Editando — salvar na barra de abas acima",
+ "needsTranscription": "Um resumo poderá ser gerado quando a transcrição for concluída com sucesso."
},
"summaryMode": {
"append": "Acrescentar",
diff --git a/static/locales/ru.json b/static/locales/ru.json
index 14107613..7ace3c2f 100644
--- a/static/locales/ru.json
+++ b/static/locales/ru.json
@@ -944,7 +944,8 @@
"uploadTimedOut": "Истекло время загрузки",
"validationError": "Ошибка проверки",
"waitAndRetryGuidance": "Подождите несколько минут и повторите",
- "shareTarget_storage_quota": "Файл не сохранён, потому что хранилище заполнено."
+ "shareTarget_storage_quota": "Файл не сохранён, потому что хранилище заполнено.",
+ "technicalDetails": "Технические подробности"
},
"eventExtraction": {
"description": "При включении ИИ будет определять встречи, назначения и дедлайны, упомянутые в ваших записях, и создавать загружаемые календарные события.",
@@ -2032,7 +2033,8 @@
"summaryInProgress": "Генерация резюме...",
"title": "Резюме",
"customizePrompt": "Настроить подсказку",
- "editingSaveHint": "Редактирование — сохраните через панель вкладок выше"
+ "editingSaveHint": "Редактирование — сохраните через панель вкладок выше",
+ "needsTranscription": "Сводку можно будет создать после успешной транскрипции."
},
"summaryMode": {
"applyMode": "Режим применения",
diff --git a/static/locales/zh.json b/static/locales/zh.json
index 0f8ecaf2..6b505b58 100644
--- a/static/locales/zh.json
+++ b/static/locales/zh.json
@@ -944,7 +944,8 @@
"uploadTimedOut": "上传超时",
"validationError": "验证错误",
"waitAndRetryGuidance": "请等待几分钟后再重试",
- "shareTarget_storage_quota": "由于存储已满,共享的文件未保存。"
+ "shareTarget_storage_quota": "由于存储已满,共享的文件未保存。",
+ "technicalDetails": "技术详情"
},
"eventExtraction": {
"description": "启用后,AI将识别录音中提到的会议、约会和截止日期,并创建可下载的日历事件。",
@@ -2032,7 +2033,8 @@
"summaryInProgress": "摘要生成中...",
"title": "摘要",
"customizePrompt": "自定义提示词",
- "editingSaveHint": "正在编辑 — 请通过上方的标签栏保存"
+ "editingSaveHint": "正在编辑 — 请通过上方的标签栏保存",
+ "needsTranscription": "转录成功后即可生成摘要。"
},
"summaryMode": {
"applyMode": "应用模式",
diff --git a/tailwind.config.js b/tailwind.config.js
index fbcfa467..a3da580f 100644
--- a/tailwind.config.js
+++ b/tailwind.config.js
@@ -5,7 +5,7 @@
// Only complete class names that appear literally in the files below are
// compiled. A class name assembled at runtime from parts (for example
// `bg-${color}-500`) is absent from the output; each full class name has to
-// be written out instead (see static/js/modules/utils/errorDisplay.js).
+// be written out instead.
/** @type {import('tailwindcss').Config} */
export default {
diff --git a/templates/account.html b/templates/account.html
index 0ca83aaf..bbdff017 100644
--- a/templates/account.html
+++ b/templates/account.html
@@ -2408,7 +2408,7 @@ curl "https://your-speakr-instance.com/api/recordings?token=YOUR_TOKEN_HERE"</co
</p>
<div id="clearVoiceProfilesList" class="max-h-48 overflow-y-auto space-y-2 bg-[var(--bg-tertiary)] rounded-md p-3 border border-[var(--border-primary)] mb-4"></div>
<div class="banner banner--warn mb-2" style="display: flex; align-items: flex-start; gap: var(--sp-2);">
- <i class="fas fa-info-circle" style="margin-top: 2px;"></i>
+ <i class="fas fa-exclamation-triangle" style="margin-top: 2px;"></i>
<div>
<div class="t-body-strong" style="margin-bottom: var(--sp-1);">What will happen</div>
<div class="t-meta">All voice embeddings and recognition data will be removed. Speaker names and usage history will be preserved.</div>
diff --git a/templates/components/detail/_transcription-error.html b/templates/components/detail/_transcription-error.html
new file mode 100644
index 00000000..ac4e02a2
--- /dev/null
+++ b/templates/components/detail/_transcription-error.html
@@ -0,0 +1,29 @@
+{# A failed transcription, shown in place of the transcript on desktop and
+ mobile. Every cause is an error (notice--danger); the cause is told by the
+ icon and the title. The technical details open below the actions, inside
+ the card, so nothing beside them moves. #}
+<div class="notice notice--danger">
+ <div class="notice__icon"><i :class="['fas', processedTranscription.error.icon]"></i></div>
+ <div class="notice__body">
+ <h3 class="notice__title">${processedTranscription.error.title}</h3>
+ <p class="notice__message">${processedTranscription.error.message}</p>
+ <p v-if="processedTranscription.error.guidance" class="notice__hint">${processedTranscription.error.guidance}</p>
+ <div v-if="selectedRecording.can_edit !== false" class="notice__actions">
+ <button class="btn btn--primary" @click="reprocessTranscription(selectedRecording.id)">
+ <i class="fas fa-redo-alt"></i>
+ <span v-text="t('buttons.reprocessTranscription')"></span>
+ </button>
+ </div>
+ <details v-if="processedTranscription.error.technical" class="notice__details">
+ <summary v-text="t('errors.technicalDetails')"></summary>
+ <div class="notice__details-body">
+ <pre>${processedTranscription.error.technical}</pre>
+ <button class="btn btn--quiet btn--icon btn--sm notice__copy"
+ @click="copyMessage(processedTranscription.error.technical, $event)"
+ :title="t('buttons.copyToClipboard')" :aria-label="t('buttons.copyToClipboard')">
+ <i class="fas fa-copy"></i>
+ </button>
+ </div>
+ </details>
+ </div>
+</div>
diff --git a/templates/components/detail/desktop-summary-tab.html b/templates/components/detail/desktop-summary-tab.html
index 7422cdf9..9d6c65c8 100644
--- a/templates/components/detail/desktop-summary-tab.html
+++ b/templates/components/detail/desktop-summary-tab.html
@@ -23,9 +23,9 @@
<div class="empty">
<div class="empty__icon"><i class="fas fa-file-alt"></i></div>
<div class="empty__title" v-text="t('summary.noSummary')"></div>
- <div v-if="processedTranscription.isError" class="banner banner--warn" style="margin-top: var(--sp-2);">
- <i class="fas fa-exclamation-triangle"></i>
- <span>Cannot generate summary: transcription failed</span>
+ <div v-if="processedTranscription.isError" class="banner banner--info" style="margin-top: var(--sp-2);">
+ <i class="fas fa-info-circle"></i>
+ <span v-text="t('summary.needsTranscription')"></span>
</div>
<div class="flex items-center gap-2" style="margin-top: var(--sp-3);">
<button class="btn btn--primary"
diff --git a/templates/components/detail/desktop-transcription-panel.html b/templates/components/detail/desktop-transcription-panel.html
index 9746c871..0b43fe34 100644
--- a/templates/components/detail/desktop-transcription-panel.html
+++ b/templates/components/detail/desktop-transcription-panel.html
@@ -120,77 +120,7 @@
<!-- Error Display (when transcription is an error message) -->
<div v-if="processedTranscription.isError" class="error-display-container">
- <div :class="[
- 'rounded-lg p-5 border',
- processedTranscription.error.type === 'size_limit' ? 'bg-amber-500/10 border-amber-500/30' :
- processedTranscription.error.type === 'timeout' ? 'bg-orange-500/10 border-orange-500/30' :
- processedTranscription.error.type === 'auth' ? 'bg-red-500/10 border-red-500/30' :
- processedTranscription.error.type === 'rate_limit' ? 'bg-yellow-500/10 border-yellow-500/30' :
- processedTranscription.error.type === 'connection' ? 'bg-blue-500/10 border-blue-500/30' :
- processedTranscription.error.type === 'service_error' ? 'bg-purple-500/10 border-purple-500/30' :
- 'bg-gray-500/10 border-gray-500/30'
- ]">
- <div class="flex items-start gap-4">
- <div :class="[
- 'flex-shrink-0 w-12 h-12 rounded-full flex items-center justify-center',
- processedTranscription.error.type === 'size_limit' ? 'bg-amber-500/20' :
- processedTranscription.error.type === 'timeout' ? 'bg-orange-500/20' :
- processedTranscription.error.type === 'auth' ? 'bg-red-500/20' :
- processedTranscription.error.type === 'rate_limit' ? 'bg-yellow-500/20' :
- processedTranscription.error.type === 'connection' ? 'bg-blue-500/20' :
- processedTranscription.error.type === 'service_error' ? 'bg-purple-500/20' :
- 'bg-gray-500/20'
- ]">
- <i :class="[
- 'fas text-xl',
- processedTranscription.error.icon,
- processedTranscription.error.type === 'size_limit' ? 'text-amber-500' :
- processedTranscription.error.type === 'timeout' ? 'text-orange-500' :
- processedTranscription.error.type === 'auth' ? 'text-red-500' :
- processedTranscription.error.type === 'rate_limit' ? 'text-yellow-500' :
- processedTranscription.error.type === 'connection' ? 'text-blue-500' :
- processedTranscription.error.type === 'service_error' ? 'text-purple-500' :
- 'text-gray-500'
- ]"></i>
- </div>
- <div class="flex-1 min-w-0">
- <h3 :class="[
- 'text-lg font-semibold mb-2',
- processedTranscription.error.type === 'size_limit' ? 'text-amber-600 dark:text-amber-400' :
- processedTranscription.error.type === 'timeout' ? 'text-orange-600 dark:text-orange-400' :
- processedTranscription.error.type === 'auth' ? 'text-red-600 dark:text-red-400' :
- processedTranscription.error.type === 'rate_limit' ? 'text-yellow-600 dark:text-yellow-400' :
- processedTranscription.error.type === 'connection' ? 'text-blue-600 dark:text-blue-400' :
- processedTranscription.error.type === 'service_error' ? 'text-purple-600 dark:text-purple-400' :
- 'text-gray-600 dark:text-gray-400'
- ]">
- ${processedTranscription.error.title}
- </h3>
- <p class="text-[var(--text-primary)] mb-3">
- ${processedTranscription.error.message}
- </p>
- <div v-if="processedTranscription.error.guidance" class="flex items-start gap-2 text-sm text-[var(--text-secondary)] bg-[var(--bg-tertiary)]/50 rounded-lg p-3">
- <i class="fas fa-lightbulb text-yellow-500 mt-0.5 flex-shrink-0"></i>
- <span>${processedTranscription.error.guidance}</span>
- </div>
- </div>
- </div>
- <!-- Action buttons -->
- <div class="mt-4 flex items-center gap-3 pt-4 border-t border-[var(--border-secondary)]">
- <button @click="reprocessTranscription(selectedRecording.id)"
- v-if="selectedRecording.can_edit !== false"
- class="px-4 py-2 bg-[var(--bg-accent)] hover:bg-[var(--bg-accent-hover)] text-white rounded-lg transition-colors flex items-center gap-2">
- <i class="fas fa-redo-alt"></i>
- <span v-text="t('buttons.reprocessTranscription')"></span>
- </button>
- <details class="text-xs w-full">
- <summary class="cursor-pointer text-[var(--text-muted)] hover:text-[var(--text-secondary)]">
- Technical details
- </summary>
- <pre v-if="processedTranscription.error.technical" class="mt-2 p-3 bg-[var(--bg-tertiary)] rounded-lg text-[var(--text-muted)] text-xs max-h-32 overflow-auto whitespace-pre-wrap break-all w-full">${processedTranscription.error.technical}</pre>
- </details>
- </div>
- </div>
+ {% include 'components/detail/_transcription-error.html' %}
</div>
<!-- Speaker Legend (for dialogue transcriptions in bubble view only) -->
diff --git a/templates/components/detail/floating-chat.html b/templates/components/detail/floating-chat.html
index 04b71b04..b816c5b6 100644
--- a/templates/components/detail/floating-chat.html
+++ b/templates/components/detail/floating-chat.html
@@ -191,8 +191,8 @@
<i class="fas fa-paper-plane"></i>
</button>
</div>
- <div v-if="processedTranscription.isError" class="t-meta mt-2 flex items-center gap-1.5" style="color: var(--text-danger);">
- <i class="fas fa-exclamation-triangle"></i>
+ <div v-if="processedTranscription.isError" class="t-meta mt-2 flex items-center gap-1.5">
+ <i class="fas fa-info-circle"></i>
<span v-text="t('chat.cannotChatTranscriptionFailed')"></span>
</div>
<div v-else-if="selectedRecording.status !== 'COMPLETED'" class="t-meta mt-2">
diff --git a/templates/components/detail/mobile-chat-panel.html b/templates/components/detail/mobile-chat-panel.html
index 826e6ecc..10457de0 100644
--- a/templates/components/detail/mobile-chat-panel.html
+++ b/templates/components/detail/mobile-chat-panel.html
@@ -57,8 +57,8 @@
<i class="fas fa-paper-plane"></i>
</button>
</div>
- <div v-if="processedTranscription.isError" class="t-meta mt-2 flex items-center gap-1.5" style="color: var(--text-danger);">
- <i class="fas fa-exclamation-triangle"></i>
+ <div v-if="processedTranscription.isError" class="t-meta mt-2 flex items-center gap-1.5">
+ <i class="fas fa-info-circle"></i>
<span v-text="t('chat.cannotChatTranscriptionFailed')"></span>
</div>
</div>
diff --git a/templates/components/detail/mobile-summary-panel.html b/templates/components/detail/mobile-summary-panel.html
index 082906ae..cde620f1 100644
--- a/templates/components/detail/mobile-summary-panel.html
+++ b/templates/components/detail/mobile-summary-panel.html
@@ -40,9 +40,9 @@
<div v-else-if="!selectedRecording.summary" class="empty">
<div class="empty__icon"><i class="fas fa-file-alt"></i></div>
<div class="empty__title" v-text="t('summary.noSummary')"></div>
- <div v-if="processedTranscription.isError" class="banner banner--warn">
- <i class="fas fa-exclamation-triangle"></i>
- <span>Cannot generate summary: transcription failed</span>
+ <div v-if="processedTranscription.isError" class="banner banner--info">
+ <i class="fas fa-info-circle"></i>
+ <span v-text="t('summary.needsTranscription')"></span>
</div>
<div class="flex items-center gap-2" style="margin-top: var(--sp-3);">
<button class="btn btn--primary"
diff --git a/templates/components/detail/mobile-transcript-panel.html b/templates/components/detail/mobile-transcript-panel.html
index f409d5e2..81b798c3 100644
--- a/templates/components/detail/mobile-transcript-panel.html
+++ b/templates/components/detail/mobile-transcript-panel.html
@@ -34,52 +34,7 @@
<!-- Error Display (when transcription is an error message) -->
<div v-if="processedTranscription.isError" class="error-display-container p-2">
- <div :class="[
- 'rounded-lg p-4 border',
- processedTranscription.error.type === 'size_limit' ? 'bg-amber-500/10 border-amber-500/30' :
- processedTranscription.error.type === 'timeout' ? 'bg-orange-500/10 border-orange-500/30' :
- processedTranscription.error.type === 'auth' ? 'bg-red-500/10 border-red-500/30' :
- 'bg-gray-500/10 border-gray-500/30'
- ]">
- <div class="flex items-start gap-3">
- <div :class="[
- 'flex-shrink-0 w-10 h-10 rounded-full flex items-center justify-center',
- processedTranscription.error.type === 'size_limit' ? 'bg-amber-500/20' :
- processedTranscription.error.type === 'timeout' ? 'bg-orange-500/20' :
- processedTranscription.error.type === 'auth' ? 'bg-red-500/20' :
- 'bg-gray-500/20'
- ]">
- <i :class="[
- 'fas',
- processedTranscription.error.icon,
- processedTranscription.error.type === 'size_limit' ? 'text-amber-500' :
- processedTranscription.error.type === 'timeout' ? 'text-orange-500' :
- processedTranscription.error.type === 'auth' ? 'text-red-500' :
- 'text-gray-500'
- ]"></i>
- </div>
- <div class="flex-1 min-w-0">
- <h3 class="font-semibold text-[var(--text-primary)] mb-1">
- ${processedTranscription.error.title}
- </h3>
- <p class="text-sm text-[var(--text-secondary)] mb-2">
- ${processedTranscription.error.message}
- </p>
- <div v-if="processedTranscription.error.guidance" class="text-xs text-[var(--text-muted)] bg-[var(--bg-tertiary)]/50 rounded p-2">
- <i class="fas fa-lightbulb text-yellow-500 mr-1"></i>
- ${processedTranscription.error.guidance}
- </div>
- </div>
- </div>
- <div class="mt-3 pt-3 border-t border-[var(--border-secondary)]">
- <button @click="reprocessTranscription(selectedRecording.id)"
- v-if="selectedRecording.can_edit !== false"
- class="btn btn--primary w-full">
- <i class="fas fa-redo-alt"></i>
- <span v-text="t('buttons.reprocessTranscription')"></span>
- </button>
- </div>
- </div>
+ {% include 'components/detail/_transcription-error.html' %}
</div>
<!-- Transcription content (show regardless of processing state if transcription exists) -->
diff --git a/templates/modals/bulk-merge-modal.html b/templates/modals/bulk-merge-modal.html
index 28610bd4..6028a0f4 100644
--- a/templates/modals/bulk-merge-modal.html
+++ b/templates/modals/bulk-merge-modal.html
@@ -113,14 +113,14 @@
</label>
</fieldset>
- <div class="banner banner--warn mt-4" style="display: flex; align-items: flex-start; gap: var(--sp-2);">
+ <div class="banner banner--info mt-4" style="display: flex; align-items: flex-start; gap: var(--sp-2);">
<i class="fas fa-info-circle" style="margin-top: 2px;"></i>
<div class="t-meta" v-text="t('mergeRecordings.reprocessNote')"></div>
</div>
<!-- Shown only when a video source is selected: the merged output is audio-only. -->
<div v-if="mergeOrderedList.some(r => (r.mime_type || '').startsWith('video'))"
- class="banner banner--warn mt-2" style="display: flex; align-items: flex-start; gap: var(--sp-2);">
+ class="banner banner--info mt-2" style="display: flex; align-items: flex-start; gap: var(--sp-2);">
<i class="fas fa-video" style="margin-top: 2px;"></i>
<div class="t-meta" v-text="t('mergeRecordings.videoNote')"></div>
</div>
diff --git a/tests/test_page_assets.py b/tests/test_page_assets.py
index 4011e23c..4a605ad6 100644
--- a/tests/test_page_assets.py
+++ b/tests/test_page_assets.py
@@ -92,16 +92,28 @@ def test_the_service_worker_caches_the_compiled_stylesheet():
assert "'/static/css/tailwind.css'" in text
-def test_compiled_stylesheet_has_the_dynamic_error_colors():
+def test_compiled_stylesheet_has_the_template_classes():
"""Runs where the stylesheet has been built (CI builds it first)."""
path = os.path.join(ROOT, "static", "css", "tailwind.css")
if not os.path.exists(path):
pytest.skip("static/css/tailwind.css is not built; run scripts/build_css.sh")
css = open(path, encoding="utf-8").read()
- for cls in (r".bg-amber-500\/10", r".border-indigo-500\/30", r".dark\:text-pink-400", r".text-\[var\(--text-primary\)\]"):
+ for cls in (r".text-\[var\(--text-primary\)\]", r".bg-\[var\(--bg-tertiary\)\]"):
assert cls in css, cls
+def test_the_transcription_error_card_takes_its_colours_from_the_notice_level():
+ """One level (danger) for every cause; no colour per error type."""
+ card = open(os.path.join(ROOT, "templates", "components", "detail", "_transcription-error.html"),
+ encoding="utf-8").read()
+ assert "notice notice--danger" in card
+ assert "error.type" not in card
+ assert not re.search(r"(bg|text|border)-(red|amber|orange|yellow|blue|purple|pink|indigo|gray)-[0-9]", card)
+ css = open(os.path.join(ROOT, "static", "css", "primitives.css"), encoding="utf-8").read()
+ for level in ("danger", "warn", "info", "success"):
+ assert f".notice--{level}" in css
+
+
# --- i18n_bootstrap() --------------------------------------------------------
def test_bootstrap_has_the_locale_and_english():