main
Backend Deploy 🚀 / build-and-deploy (push) Has been cancelled

This commit is contained in:
Harun CAN
2026-05-31 14:13:33 +03:00
parent 76a244af90
commit f89923b03f
3 changed files with 60 additions and 10 deletions
+17 -5
View File
@@ -93,21 +93,25 @@ public class VideoRenderPipeline
_logger.LogInformation("🎙️ Adım 2/5: TTS narration üretimi");
var voiceStyle = job.ScriptJson?.VoiceStyle ?? "Deep authoritative male voice";
var ttsTasks = new List<Task<GeneratedMediaFile>>();
var ttsResults = new List<GeneratedMediaFile>();
foreach (var scene in scenes)
{
ttsTasks.Add(GenerateTtsWithProgress(
var result = await GenerateTtsWithProgress(
scene, projectDir, voiceStyle,
() =>
{
completedSteps++;
var progress = (int)(completedSteps / (double)totalSteps * 40); // TTS %0-40
return progressCallback(progress, "TTS_GENERATION");
}, ct));
}, ct);
ttsResults.Add(result);
// Rate limit (429 Too Many Requests) yememek için sahneler arası 1 saniye bekle
await Task.Delay(1000, ct);
}
var ttsResults = await Task.WhenAll(ttsTasks);
allMediaFiles.AddRange(ttsResults);
// ═══════════════════════════════════════
@@ -273,7 +277,15 @@ public class VideoRenderPipeline
if (!string.IsNullOrEmpty(scene.TtsProvider) && scene.TtsProvider.Equals("openai", StringComparison.OrdinalIgnoreCase))
{
result = await _openAiTts.GenerateNarrationAsync(scene, outputDir, voiceStyle, ct);
try
{
result = await _openAiTts.GenerateNarrationAsync(scene, outputDir, voiceStyle, ct);
}
catch (Exception ex)
{
_logger.LogWarning(ex, "OpenAI TTS başarısız (Muhtemelen 429 Rate Limit/Quota). Voicebox'a fallback yapılıyor.");
result = await _voiceboxTts.GenerateNarrationAsync(scene, outputDir, voiceStyle, ct);
}
}
else if (!string.IsNullOrEmpty(scene.TtsProvider) && scene.TtsProvider.Equals("minimax", StringComparison.OrdinalIgnoreCase))
{