feat #14740: merge speakers and name calls
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+114
-3
@@ -6,14 +6,17 @@
|
||||
getCall,
|
||||
listAccounts,
|
||||
listCalls,
|
||||
mergeSpeakers,
|
||||
onCallEnded,
|
||||
onCallUpdated,
|
||||
onPromptChanged,
|
||||
onRecordingState,
|
||||
renameCall,
|
||||
renameSpeaker,
|
||||
retryCall,
|
||||
setAccount,
|
||||
transcribeCall,
|
||||
unmergeSpeaker,
|
||||
type Account,
|
||||
type CallDetail,
|
||||
type CallId,
|
||||
@@ -36,6 +39,11 @@
|
||||
let busy = $state(false)
|
||||
let tab = $state<'summary' | 'transcript'>('transcript')
|
||||
|
||||
let editingTitle = $state(false)
|
||||
let titleDraft = $state('')
|
||||
let savingTitle = $state(false)
|
||||
let titleError = $state('')
|
||||
|
||||
// Answers can arrive out of order; only the newest request is applied.
|
||||
let listRequest = 0
|
||||
let detailRequest = 0
|
||||
@@ -84,6 +92,8 @@
|
||||
detail = null
|
||||
detailError = ''
|
||||
actionError = ''
|
||||
editingTitle = false
|
||||
titleError = ''
|
||||
refreshDetail()
|
||||
}
|
||||
|
||||
@@ -92,6 +102,8 @@
|
||||
detail = null
|
||||
detailError = ''
|
||||
actionError = ''
|
||||
editingTitle = false
|
||||
titleError = ''
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
@@ -155,8 +167,51 @@
|
||||
await refreshDetail()
|
||||
}
|
||||
|
||||
async function merge(fromKey: string, intoKey: string) {
|
||||
if (!detail) return
|
||||
await mergeSpeakers(detail.call.id, fromKey, intoKey)
|
||||
await refreshDetail()
|
||||
}
|
||||
|
||||
async function unmerge(fromKey: string) {
|
||||
if (!detail) return
|
||||
await unmergeSpeaker(detail.call.id, fromKey)
|
||||
await refreshDetail()
|
||||
}
|
||||
|
||||
function startTitleEdit() {
|
||||
titleDraft = detail?.call.title ?? ''
|
||||
titleError = ''
|
||||
editingTitle = true
|
||||
}
|
||||
|
||||
/** Enter saves the title (empty restores the default), Esc cancels. */
|
||||
async function titleKeydown(event: KeyboardEvent) {
|
||||
if (event.key === 'Escape') {
|
||||
editingTitle = false
|
||||
titleError = ''
|
||||
} else if (event.key === 'Enter' && detail && !savingTitle) {
|
||||
savingTitle = true
|
||||
titleError = ''
|
||||
try {
|
||||
await renameCall(detail.call.id, titleDraft.trim() || null)
|
||||
editingTitle = false
|
||||
await Promise.all([refreshList(), refreshDetail()])
|
||||
} catch (err) {
|
||||
titleError = errorText(err)
|
||||
} finally {
|
||||
savingTitle = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function focus(node: HTMLInputElement) {
|
||||
node.focus()
|
||||
node.select()
|
||||
}
|
||||
|
||||
/** "Microsoft Teams · heute 10:14 · 32 min" (no duration while recording). */
|
||||
function title(call: CallListItem): string {
|
||||
function defaultTitle(call: CallListItem): string {
|
||||
const parts = [call.app, formatDetailTime(call.started_at)]
|
||||
if (call.status !== 'recording') parts.push(formatMinutes(call.duration_secs))
|
||||
return parts.join(' · ')
|
||||
@@ -195,9 +250,32 @@
|
||||
{@const call = detail.call}
|
||||
<header class="detail-header">
|
||||
<div class="heading">
|
||||
<h1>{title(call)}</h1>
|
||||
{#if editingTitle}
|
||||
<input
|
||||
class="title-input"
|
||||
aria-label="Titel des Gesprächs"
|
||||
placeholder={defaultTitle(call)}
|
||||
disabled={savingTitle}
|
||||
bind:value={titleDraft}
|
||||
onkeydown={titleKeydown}
|
||||
use:focus
|
||||
/>
|
||||
{:else}
|
||||
<h1>
|
||||
{call.title ?? defaultTitle(call)}
|
||||
<button class="edit-title" title="Titel ändern" onclick={startTitleEdit}>✎</button>
|
||||
</h1>
|
||||
{/if}
|
||||
<StatusPill status={call.status} interrupted={call.interrupted} />
|
||||
</div>
|
||||
{#if editingTitle}
|
||||
<p class="muted subline">Enter speichert, Esc bricht ab. Leer = Standardtitel.</p>
|
||||
{:else if call.title}
|
||||
<p class="muted subline">{defaultTitle(call)}</p>
|
||||
{/if}
|
||||
{#if titleError}
|
||||
<p class="error">{titleError}</p>
|
||||
{/if}
|
||||
<div class="toolbar">
|
||||
<label class="customer">
|
||||
<span>Kunde:</span>
|
||||
@@ -262,7 +340,13 @@
|
||||
{#if tab === 'summary'}
|
||||
<p class="muted">Die Zusammenfassung kommt in einer späteren Version.</p>
|
||||
{:else}
|
||||
<TranscriptView segments={detail.segments} onrename={rename} />
|
||||
<TranscriptView
|
||||
segments={detail.segments}
|
||||
merges={detail.merges}
|
||||
onrename={rename}
|
||||
onmerge={merge}
|
||||
onunmerge={unmerge}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
@@ -348,6 +432,33 @@
|
||||
|
||||
.heading h1 {
|
||||
font-size: 18px;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.edit-title {
|
||||
border: none;
|
||||
background: none;
|
||||
color: var(--muted);
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
padding: 0 4px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.edit-title:hover {
|
||||
color: var(--primary);
|
||||
}
|
||||
|
||||
.title-input {
|
||||
flex: 1 1 260px;
|
||||
max-width: 520px;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.subline {
|
||||
margin: 4px 0 0;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.toolbar {
|
||||
|
||||
Reference in New Issue
Block a user