fix: use appConfig correctly in getVoices

This commit is contained in:
Danny Avila 2025-08-28 00:51:22 -04:00
parent c0511b9a5f
commit 1764de53a5
No known key found for this signature in database
GPG key ID: BF31EEB2C5CA0956

View file

@ -14,16 +14,18 @@ const { getProvider } = require('./TTSService');
*/ */
async function getVoices(req, res) { async function getVoices(req, res) {
try { try {
const appConfig = await getAppConfig({ const appConfig =
role: req.user?.role, req.config ??
}); (await getAppConfig({
role: req.user?.role,
}));
if (!appConfig || !appConfig?.speech?.tts) { const ttsSchema = appConfig?.speech?.tts;
if (!ttsSchema) {
throw new Error('Configuration or TTS schema is missing'); throw new Error('Configuration or TTS schema is missing');
} }
const ttsSchema = appConfig?.speech?.tts; const provider = await getProvider(appConfig);
const provider = await getProvider(ttsSchema);
let voices; let voices;
switch (provider) { switch (provider) {