diff --git a/api/server/services/Files/Audio/getCustomConfigSpeech.js b/api/server/services/Files/Audio/getCustomConfigSpeech.js index d22a143574..a0fd23e3fa 100644 --- a/api/server/services/Files/Audio/getCustomConfigSpeech.js +++ b/api/server/services/Files/Audio/getCustomConfigSpeech.js @@ -1,4 +1,5 @@ const getCustomConfig = require('~/server/services/Config/getCustomConfig'); +const { logger } = require('~/config'); /** * This function retrieves the speechTab settings from the custom configuration @@ -15,6 +16,13 @@ const getCustomConfig = require('~/server/services/Config/getCustomConfig'); async function getCustomConfigSpeech(req, res) { try { const customConfig = await getCustomConfig(); + + if (!customConfig) { + return res.status(200).send({ + message: 'not_found', + }); + } + const sttExternal = !!customConfig.speech?.stt; const ttsExternal = !!customConfig.speech?.tts; let settings = { @@ -22,7 +30,7 @@ async function getCustomConfigSpeech(req, res) { ttsExternal, }; - if (!customConfig || !customConfig.speech?.speechTab) { + if (!customConfig.speech?.speechTab) { return res.status(200).send(settings); } @@ -50,7 +58,7 @@ async function getCustomConfigSpeech(req, res) { return res.status(200).send(settings); } catch (error) { - console.error('Failed to get custom config speech settings:', error); + logger.error('Failed to get custom config speech settings:', error); res.status(500).send('Internal Server Error'); } } diff --git a/client/src/components/Nav/SettingsTabs/Speech/Speech.tsx b/client/src/components/Nav/SettingsTabs/Speech/Speech.tsx index 6ae78c0655..779c32ef93 100644 --- a/client/src/components/Nav/SettingsTabs/Speech/Speech.tsx +++ b/client/src/components/Nav/SettingsTabs/Speech/Speech.tsx @@ -127,7 +127,7 @@ function Speech() { ); useEffect(() => { - if (data) { + if (data && data.message !== 'not_found') { Object.entries(data).forEach(([key, value]) => { updateSetting(key, value); });