Speakr is a personal, self-hosted web application designed for transcribing audio recordings
Python
Make reprocess summary modal's variables panel and append/replace toggle reflect the chosen prompt source
Murtaza Nasircf8486833ecd
diff --git a/static/js/app.modular.js b/static/js/app.modular.jsindex 696fae1b..5e1344be 100644--- a/static/js/app.modular.js+++ b/static/js/app.modular.js@@ -666,6 +666,36 @@ document.addEventListener('DOMContentLoaded', async () => {const reprocessAvailableVariables = computed(() => {if (!selectedRecording.value) return [];const recording = selectedRecording.value;+ // Surface the variables that match the prompt source the user+ // is about to run. Otherwise the panel keeps showing the+ // recording's *original* tag's variables even after the user+ // picks a different tag, which is confusing when the chosen+ // tag has no placeholders.+ const source = summaryReprocessPromptSource.value;+ if (source === 'tag') {+ const tagId = summaryReprocessSelectedTagId.value;+ if (!tagId) return [];+ const tag = (availableTags.value || []).find(t => t.id == tagId);+ if (!tag || !tag.custom_prompt) return [];+ return buildVariableList({+ tagsWithPrompts: [tag],+ folder: null,+ userPrompt: '',+ adminPrompt: '',+ });+ }+ if (source === 'custom') {+ const text = summaryReprocessCustomPrompt.value || '';+ if (!text.trim()) return [];+ return buildVariableList({+ tagsWithPrompts: [{ name: 'Custom prompt', custom_prompt: text }],+ folder: null,+ userPrompt: '',+ adminPrompt: '',+ });+ }+ // source === 'default' — fall through to the standard priority+ // chain that the backend will resolve at task time.return buildVariableList({tagsWithPrompts: Array.isArray(recording.tags) ? recording.tags : [],folder: recording.folder || null,diff --git a/static/js/modules/composables/reprocess.js b/static/js/modules/composables/reprocess.jsindex 87c6ce72..d6912d77 100644--- a/static/js/modules/composables/reprocess.js+++ b/static/js/modules/composables/reprocess.js@@ -220,7 +220,11 @@ export function useReprocess(state, utils) {const selectedTag = availableTags.value.find(t => t.id == selectedTagId);if (selectedTag && selectedTag.custom_prompt) {requestBody.custom_prompt = selectedTag.custom_prompt;- requestBody.prompt_mode = mode;+ // A tag selection always fully replaces the resolved+ // default; Append/Replace is offered only for custom+ // prompts, so force replace here even if the ref still+ // holds an older mode value.+ requestBody.prompt_mode = 'replace';}} else if (promptSource === 'custom' && customPrompt) {requestBody.custom_prompt = customPrompt;diff --git a/templates/modals/reprocess-modal.html b/templates/modals/reprocess-modal.htmlindex f0ab2919..b1272c9c 100644--- a/templates/modals/reprocess-modal.html+++ b/templates/modals/reprocess-modal.html@@ -188,8 +188,10 @@<textarea id="reprocess-custom-prompt" v-model="summaryReprocessCustomPrompt" rows="4" 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)] text-sm bg-[var(--bg-input)] text-[var(--text-primary)]" placeholder="Enter your custom summarization instructions..."></textarea></div>- <!-- Apply mode toggle for tag and custom prompt sources -->- <div v-if="summaryReprocessPromptSource === 'tag' || summaryReprocessPromptSource === 'custom'">+ {# Apply mode toggle only for custom prompts. A selected tag+ fully replaces the resolved default by definition, so+ offering Append vs Replace there is misleading. #}+ <div v-if="summaryReprocessPromptSource === 'custom'"><label class="block text-sm font-medium text-[var(--text-muted)] mb-2">${ t('summaryMode.applyMode') }</label><div class="grid grid-cols-2 gap-2 p-1 bg-[var(--bg-tertiary)] border border-[var(--border-secondary)] rounded-md"><label