diff --git a/public/scripts/extensions/tts/index.js b/public/scripts/extensions/tts/index.js
index df707673c..cca47baf4 100644
--- a/public/scripts/extensions/tts/index.js
+++ b/public/scripts/extensions/tts/index.js
@@ -239,9 +239,17 @@ async function processTtsQueue() {
console.debug('New message found, running TTS')
currentTtsJob = ttsJobQueue.shift()
- const text = extension_settings.tts.narrate_dialogues_only
+ let text = extension_settings.tts.narrate_dialogues_only
? currentTtsJob.mes.replace(/\*[^\*]*?(\*|$)/g, '').trim() // remove asterisks content
: currentTtsJob.mes.replaceAll('*', '').trim() // remove just the asterisks
+
+ if (extension_settings.tts.narrate_quoted_only) {
+ const special_quotes = /[“”]/g; // Extend this regex to include other special quotes
+ text = text.replace(special_quotes, '"');
+ const matches = text.match(/".*?"/g); // Matches text inside double quotes, non-greedily
+ text = matches ? matches.join(' ... ... ... ') : text;
+ }
+ console.log(`TTS: ${text}`)
const char = currentTtsJob.name
try {
@@ -286,6 +294,7 @@ function loadSettings() {
extension_settings.tts.enabled
)
$('#tts_narrate_dialogues').prop('checked', extension_settings.tts.narrate_dialogues_only)
+ $('#tts_narrate_quoted').prop('checked', extension_settings.tts.narrate_quoted_only)
}
const defaultSettings = {
@@ -378,6 +387,13 @@ function onNarrateDialoguesClick() {
saveSettingsDebounced()
}
+
+function onNarrateQuotedClick() {
+ extension_settings.tts.narrate_quoted_only = $('#tts_narrate_quoted').prop('checked');
+ saveSettingsDebounced()
+}
+
+
//##############//
// TTS Provider //
//##############//
@@ -457,6 +473,10 @@ $(document).ready(function () {
Narrate dialogues only
+