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]}...")
async def _on_speech_start(self) -> None:
@@ -463,14 +465,16 @@ class DuplexPipeline:
logger.info(f"EOU detected - user said: {user_text[:100]}...")
# Send final transcription to client
await self.transport.send_event({
**ev(
"transcript.final",
trackId=self.session_id,
text=user_text,
)
})
# 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({
**ev(
"transcript.final",
trackId=self.session_id,
text=user_text,
)
})
# Clear buffers
self._audio_buffer = b""