From 40d8605fead5dfd2d033acb2fb95ff2d4dbc2056 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Fri, 9 Feb 2024 16:37:21 -0800 Subject: [PATCH] fix: tts playback --- src/lib/components/chat/Settings/Interface.svelte | 1 - src/lib/components/chat/Settings/Voice.svelte | 3 +++ src/routes/(app)/+page.svelte | 2 ++ src/routes/(app)/c/[id]/+page.svelte | 2 ++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lib/components/chat/Settings/Interface.svelte b/src/lib/components/chat/Settings/Interface.svelte index 3d831d5e..45be9adb 100644 --- a/src/lib/components/chat/Settings/Interface.svelte +++ b/src/lib/components/chat/Settings/Interface.svelte @@ -62,7 +62,6 @@ let settings = JSON.parse(localStorage.getItem('settings') ?? '{}'); titleAutoGenerate = settings.titleAutoGenerate ?? true; - speechAutoSend = settings.speechAutoSend ?? false; responseAutoCopy = settings.responseAutoCopy ?? false; showUsername = settings.showUsername ?? false; titleAutoGenerateModel = settings.titleAutoGenerateModel ?? ''; diff --git a/src/lib/components/chat/Settings/Voice.svelte b/src/lib/components/chat/Settings/Voice.svelte index 2656626b..dc201069 100644 --- a/src/lib/components/chat/Settings/Voice.svelte +++ b/src/lib/components/chat/Settings/Voice.svelte @@ -50,6 +50,9 @@ onMount(async () => { let settings = JSON.parse(localStorage.getItem('settings') ?? '{}'); + speechAutoSend = settings.speechAutoSend ?? false; + responseAutoPlayback = settings.responseAutoPlayback ?? false; + engine = settings?.speech?.engine ?? ''; speaker = settings?.speech?.speaker ?? ''; diff --git a/src/routes/(app)/+page.svelte b/src/routes/(app)/+page.svelte index b213a5d4..a01e4d36 100644 --- a/src/routes/(app)/+page.svelte +++ b/src/routes/(app)/+page.svelte @@ -450,6 +450,7 @@ } if ($settings.responseAutoPlayback) { + await tick(); document.getElementById(`speak-button-${responseMessage.id}`)?.click(); } } @@ -638,6 +639,7 @@ } if ($settings.responseAutoPlayback) { + await tick(); document.getElementById(`speak-button-${responseMessage.id}`)?.click(); } diff --git a/src/routes/(app)/c/[id]/+page.svelte b/src/routes/(app)/c/[id]/+page.svelte index 58fbc046..4ff1f3bd 100644 --- a/src/routes/(app)/c/[id]/+page.svelte +++ b/src/routes/(app)/c/[id]/+page.svelte @@ -464,6 +464,7 @@ } if ($settings.responseAutoPlayback) { + await tick(); document.getElementById(`speak-button-${responseMessage.id}`)?.click(); } } @@ -652,6 +653,7 @@ } if ($settings.responseAutoPlayback) { + await tick(); document.getElementById(`speak-button-${responseMessage.id}`)?.click(); }