Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

🔧 fix: handle missing custom config speech (#3790)

Marco Beretta62881fee54b6
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);
});