From 1da5ea528016e8ba2932232f19803e656d7b44e2 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Mon, 21 Aug 2023 14:40:38 +0300 Subject: [PATCH] #988 Experimental fix for 11labs --- public/scripts/extensions/tts/elevenlabs.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/public/scripts/extensions/tts/elevenlabs.js b/public/scripts/extensions/tts/elevenlabs.js index 72c180cee..fce176b32 100644 --- a/public/scripts/extensions/tts/elevenlabs.js +++ b/public/scripts/extensions/tts/elevenlabs.js @@ -1,3 +1,5 @@ +import { deepClone } from "../../utils.js"; + export { ElevenLabsTtsProvider } class ElevenLabsTtsProvider { @@ -47,18 +49,20 @@ class ElevenLabsTtsProvider { loadSettings(settings) { // Pupulate Provider UI given input settings - if (Object.keys(settings).length == 0) { + if (!settings || Object.keys(settings).length == 0) { console.info("Using default TTS Provider settings") } // Only accept keys defined in defaultSettings - this.settings = this.defaultSettings + this.settings = deepClone(this.defaultSettings); - for (const key in settings){ - if (key in this.settings){ - this.settings[key] = settings[key] - } else { - throw `Invalid setting passed to TTS Provider: ${key}` + if (settings) { + for (const key in settings) { + if (key in this.settings) { + this.settings[key] = settings[key] + } else { + throw `Invalid setting passed to TTS Provider: ${key}` + } } }