fix(web-test): limit ElevenLabs TTS concurrency to 2 and improve error logging

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-03-03 12:10:01 +03:00
parent 5bccca2475
commit e23a235ffa
+2 -2
View File
@@ -2714,7 +2714,7 @@ export async function addNarration(videoPath, opts = {}) {
try {
// Phase 1: Generate TTS audio for each caption
const ttsFiles = [];
const BATCH_SIZE = 5;
const BATCH_SIZE = (opts.provider === 'elevenlabs') ? 2 : 5;
for (let batchStart = 0; batchStart < captions.length; batchStart += BATCH_SIZE) {
const batch = captions.slice(batchStart, batchStart + BATCH_SIZE);
const promises = batch.map(async (cap, batchIdx) => {
@@ -2727,7 +2727,7 @@ export async function addNarration(videoPath, opts = {}) {
try {
await ttsProvider(cap.speech, ttsFile, ttsOpts);
} catch (retryErr) {
warnings.push(`TTS failed for caption ${idx}: ${retryErr.message}`);
warnings.push(`TTS failed for caption ${idx}: ${retryErr.message || retryErr.cause?.message || String(retryErr)}`);
// Generate 1s silence as placeholder
generateSilence(ttsFile, 1, ffmpegPath);
}