From 8af1646706d64df2474ccf09a0053e5e4969d974 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Wed, 29 Nov 2023 13:21:35 -0800 Subject: [PATCH] feat: tts support --- src/lib/components/chat/Messages.svelte | 29 +++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/lib/components/chat/Messages.svelte b/src/lib/components/chat/Messages.svelte index 5aff5099b..6f32df9a7 100644 --- a/src/lib/components/chat/Messages.svelte +++ b/src/lib/components/chat/Messages.svelte @@ -28,6 +28,11 @@ })(); } + const speakMessage = (message) => { + const speak = new SpeechSynthesisUtterance(message); + speechSynthesis.speak(speak); + }; + const createCopyCodeBlockButton = () => { // use a class selector if available let blocks = document.querySelectorAll('pre'); @@ -692,6 +697,30 @@ > + + {#if messageIdx + 1 === messages.length}