From 8b32ee9e8058ac0a337659913b656b0764bbeaa6 Mon Sep 17 00:00:00 2001 From: Yaroslav Sivakov Date: Sat, 2 Nov 2024 20:25:25 +0300 Subject: [PATCH] Remove embedded images before send text to TTS --- public/scripts/extensions/tts/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/public/scripts/extensions/tts/index.js b/public/scripts/extensions/tts/index.js index 922a16e4f..92b3f9280 100644 --- a/public/scripts/extensions/tts/index.js +++ b/public/scripts/extensions/tts/index.js @@ -483,6 +483,9 @@ async function processTtsQueue() { text = matches ? matches.join(partJoiner) : text; } + // Remove embedded images + text = text.replace(/!\[alt-text]\([^)]*\)/g, ' '); + if (typeof ttsProvider?.processText === 'function') { text = await ttsProvider.processText(text); }