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;
|
confidence: number;
|
||||||
language?: string;
|
language?: string;
|
||||||
isFinal: boolean;
|
isFinal: boolean;
|
||||||
|
isContinuation?: boolean;
|
||||||
|
source?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TeamsbotBotResponse {
|
export interface TeamsbotBotResponse {
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,19 @@ export const TeamsbotSessionView: React.FC = () => {
|
||||||
case 'transcript': {
|
case 'transcript': {
|
||||||
const t = sseEvent.data as TeamsbotTranscript;
|
const t = sseEvent.data as TeamsbotTranscript;
|
||||||
_dlog('TRANSCRIPT', `[${t?.speaker || '?'}] ${(t?.text || '').substring(0, 50)}...`);
|
_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]);
|
setTranscripts(prev => [...prev, t]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue