mirror of
https://github.com/R0m1k3/Socialflow.git
synced 2026-10-11 17:26:45 +02:00
Fix sync-info route to use ttsEngine and ttsVoice
- ttsSyncService.calculateSyncTiming now accepts ttsEngine parameter - sync-info route extracts ttsVoice/ttsEngine from req.body instead of voice - Previously it always fell back to Edge TTS even when Gemini was selected (because server stored 'fr-FR-Standard-B' but route only used 'voice')
This commit is contained in:
1 parent
6ff8f6b283
commit
a9cda4ffd4
2 files changed
+5
-5
No files matched your search
@@ -394,11 +394,11 @@ reelsRouter.post('/reels/tts-preview', async (req: Request, res: Response) => {
|
||||
*/
|
||||
reelsRouter.post('/reels/sync-info', async (req: Request, res: Response) => {
|
||||
try {
|
||||
const { text, voice } = req.body;
|
||||
if (!text || !voice) {
|
||||
const { text, ttsVoice, ttsEngine } = req.body;
|
||||
if (!text || !ttsVoice) {
|
||||
return res.status(400).json({ error: 'Texte et voix requis' });
|
||||
}
|
||||
const sync = await ttsSyncService.calculateSyncTiming(text, voice);
|
||||
const sync = await ttsSyncService.calculateSyncTiming(text, ttsVoice, ttsEngine);
|
||||
res.json(sync);
|
||||
} catch (error) {
|
||||
console.error('❌ Error calculating sync:', error);
|
||||
|
||||
@@ -15,11 +15,11 @@ export class TtsSyncService {
|
||||
* Calcule le word_duration optimal pour synchroniser l'affichage du texte
|
||||
* avec la durée réelle de la voix TTS générée.
|
||||
*/
|
||||
async calculateSyncTiming(text: string, voice: string): Promise<SyncTiming> {
|
||||
async calculateSyncTiming(text: string, voice: string, ttsEngine?: string): Promise<SyncTiming> {
|
||||
const cleanText = this.cleanText(text);
|
||||
|
||||
// 1. Générer le TTS preview et mesurer sa durée exacte
|
||||
const ttsResult = await ffmpegService.previewTTS(cleanText, voice);
|
||||
const ttsResult = await ffmpegService.previewTTS(cleanText, voice, ttsEngine);
|
||||
if (!ttsResult.success || !ttsResult.audioBase64) {
|
||||
throw new Error('TTS preview failed: ' + (ttsResult.error || 'unknown'));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user