diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index d4944c6..172730a 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -36,7 +36,7 @@ "label": "prompt", "title": "Gespräch beendet", "url": "index.html#/prompt", - "width": 340, + "width": 400, "height": 180, "alwaysOnTop": true, "visible": false, diff --git a/ui/src/lib/LanguageSelect.svelte b/ui/src/lib/LanguageSelect.svelte new file mode 100644 index 0000000..26932de --- /dev/null +++ b/ui/src/lib/LanguageSelect.svelte @@ -0,0 +1,13 @@ + + + diff --git a/ui/src/lib/api.ts b/ui/src/lib/api.ts index 85079fa..7fff14e 100644 --- a/ui/src/lib/api.ts +++ b/ui/src/lib/api.ts @@ -5,10 +5,20 @@ import { listen, type UnlistenFn } from '@tauri-apps/api/event' 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 { allowlist: string[] mic_device: string | null output_device: string | null + /** Language of the transcription started last; set by the app, not the settings page. */ language: string deepscript_model: string /** Custom words/names submitted with every transcription. */ @@ -72,6 +82,8 @@ export interface CallBrief { started_at: string ended_at: string | null 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. */ @@ -144,6 +156,8 @@ export interface CallDetail { audio_available: boolean /** Retention deleted the call's audio (not just: the files are missing). */ 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 @@ -197,8 +211,10 @@ export const stopRecording = () => invoke('stop_recording') export const discardCurrentRecording = () => invoke('discard_current_recording') export const getPendingPrompt = () => invoke('get_pending_prompt') export const getCallBrief = (id: CallId) => invoke('get_call_brief', { id }) -export const transcribeCall = (id: CallId) => invoke('transcribe_call', { id }) -export const retryCall = (id: CallId) => invoke('retry_call', { id }) +export const transcribeCall = (id: CallId, language: string) => + invoke('transcribe_call', { id, language }) +export const retryCall = (id: CallId, language: string) => + invoke('retry_call', { id, language }) export const discardCall = (id: CallId) => invoke('discard_call', { id }) /** Mixes the call's tracks (or reuses the cached mix); refused while the * call is recorded or processed and once its audio is gone. */ diff --git a/ui/src/routes/Main.svelte b/ui/src/routes/Main.svelte index 882eb22..c8b6f30 100644 --- a/ui/src/routes/Main.svelte +++ b/ui/src/routes/Main.svelte @@ -28,6 +28,7 @@ } from '../lib/api' import CallList from '../lib/CallList.svelte' import { formatDateTime, formatDetailTime, formatMinutes } from '../lib/format' + import LanguageSelect from '../lib/LanguageSelect.svelte' import Player from '../lib/Player.svelte' import { segmentAt } from '../lib/playback' import StatusPill from '../lib/StatusPill.svelte' @@ -45,6 +46,8 @@ let selectedId = $state(null) let detail = $state(null) let detailError = $state('') + /** The language picked for the shown call's transcription. */ + let language = $state('de') let actionError = $state('') let busy = $state(false) @@ -109,6 +112,8 @@ try { const next = await getCall(id) 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 detailError = '' } @@ -219,8 +224,8 @@ } } - const transcribe = () => run(transcribeCall) - const retry = () => run(retryCall) + const transcribe = () => run((id) => transcribeCall(id, language)) + const retry = () => run((id) => retryCall(id, language)) const discard = () => run(discardCall, () => { clearSelection() @@ -466,9 +471,11 @@ {/if} {#if call.status === 'awaiting_decision'} + {:else if call.status === 'failed'} + {:else if call.status === 'done'} diff --git a/ui/src/routes/Prompt.svelte b/ui/src/routes/Prompt.svelte index 83ec83c..35fdc7d 100644 --- a/ui/src/routes/Prompt.svelte +++ b/ui/src/routes/Prompt.svelte @@ -11,13 +11,19 @@ type PendingPrompt, } from '../lib/api' import { formatMinutes, formatTimeRange } from '../lib/format' + import LanguageSelect from '../lib/LanguageSelect.svelte' let brief = $state(null) let busy = $state(false) let error = $state('') + let language = $state('de') 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 } @@ -54,6 +60,8 @@ busy = false } } + + const transcribe = () => run((id) => transcribeCall(id, language))
@@ -64,7 +72,8 @@
Weitere Gespräche warten: {brief.more_waiting}
{/if}
- diff --git a/ui/src/routes/Settings.svelte b/ui/src/routes/Settings.svelte index 38d1bba..6d1f5df 100644 --- a/ui/src/routes/Settings.svelte +++ b/ui/src/routes/Settings.svelte @@ -482,11 +482,6 @@

Allgemein

- - Tage