fix #14740: attribute teams helper processes, queue end-of-call prompts

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
hauke
2026-11-05 15:48:55 +01:00
co-authored by Claude Opus 5.5
parent d631252600
commit bac30205d6
7 changed files with 527 additions and 93 deletions
+6 -1
View File
@@ -49,6 +49,11 @@ export interface CallBrief {
duration_secs: number
}
/** The call the end-of-call prompt shows, and how many wait behind it. */
export interface PendingPrompt extends CallBrief {
more_waiting: number
}
export interface Levels {
mic: number
out: number
@@ -66,7 +71,7 @@ export const getRecordingState = () => invoke<RecordingState>('get_recording_sta
export const startManualRecording = () => invoke<CallId>('start_manual_recording')
export const stopRecording = () => invoke<void>('stop_recording')
export const discardCurrentRecording = () => invoke<void>('discard_current_recording')
export const getPendingPrompt = () => invoke<CallBrief | 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 transcribeCall = (id: CallId) => invoke<void>('transcribe_call', { id })
export const discardCall = (id: CallId) => invoke<void>('discard_call', { id })
+13 -12
View File
@@ -3,38 +3,33 @@
import {
discardCall,
errorText,
getCallBrief,
getPendingPrompt,
onCallEnded,
transcribeCall,
type CallBrief,
type CallId,
type PendingPrompt,
} from '../lib/api'
import { formatMinutes, formatTimeRange } from '../lib/format'
let brief = $state<CallBrief | null>(null)
let brief = $state<PendingPrompt | null>(null)
let busy = $state(false)
let error = $state('')
function show(next: CallBrief | null) {
function show(next: PendingPrompt | null) {
if (next?.id !== brief?.id) error = ''
brief = next
}
// The window stays loaded while hidden, so it may have missed the event:
// ask the backend whenever it is shown again.
// The backend queues ended calls; this window always shows the oldest.
// It stays loaded while hidden and may have missed an event, so it also
// asks whenever it is shown again.
const refresh = () =>
getPendingPrompt()
.then(show)
.catch((err) => (error = errorText(err)))
const load = (id: CallId) =>
getCallBrief(id)
.then(show)
.catch((err) => (error = errorText(err)))
onMount(() => {
const unlisten = onCallEnded(load)
const unlisten = onCallEnded(refresh)
refresh()
window.addEventListener('focus', refresh)
return () => {
@@ -49,6 +44,9 @@
error = ''
try {
await action(brief.id)
// Decided: show the next queued call (the backend hides the window
// once none is left).
await refresh()
} catch (err) {
error = errorText(err)
} finally {
@@ -61,6 +59,9 @@
{#if brief}
<div class="title">{brief.app} · {formatMinutes(brief.duration_secs)}</div>
<div class="muted">{formatTimeRange(brief.started_at, brief.ended_at)}</div>
{#if brief.more_waiting > 0}
<div class="muted">Weitere Gespräche warten: {brief.more_waiting}</div>
{/if}
<div class="actions">
<button class="btn primary" disabled={busy} onclick={() => run(transcribeCall)}>
Transkribieren