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:
+13
-12
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user