fix: mic transcript disappearing after stop

useMediaStreamASR cleanup() cleared partialTranscript on stop,
causing live ASR text to vanish from QueryInput. Unlike video
ASR (which has onFinalTranscript to persist via queryText),
mic and system-audio hooks rely on partialTranscript for
display. Keep partialTranscript populated with the final
transcript instead of clearing it.
This commit is contained in:
Woody 2026-05-14 23:19:11 +08:00
parent 7bff4308b7
commit 7c03137577
1 changed files with 4 additions and 1 deletions

View File

@ -48,7 +48,10 @@ export function useMediaStreamASR({ wsUrl }: UseMediaStreamASRProps): UseMediaSt
lastStashRef.current = '' lastStashRef.current = ''
if (currentText) { if (currentText) {
setTranscript(currentText) setTranscript(currentText)
setPartialTranscript('') // Keep partialTranscript populated so the text remains visible in QueryInput
// after the user stops capture/listening. Unlike video ASR, mic/system-audio
// hooks have no onFinalTranscript callback to persist via queryText.
setPartialTranscript(currentText)
} }
if (streamRef.current) { if (streamRef.current) {