MCPcopy Create free account
hub / github.com/FlowiseAI/Flowise / handleTTSDataChunk

Function handleTTSDataChunk

packages/ui/src/views/chatmessage/ChatMessage.jsx:2039–2058  ·  view source on GitHub ↗
(base64Data)

Source from the content-addressed store, hash-verified

2037 }
2038
2039 const handleTTSDataChunk = (base64Data) => {
2040 try {
2041 const audioBuffer = Uint8Array.from(atob(base64Data), (c) => c.charCodeAt(0))
2042
2043 setTtsStreamingState((prevState) => {
2044 const newState = {
2045 ...prevState,
2046 chunkQueue: [...prevState.chunkQueue, audioBuffer]
2047 }
2048
2049 if (prevState.sourceBuffer && !prevState.sourceBuffer.updating) {
2050 setTimeout(() => processChunkQueue(), 0)
2051 }
2052
2053 return newState
2054 })
2055 } catch (error) {
2056 console.error('Error handling TTS data chunk:', error)
2057 }
2058 }
2059
2060 const handleTTSEnd = () => {
2061 setTtsStreamingState((prevState) => {

Callers 2

onmessageFunction · 0.85
handleTTSClickFunction · 0.85

Calls 1

processChunkQueueFunction · 0.85

Tested by

no test coverage detected