feat #14740: language picker before transcribing
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -36,7 +36,7 @@
|
|||||||
"label": "prompt",
|
"label": "prompt",
|
||||||
"title": "Gespräch beendet",
|
"title": "Gespräch beendet",
|
||||||
"url": "index.html#/prompt",
|
"url": "index.html#/prompt",
|
||||||
"width": 340,
|
"width": 400,
|
||||||
"height": 180,
|
"height": 180,
|
||||||
"alwaysOnTop": true,
|
"alwaysOnTop": true,
|
||||||
"visible": false,
|
"visible": false,
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { CALL_LANGUAGES } from './api'
|
||||||
|
|
||||||
|
// The language a call is transcribed in, picked next to "Transkribieren"
|
||||||
|
// and "Erneut versuchen".
|
||||||
|
let { value = $bindable(), disabled = false }: { value: string; disabled?: boolean } = $props()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<select bind:value {disabled} title="Sprache des Gesprächs" aria-label="Sprache des Gesprächs">
|
||||||
|
{#each CALL_LANGUAGES as language (language.code)}
|
||||||
|
<option value={language.code}>{language.label}</option>
|
||||||
|
{/each}
|
||||||
|
</select>
|
||||||
+18
-2
@@ -5,10 +5,20 @@ import { listen, type UnlistenFn } from '@tauri-apps/api/event'
|
|||||||
|
|
||||||
export type CallId = number
|
export type CallId = number
|
||||||
|
|
||||||
|
/** The languages a call can be transcribed in (the backend's `CALL_LANGUAGES`). */
|
||||||
|
export const CALL_LANGUAGES = [
|
||||||
|
{ code: 'de', label: 'Deutsch' },
|
||||||
|
{ code: 'en', label: 'Englisch' },
|
||||||
|
{ code: 'es', label: 'Spanisch' },
|
||||||
|
{ code: 'fr', label: 'Französisch' },
|
||||||
|
{ code: 'it', label: 'Italienisch' },
|
||||||
|
] as const
|
||||||
|
|
||||||
export interface Settings {
|
export interface Settings {
|
||||||
allowlist: string[]
|
allowlist: string[]
|
||||||
mic_device: string | null
|
mic_device: string | null
|
||||||
output_device: string | null
|
output_device: string | null
|
||||||
|
/** Language of the transcription started last; set by the app, not the settings page. */
|
||||||
language: string
|
language: string
|
||||||
deepscript_model: string
|
deepscript_model: string
|
||||||
/** Custom words/names submitted with every transcription. */
|
/** Custom words/names submitted with every transcription. */
|
||||||
@@ -72,6 +82,8 @@ export interface CallBrief {
|
|||||||
started_at: string
|
started_at: string
|
||||||
ended_at: string | null
|
ended_at: string | null
|
||||||
duration_secs: number
|
duration_secs: number
|
||||||
|
/** What the language picker starts on: the call's own language, else the last used. */
|
||||||
|
language: string
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The call the end-of-call prompt shows, and how many wait behind it. */
|
/** The call the end-of-call prompt shows, and how many wait behind it. */
|
||||||
@@ -144,6 +156,8 @@ export interface CallDetail {
|
|||||||
audio_available: boolean
|
audio_available: boolean
|
||||||
/** Retention deleted the call's audio (not just: the files are missing). */
|
/** Retention deleted the call's audio (not just: the files are missing). */
|
||||||
audio_deleted: boolean
|
audio_deleted: boolean
|
||||||
|
/** What the language picker starts on: the call's own language, else the last used. */
|
||||||
|
language: string
|
||||||
}
|
}
|
||||||
|
|
||||||
/** A call's two tracks mixed into one file, ready to play from
|
/** A call's two tracks mixed into one file, ready to play from
|
||||||
@@ -197,8 +211,10 @@ export const stopRecording = () => invoke<void>('stop_recording')
|
|||||||
export const discardCurrentRecording = () => invoke<void>('discard_current_recording')
|
export const discardCurrentRecording = () => invoke<void>('discard_current_recording')
|
||||||
export const getPendingPrompt = () => invoke<PendingPrompt | null>('get_pending_prompt')
|
export const getPendingPrompt = () => invoke<PendingPrompt | null>('get_pending_prompt')
|
||||||
export const getCallBrief = (id: CallId) => invoke<CallBrief>('get_call_brief', { id })
|
export const getCallBrief = (id: CallId) => invoke<CallBrief>('get_call_brief', { id })
|
||||||
export const transcribeCall = (id: CallId) => invoke<void>('transcribe_call', { id })
|
export const transcribeCall = (id: CallId, language: string) =>
|
||||||
export const retryCall = (id: CallId) => invoke<void>('retry_call', { id })
|
invoke<void>('transcribe_call', { id, language })
|
||||||
|
export const retryCall = (id: CallId, language: string) =>
|
||||||
|
invoke<void>('retry_call', { id, language })
|
||||||
export const discardCall = (id: CallId) => invoke<void>('discard_call', { id })
|
export const discardCall = (id: CallId) => invoke<void>('discard_call', { id })
|
||||||
/** Mixes the call's tracks (or reuses the cached mix); refused while the
|
/** Mixes the call's tracks (or reuses the cached mix); refused while the
|
||||||
* call is recorded or processed and once its audio is gone. */
|
* call is recorded or processed and once its audio is gone. */
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
} from '../lib/api'
|
} from '../lib/api'
|
||||||
import CallList from '../lib/CallList.svelte'
|
import CallList from '../lib/CallList.svelte'
|
||||||
import { formatDateTime, formatDetailTime, formatMinutes } from '../lib/format'
|
import { formatDateTime, formatDetailTime, formatMinutes } from '../lib/format'
|
||||||
|
import LanguageSelect from '../lib/LanguageSelect.svelte'
|
||||||
import Player from '../lib/Player.svelte'
|
import Player from '../lib/Player.svelte'
|
||||||
import { segmentAt } from '../lib/playback'
|
import { segmentAt } from '../lib/playback'
|
||||||
import StatusPill from '../lib/StatusPill.svelte'
|
import StatusPill from '../lib/StatusPill.svelte'
|
||||||
@@ -45,6 +46,8 @@
|
|||||||
let selectedId = $state<CallId | null>(null)
|
let selectedId = $state<CallId | null>(null)
|
||||||
let detail = $state<CallDetail | null>(null)
|
let detail = $state<CallDetail | null>(null)
|
||||||
let detailError = $state('')
|
let detailError = $state('')
|
||||||
|
/** The language picked for the shown call's transcription. */
|
||||||
|
let language = $state('de')
|
||||||
let actionError = $state('')
|
let actionError = $state('')
|
||||||
let busy = $state(false)
|
let busy = $state(false)
|
||||||
|
|
||||||
@@ -109,6 +112,8 @@
|
|||||||
try {
|
try {
|
||||||
const next = await getCall(id)
|
const next = await getCall(id)
|
||||||
if (request === detailRequest && id === selectedId) {
|
if (request === detailRequest && id === selectedId) {
|
||||||
|
// A refresh of the same call keeps what the user picked.
|
||||||
|
if (next.call.id !== detail?.call.id) language = next.language
|
||||||
detail = next
|
detail = next
|
||||||
detailError = ''
|
detailError = ''
|
||||||
}
|
}
|
||||||
@@ -219,8 +224,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const transcribe = () => run(transcribeCall)
|
const transcribe = () => run((id) => transcribeCall(id, language))
|
||||||
const retry = () => run(retryCall)
|
const retry = () => run((id) => retryCall(id, language))
|
||||||
const discard = () =>
|
const discard = () =>
|
||||||
run(discardCall, () => {
|
run(discardCall, () => {
|
||||||
clearSelection()
|
clearSelection()
|
||||||
@@ -466,9 +471,11 @@
|
|||||||
{/if}
|
{/if}
|
||||||
<span class="actions">
|
<span class="actions">
|
||||||
{#if call.status === 'awaiting_decision'}
|
{#if call.status === 'awaiting_decision'}
|
||||||
|
<LanguageSelect bind:value={language} disabled={busy} />
|
||||||
<button class="btn primary" disabled={busy} onclick={transcribe}>Transkribieren</button>
|
<button class="btn primary" disabled={busy} onclick={transcribe}>Transkribieren</button>
|
||||||
<button class="btn danger" disabled={busy} onclick={discard}>Verwerfen</button>
|
<button class="btn danger" disabled={busy} onclick={discard}>Verwerfen</button>
|
||||||
{:else if call.status === 'failed'}
|
{:else if call.status === 'failed'}
|
||||||
|
<LanguageSelect bind:value={language} disabled={busy} />
|
||||||
<button class="btn primary" disabled={busy} onclick={retry}>Erneut versuchen</button>
|
<button class="btn primary" disabled={busy} onclick={retry}>Erneut versuchen</button>
|
||||||
<button class="btn danger" disabled={busy} onclick={discard}>Verwerfen</button>
|
<button class="btn danger" disabled={busy} onclick={discard}>Verwerfen</button>
|
||||||
{:else if call.status === 'done'}
|
{:else if call.status === 'done'}
|
||||||
|
|||||||
@@ -11,13 +11,19 @@
|
|||||||
type PendingPrompt,
|
type PendingPrompt,
|
||||||
} from '../lib/api'
|
} from '../lib/api'
|
||||||
import { formatMinutes, formatTimeRange } from '../lib/format'
|
import { formatMinutes, formatTimeRange } from '../lib/format'
|
||||||
|
import LanguageSelect from '../lib/LanguageSelect.svelte'
|
||||||
|
|
||||||
let brief = $state<PendingPrompt | null>(null)
|
let brief = $state<PendingPrompt | null>(null)
|
||||||
let busy = $state(false)
|
let busy = $state(false)
|
||||||
let error = $state('')
|
let error = $state('')
|
||||||
|
let language = $state('de')
|
||||||
|
|
||||||
function show(next: PendingPrompt | null) {
|
function show(next: PendingPrompt | null) {
|
||||||
if (next?.id !== brief?.id) error = ''
|
// A refresh of the same call keeps what the user picked.
|
||||||
|
if (next?.id !== brief?.id) {
|
||||||
|
error = ''
|
||||||
|
if (next) language = next.language
|
||||||
|
}
|
||||||
brief = next
|
brief = next
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,6 +60,8 @@
|
|||||||
busy = false
|
busy = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const transcribe = () => run((id) => transcribeCall(id, language))
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<main class="prompt">
|
<main class="prompt">
|
||||||
@@ -64,7 +72,8 @@
|
|||||||
<div class="muted">Weitere Gespräche warten: {brief.more_waiting}</div>
|
<div class="muted">Weitere Gespräche warten: {brief.more_waiting}</div>
|
||||||
{/if}
|
{/if}
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<button class="btn primary" disabled={busy} onclick={() => run(transcribeCall)}>
|
<LanguageSelect bind:value={language} disabled={busy} />
|
||||||
|
<button class="btn primary" disabled={busy} onclick={transcribe}>
|
||||||
Transkribieren
|
Transkribieren
|
||||||
</button>
|
</button>
|
||||||
<button class="btn danger" disabled={busy} onclick={() => run(discardCall)}>Verwerfen</button>
|
<button class="btn danger" disabled={busy} onclick={() => run(discardCall)}>Verwerfen</button>
|
||||||
|
|||||||
@@ -482,11 +482,6 @@
|
|||||||
<section class="card">
|
<section class="card">
|
||||||
<h2>Allgemein</h2>
|
<h2>Allgemein</h2>
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
<label for="language">Sprache der Gespräche</label>
|
|
||||||
<select id="language" bind:value={settings.language}>
|
|
||||||
<option value="de">Deutsch</option>
|
|
||||||
<option value="en">Englisch</option>
|
|
||||||
</select>
|
|
||||||
<label for="retention">Aufbewahrung der Audiodateien</label>
|
<label for="retention">Aufbewahrung der Audiodateien</label>
|
||||||
<span><input id="retention" type="number" min="1" max="3650" bind:value={settings.retention_days} /> Tage</span>
|
<span><input id="retention" type="number" min="1" max="3650" bind:value={settings.retention_days} /> Tage</span>
|
||||||
<span></span>
|
<span></span>
|
||||||
|
|||||||
Reference in New Issue
Block a user