()
| 1747 | } |
| 1748 | |
| 1749 | const stopAllTTS = () => { |
| 1750 | Object.keys(ttsAudio).forEach((messageId) => { |
| 1751 | if (ttsAudio[messageId]) { |
| 1752 | ttsAudio[messageId].pause() |
| 1753 | ttsAudio[messageId].currentTime = 0 |
| 1754 | } |
| 1755 | }) |
| 1756 | setTtsAudio({}) |
| 1757 | |
| 1758 | if (ttsStreamingState.abortController) { |
| 1759 | ttsStreamingState.abortController.abort() |
| 1760 | } |
| 1761 | |
| 1762 | if (ttsStreamingState.audio) { |
| 1763 | ttsStreamingState.audio.pause() |
| 1764 | cleanupTTSStreaming() |
| 1765 | } |
| 1766 | |
| 1767 | setIsTTSPlaying({}) |
| 1768 | setIsTTSLoading({}) |
| 1769 | } |
| 1770 | |
| 1771 | const handleTTSClick = async (messageId, messageText) => { |
| 1772 | if (isTTSLoading[messageId]) return |
no test coverage detected