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) {
try {
const appConfig = await getAppConfig({
role: req.user?.role,
});
const appConfig =
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');
}
const ttsSchema = appConfig?.speech?.tts;
const provider = await getProvider(ttsSchema);
const provider = await getProvider(appConfig);
let voices;
switch (provider) {