Speakr is a personal, self-hosted web application designed for transcribing audio recordings
Python
{#
Shared Advanced ASR / Transcription options for the upload dialog AND the
recording view (#362 layout, #266 model select). Both render in the same
Vue app scope but bind DIFFERENT state (the recorder's asr* refs are frozen
at queue time and survive crash recovery), so the binding names are Jinja
parameters supplied via {% with %} at each include site:
apply_template_fn, prompt_ref, hotwords_ref, model_ref, lang_ref,
exact_ref, min_ref, max_ref
One source of markup so the two surfaces cannot drift apart.
#}
<!-- Prompt & hotwords sub-card (#309): the saved-template dropdown
fills BOTH the initial prompt and hotwords, so the three are
grouped in one bordered card to make that relationship obvious. -->
<div v-if="connectorSupportsInitialPrompt || connectorSupportsHotwords"
class="rounded-md border border-[var(--border-secondary)] bg-[var(--bg-secondary)] p-3 space-y-3">
<!-- Saved transcription template: fills the fields below. Hidden
until the user has saved templates. -->
<div v-if="initialPromptTemplates && initialPromptTemplates.length">
<label class="block text-xs font-medium text-[var(--text-secondary)] mb-1">
${ t('initialPromptTemplates.savedTemplate') }
</label>
<select @change="{{ apply_template_fn }}($event.target.value); $event.target.value=''"
class="w-full px-2 py-1 text-sm bg-[var(--bg-primary)] text-[var(--text-primary)] border border-[var(--border-primary)] rounded focus:outline-none focus:ring-1 focus:ring-[var(--ring-focus)]">
<option value="">${ t('initialPromptTemplates.pickPlaceholder') }</option>
<option v-for="tpl in initialPromptTemplates" :key="tpl.id" :value="tpl.id" v-text="tpl.name"></option>
</select>
<p class="text-[10px] text-[var(--text-muted)] mt-0.5">${ t('initialPromptTemplates.savedTemplateHelp') }</p>
</div>
<!-- Initial Prompt -->
<div v-if="connectorSupportsInitialPrompt">
<label class="block text-xs font-medium text-[var(--text-secondary)] mb-1">
${ t('form.initialPrompt') }
</label>
<textarea v-model="{{ prompt_ref }}"
rows="2"
:placeholder="t('form.initialPromptPlaceholder')"
class="w-full px-2 py-1 text-sm bg-[var(--bg-primary)] text-[var(--text-primary)] border border-[var(--border-primary)] rounded focus:outline-none focus:ring-1 focus:ring-[var(--ring-focus)] resize-y"></textarea>
<p class="text-[10px] text-[var(--text-muted)] mt-0.5">${ t('form.initialPromptHelp') }</p>
</div>
<!-- Hotwords -->
<div v-if="connectorSupportsHotwords">
<label class="block text-xs font-medium text-[var(--text-secondary)] mb-1">
${ t('form.hotwords') }
</label>
<input v-model="{{ hotwords_ref }}"
type="text"
:placeholder="t('form.hotwordsPlaceholder')"
class="w-full px-2 py-1 text-sm bg-[var(--bg-primary)] text-[var(--text-primary)] border border-[var(--border-primary)] rounded focus:outline-none focus:ring-1 focus:ring-[var(--ring-focus)]">
<p class="text-[10px] text-[var(--text-muted)] mt-0.5">${ t('form.hotwordsHelp') }</p>
</div>
</div>
<!-- Model + language share a row: neither needs full modal
width. The model select (issue #266) renders only when the
admin exposes at least 2 models. -->
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3">
<div v-if="transcriptionModelOptions && transcriptionModelOptions.length > 1">
<label class="block text-xs font-medium text-[var(--text-secondary)] mb-1">
${ t('form.transcriptionModel') }
</label>
<select v-model="{{ model_ref }}"
class="w-full px-2 py-1 text-sm bg-[var(--bg-primary)] text-[var(--text-primary)] border border-[var(--border-primary)] rounded focus:outline-none focus:ring-1 focus:ring-[var(--ring-focus)]">
<option value="">${ t('form.useResolvedDefault') }</option>
<option v-for="opt in transcriptionModelOptions" :key="opt.value" :value="opt.value" v-text="opt.label || opt.value"></option>
</select>
</div>
<div>
<label class="block text-xs font-medium text-[var(--text-secondary)] mb-1">
${ t('form.transcriptionLanguage') }
</label>
<select v-model="{{ lang_ref }}"
class="w-full px-2 py-1 text-sm bg-[var(--bg-primary)] text-[var(--text-primary)] border border-[var(--border-primary)] rounded focus:outline-none focus:ring-1 focus:ring-[var(--ring-focus)]">
<option v-for="lang in languageOptions" :key="lang.value" :value="lang.value" v-text="lang.label"></option>
</select>
</div>
</div>
<!-- Divider between the language row and the speaker controls -->
<hr v-if="connectorSupportsSpeakerCount || connectorSupportsExactSpeakerCount"
class="border-t border-[var(--border-secondary)] my-1">
<!-- Speaker Settings (#362): one compact row — label, the
persisted Range/Exact toggle (range connectors only),
and narrow inputs. A single count writes min == max. -->
<div v-if="connectorSupportsSpeakerCount || connectorSupportsExactSpeakerCount"
class="flex flex-wrap items-center gap-x-3 gap-y-1.5">
<label class="text-xs font-medium text-[var(--text-secondary)]" v-text="t('form.speakers')"></label>
<div v-if="connectorSupportsSpeakerCount"
class="inline-flex rounded border border-[var(--border-secondary)] overflow-hidden">
<button type="button" @click="setSpeakerCountMode('range')"
:class="['px-2 py-0.5 text-[10px] transition-colors', !exactSpeakerEntry ? 'bg-[var(--bg-accent)] text-[var(--text-accent)] font-medium' : 'text-[var(--text-muted)] hover:text-[var(--text-secondary)]']"
v-text="t('form.speakerModeRange')"></button>
<button type="button" @click="setSpeakerCountMode('single')"
:class="['px-2 py-0.5 text-[10px] transition-colors border-l border-[var(--border-secondary)]', exactSpeakerEntry ? 'bg-[var(--bg-accent)] text-[var(--text-accent)] font-medium' : 'text-[var(--text-muted)] hover:text-[var(--text-secondary)]']"
v-text="t('form.speakerModeExact')"></button>
</div>
<input v-if="exactSpeakerEntry"
v-model.number="{{ exact_ref }}"
type="number" min="1" max="20"
class="w-20 px-2 py-1 text-sm bg-[var(--bg-primary)] text-[var(--text-primary)] border border-[var(--border-primary)] rounded focus:outline-none focus:ring-1 focus:ring-[var(--ring-focus)]">
<template v-else>
<label class="text-[11px] text-[var(--text-muted)]" v-text="t('form.minSpeakers')"></label>
<input v-model.number="{{ min_ref }}"
type="number" min="1" max="20"
class="w-16 px-2 py-1 text-sm bg-[var(--bg-primary)] text-[var(--text-primary)] border border-[var(--border-primary)] rounded focus:outline-none focus:ring-1 focus:ring-[var(--ring-focus)]">
<label class="text-[11px] text-[var(--text-muted)]" v-text="t('form.maxSpeakers')"></label>
<input v-model.number="{{ max_ref }}"
type="number" min="1" max="20"
class="w-16 px-2 py-1 text-sm bg-[var(--bg-primary)] text-[var(--text-primary)] border border-[var(--border-primary)] rounded focus:outline-none focus:ring-1 focus:ring-[var(--ring-focus)]">
</template>
</div>