Pass Gemini API key in /reels/tts-preview route

The TTS preview route hardcoded the Gemini API key to undefined when
calling the ffmpeg service, causing the service to silently fall back to
Edge TTS even when the user selected Gemini. Mirror the lookup already
used in the reel processing route so the selected engine is honored.

https://claude.ai/code/session_01QBvwHAMZzVYfWvy1U5paat
This commit is contained in:
Claude committed 2026-05-19 12:49:16 +00:00
1 parent a146705d15
commit e2002cf163
1 file changed
+7 -1
+7 -1
View File
@@ -375,7 +375,13 @@ reelsRouter.post('/reels/tts-preview', async (req: Request, res: Response) => {
return res.status(400).json({ error: 'Texte requis' });
}
const result = await ffmpegService.previewTTS(text, ttsVoice, ttsEngine, undefined);
let geminiApiKey: string | undefined = undefined;
if (ttsEngine === "gemini") {
const appCfg = await storage.getAppConfig();
geminiApiKey = appCfg?.geminiApiKey ?? undefined;
}
const result = await ffmpegService.previewTTS(text, ttsVoice, ttsEngine, geminiApiKey);
if (!result.success) {
return res.status(500).json({ error: result.error || 'Erreur de génération TTS' });