fix: Transcript isContinuation - merged STT-Chunks updaten statt duplizieren
Made-with: Cursor
This commit is contained in:
parent
3aef70ab5f
commit
0dbcad771b
2 changed files with 15 additions and 1 deletions
|
|
@ -33,6 +33,8 @@ export interface TeamsbotTranscript {
|
|||
confidence: number;
|
||||
language?: string;
|
||||
isFinal: boolean;
|
||||
isContinuation?: boolean;
|
||||
source?: string;
|
||||
}
|
||||
|
||||
export interface TeamsbotBotResponse {
|
||||
|
|
|
|||
|
|
@ -126,7 +126,19 @@ export const TeamsbotSessionView: React.FC = () => {
|
|||
case 'transcript': {
|
||||
const t = sseEvent.data as TeamsbotTranscript;
|
||||
_dlog('TRANSCRIPT', `[${t?.speaker || '?'}] ${(t?.text || '').substring(0, 50)}...`);
|
||||
if (t?.isContinuation && t?.id) {
|
||||
setTranscripts(prev => {
|
||||
const idx = prev.findIndex(x => x.id === t.id);
|
||||
if (idx >= 0) {
|
||||
const updated = [...prev];
|
||||
updated[idx] = { ...updated[idx], ...t };
|
||||
return updated;
|
||||
}
|
||||
return [...prev, t];
|
||||
});
|
||||
} else {
|
||||
setTranscripts(prev => [...prev, t]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue