Update asr interim

This commit is contained in:
Xin Wang
2026-02-09 17:24:15 +08:00
parent b52cd65848
commit 088943166c
2 changed files with 16 additions and 18 deletions

View File

@@ -414,6 +414,8 @@ class DuplexPipeline:
) )
}) })
if not is_final:
logger.info(f"ASR interim: {text[:100]}")
logger.debug(f"Sent transcript ({'final' if is_final else 'interim'}): {text[:50]}...") logger.debug(f"Sent transcript ({'final' if is_final else 'interim'}): {text[:50]}...")
async def _on_speech_start(self) -> None: async def _on_speech_start(self) -> None:
@@ -463,7 +465,9 @@ class DuplexPipeline:
logger.info(f"EOU detected - user said: {user_text[:100]}...") logger.info(f"EOU detected - user said: {user_text[:100]}...")
# Send final transcription to client # For ASR backends that already emitted final via callback,
# avoid duplicating transcript.final on EOU.
if user_text != self._last_sent_transcript:
await self.transport.send_event({ await self.transport.send_event({
**ev( **ev(
"transcript.final", "transcript.final",

View File

@@ -1703,17 +1703,11 @@ export const DebugDrawer: React.FC<{
} }
const last = prev[prev.length - 1]; const last = prev[prev.length - 1];
if (last?.role === 'user') { if (last?.role === 'user') {
if (last.text === finalText) {
lastUserFinalRef.current = finalText;
return prev;
}
if (finalText.startsWith(last.text) || last.text.startsWith(finalText)) {
const next = [...prev]; const next = [...prev];
next[next.length - 1] = { ...last, text: finalText }; next[next.length - 1] = { ...last, text: finalText };
lastUserFinalRef.current = finalText; lastUserFinalRef.current = finalText;
return next; return next;
} }
}
lastUserFinalRef.current = finalText; lastUserFinalRef.current = finalText;
return [...prev, { role: 'user', text: finalText }]; return [...prev, { role: 'user', text: finalText }];
}); });