Speakr is a personal, self-hosted web application designed for transcribing audio recordings
Python
Warn when prompt template variables are placed in sources that the upload form does not surface
Murtaza Nasir16cabd64bd61
diff --git a/docs/user-guide/settings.md b/docs/user-guide/settings.mdindex 7b8c6379..cdf37ffb 100644--- a/docs/user-guide/settings.md+++ b/docs/user-guide/settings.md@@ -221,6 +221,8 @@ Tag and folder custom prompts may contain `{{name}}` placeholders that are fille**Editing values after upload.** Stored variable values are not yet editable from the recording detail or reprocess modal. To change a value, re-upload the recording or wait for that capability in a future release.+**Where variables are surfaced.** The upload form scans the custom prompts on every selected tag and on the chosen folder, and renders an input for each `{{name}}` it finds. Variables in the user's personal default summary prompt and in the admin's default summary prompt are technically substituted at summarisation time but are not surfaced on the upload form: the form does not know which fallback prompt would win the priority chain. Account Settings warns when these prompts contain placeholders, recommending that templated content live on a tag or folder instead. The Tag Management form also warns when a tag is configured as a watch-folder (auto-process) tag and its prompt contains placeholders, since drop-folder ingest has no UI for users to fill values.+### ASR DefaultsThe ASR defaults feature is particularly valuable for consistent meeting types. Setting "Max 10" for a "Court Action" tag ensures the transcription service looks for up to 10 distinct speakers, improving accuracy for multi-party proceedings. A "One-on-One" tag might default to exactly 2 speakers, while a "Webinar" tag could specify 1-3 speakers.diff --git a/templates/account.html b/templates/account.htmlindex e2e92297..d26e04b8 100644--- a/templates/account.html+++ b/templates/account.html@@ -698,10 +698,18 @@<label for="summary_prompt_custom" class="block text-sm font-medium text-[var(--text-muted)] mb-2"><span data-i18n="customPrompts.yourCustomPrompt">Your Custom Summary Prompt</span></label>- <textarea name="summary_prompt" id="summary_prompt_custom" rows="8"+ <textarea name="summary_prompt" id="summary_prompt_custom" rows="8"placeholder="Describe how you want your summaries structured. Leave blank to use the admin's default prompt."- data-i18n-placeholder="customPrompts.promptPlaceholder"+ data-i18n-placeholder="customPrompts.promptPlaceholder"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)]">{{ current_user.summary_prompt or '' }}</textarea>+ <!-- Warning when this prompt contains {{...}} placeholders. The upload form scans+ selected tags and folders for variables, but not the user's personal default+ prompt, so placeholders here would silently substitute to empty strings on+ uploads that fall through to this prompt. -->+ <div id="userSummaryPromptVariableWarning" class="hidden mt-2 flex items-start gap-2 p-2.5 bg-[var(--bg-warning-light)] border border-[var(--border-warning)] rounded-md text-xs text-[var(--text-warning-strong)]">+ <i class="fas fa-exclamation-triangle mt-0.5"></i>+ <span>This prompt contains <code>{{...}}</code> placeholders. The upload form does not surface variables from the personal default prompt, so values will substitute to empty strings on any upload that falls through to this prompt. Move the placeholders into a tag or folder custom prompt to have them filled in at upload time.</span>+ </div><p class="text-xs text-[var(--text-light)] mt-2"><span data-i18n="customPrompts.promptDescription">This prompt will be used to generate summaries for your transcriptions. It overrides the admin's default prompt.</span></p>@@ -2229,6 +2237,13 @@ curl "https://your-speakr-instance.com/api/recordings?token=YOUR_TOKEN_HERE"</co<label for="tagCustomPrompt" class="block text-sm font-medium text-[var(--text-secondary)] mb-1" data-i18n="editTagModal.customPrompt">Custom Summary Prompt</label><textarea id="tagCustomPrompt" name="custom_prompt" rows="4" class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]" placeholder="Optional: Custom prompt for generating summaries for recordings with this tag" data-i18n-placeholder="editTagModal.customPromptPlaceholder"></textarea><p class="text-xs text-[var(--text-light)] mt-1" data-i18n="editTagModal.leaveBlankPrompt">Leave blank to use your default summary prompt</p>++ <!-- Warning when this tag uses {{...}} variables AND is configured as a watch-folder (auto-process) tag.+ Drop-folder ingest has no UI for users to fill values, so placeholders silently substitute to empty strings. -->+ <div id="tagAutoProcessVariableWarning" class="hidden mt-2 flex items-start gap-2 p-2.5 bg-[var(--bg-warning-light)] border border-[var(--border-warning)] rounded-md text-xs text-[var(--text-warning-strong)]">+ <i class="fas fa-exclamation-triangle mt-0.5"></i>+ <span>This tag is set up as a watch folder and the prompt contains <code>{{...}}</code> placeholders. Recordings ingested through the auto-process directory have no UI for users to fill those values, so the placeholders will substitute to empty strings on the first summary run. Either remove the placeholders or fill the values via reprocess after upload.</span>+ </div></div><div><label for="tagNamingTemplate" class="block text-sm font-medium text-[var(--text-secondary)] mb-1" data-i18n="editTagModal.namingTemplate">Naming Template</label>@@ -4853,6 +4868,7 @@ curl "https://your-speakr-instance.com/api/recordings?token=YOUR_TOKEN_HERE"</coautoProcessRow.style.display = tag.group_id ? 'none' : '';}}+ refreshTagAutoProcessVariableWarning();} else {// Create modeisEditingTag = false;@@ -4907,6 +4923,7 @@ curl "https://your-speakr-instance.com/api/recordings?token=YOUR_TOKEN_HERE"</coconst autoProcessRow = document.getElementById('tagAutoProcessRow');if (autoProcessRow) autoProcessRow.style.display = '';}+ refreshTagAutoProcessVariableWarning();}// Load naming templates for dropdown@@ -5263,6 +5280,51 @@ curl "https://your-speakr-instance.com/api/recordings?token=YOUR_TOKEN_HERE"</co}};+ // Detect `{{name}}` placeholders so config-time guards can warn when+ // the prompt source has no UI for users to fill the values.+ const _PROMPT_VAR_RE = /\{\{\s*[A-Za-z_][A-Za-z0-9_]*\s*\}\}/;+ function promptHasVariables(text) {+ return typeof text === 'string' && _PROMPT_VAR_RE.test(text);+ }++ // Tag-edit form: warn when this tag is configured as an auto-process+ // watch folder AND its custom prompt contains template variables.+ // Drop-folder uploads have no UI to fill variables, so the+ // placeholders silently substitute to empty strings on first run.+ function refreshTagAutoProcessVariableWarning() {+ const warningEl = document.getElementById('tagAutoProcessVariableWarning');+ if (!warningEl) return;+ const promptEl = document.getElementById('tagCustomPrompt');+ const autoProcessEl = document.getElementById('tagAutoProcess');+ const isAutoProcess = !!(autoProcessEl && autoProcessEl.checked);+ const promptText = promptEl ? promptEl.value : '';+ const shouldShow = isAutoProcess && promptHasVariables(promptText);+ warningEl.classList.toggle('hidden', !shouldShow);+ }++ // User-level summary_prompt: warn when it contains {{...}} placeholders.+ // The upload form does not surface variables from the personal default+ // prompt, so they would silently substitute to empty strings.+ function refreshUserSummaryPromptVariableWarning() {+ const warningEl = document.getElementById('userSummaryPromptVariableWarning');+ const promptEl = document.getElementById('summary_prompt_custom');+ if (!warningEl || !promptEl) return;+ warningEl.classList.toggle('hidden', !promptHasVariables(promptEl.value));+ }++ document.addEventListener('input', (e) => {+ if (!e.target) return;+ if (e.target.id === 'tagCustomPrompt') refreshTagAutoProcessVariableWarning();+ if (e.target.id === 'summary_prompt_custom') refreshUserSummaryPromptVariableWarning();+ });+ document.addEventListener('change', (e) => {+ if (e.target && e.target.id === 'tagAutoProcess') {+ refreshTagAutoProcessVariableWarning();+ }+ });+ // Initial render: account page may load with a saved value already in place.+ refreshUserSummaryPromptVariableWarning();+// Load folders from APIasync function loadFolders() {if (!foldersEnabled) {diff --git a/templates/admin.html b/templates/admin.htmlindex a5502e4b..2f5aa3eb 100644--- a/templates/admin.html+++ b/templates/admin.html@@ -800,12 +800,21 @@<p class="text-sm text-[var(--text-muted)] mb-3">${t('adminDashboard.promptDescription')}</p>- <textarea+ <textareav-model="defaultSummaryPrompt"rows="8"class="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-md focus:outline-none focus:ring-2 focus:ring-[var(--border-focus)] bg-[var(--bg-input)] text-[var(--text-primary)]":placeholder="t('form.summaryPromptPlaceholder')"></textarea>+ <!-- Warning when the admin default contains {{...}} placeholders.+ The upload form only surfaces variables from selected tags+ and folders, not from the admin default, so users would not+ know to fill them and the placeholders would silently+ substitute to empty strings on every fresh upload. -->+ <div v-if="adminDefaultPromptHasVariables" class="mt-2 flex items-start gap-2 p-2.5 bg-[var(--bg-warning-light)] border border-[var(--border-warning)] rounded-md text-xs text-[var(--text-warning-strong)]">+ <i class="fas fa-exclamation-triangle mt-0.5"></i>+ <span>This prompt contains <code>{{...}}</code> placeholders. The upload form does not surface variables from the admin default, so users will not be prompted to fill them and the placeholders will substitute to empty strings on uploads that fall through to this prompt. Move templated content into a tag or folder custom prompt so it is filled at upload time.</span>+ </div></div><div class="flex justify-between items-center">@@ -2116,6 +2125,12 @@ Summarization Instructions:const promptSaveMessage = ref('');const promptSaveError = ref(false);const showFullPromptStructure = ref(false);+ // True when the admin default contains {{...}} placeholders.+ // Drives the inline warning under the textarea.+ const adminDefaultPromptHasVariables = computed(() => {+ const v = defaultSummaryPrompt.value;+ return typeof v === 'string' && /\{\{\s*[A-Za-z_][A-Za-z0-9_]*\s*\}\}/.test(v);+ });const originalDefaultPrompt = `Generate a comprehensive summary that includes the following sections:- **Key Issues Discussed**: A bulleted list of the main topics- **Key Decisions Made**: A bulleted list of any decisions reached@@ -3559,6 +3574,7 @@ Summarization Instructions:// Default Prompts statedefaultSummaryPrompt,+ adminDefaultPromptHasVariables,isSavingPrompt,promptSaveMessage,promptSaveError,