fix: no text displayed during mic capture
DashScope realtime ASR sends utterance-completed (final) events without incremental deltas. The onmessage handler cleared partialTranscript on every final, so text never appeared. Set partialTranscript to full_text on final messages instead of clearing it, keeping the transcript visible in QueryInput.
This commit is contained in:
parent
7c03137577
commit
624df8cf9a
|
|
@ -142,7 +142,7 @@ export function useMediaStreamASR({ wsUrl }: UseMediaStreamASRProps): UseMediaSt
|
||||||
transcriptRef.current = msg.full_text
|
transcriptRef.current = msg.full_text
|
||||||
lastStashRef.current = ''
|
lastStashRef.current = ''
|
||||||
setTranscript(msg.full_text)
|
setTranscript(msg.full_text)
|
||||||
setPartialTranscript('')
|
setPartialTranscript(msg.full_text)
|
||||||
} else if (msg.delta) {
|
} else if (msg.delta) {
|
||||||
transcriptRef.current += msg.delta
|
transcriptRef.current += msg.delta
|
||||||
lastStashRef.current = (msg as any).stash || ''
|
lastStashRef.current = (msg as any).stash || ''
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue