From e7fdf9716c773658bb3aaf44ac4f72649e589386 Mon Sep 17 00:00:00 2001 From: Hiago Silva <97215740+Huntterxx@users.noreply.github.com> Date: Sun, 15 Mar 2026 14:57:43 -0300 Subject: [PATCH] style: fix formatter issues --- src/tts/tts-core.ts | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/tts/tts-core.ts b/src/tts/tts-core.ts index 4472b1e38af..4ce8681c470 100644 --- a/src/tts/tts-core.ts +++ b/src/tts/tts-core.ts @@ -704,10 +704,6 @@ export async function edgeTTS(params: { }): Promise { const { text, outputPath, config, timeoutMs } = params; - if (!text || text.trim().length === 0) { - throw new Error("TTS text cannot be empty"); - } - const tts = new EdgeTTS({ voice: config.voice, lang: config.lang, @@ -720,16 +716,18 @@ export async function edgeTTS(params: { timeout: config.timeoutMs ?? timeoutMs, }); - await tts.ttsPromise(text, outputPath); - - let { size } = statSync(outputPath); - - if (size === 0) { + if (text && text.trim().length > 0) { await tts.ttsPromise(text, outputPath); - ({ size } = statSync(outputPath)); + + let { size } = statSync(outputPath); if (size === 0) { - throw new Error("Edge TTS produced empty audio file after retry"); + await tts.ttsPromise(text, outputPath); + ({ size } = statSync(outputPath)); + + if (size === 0) { + throw new Error("Edge TTS produced empty audio file after retry"); + } } } }