v3.2.5: Always enable JSON cleaning regex with proper settings

This commit is contained in:
Spicy_Marinara
2026-01-08 18:27:16 +01:00
parent e5bd1e0411
commit bd056934e1
4 changed files with 52 additions and 57 deletions
+2 -21
View File
@@ -313,18 +313,6 @@ async function initUI() {
extensionSettings.generationMode = String($(this).val());
saveSettings();
updateGenerationModeUI();
// Add or remove JSON cleaning regex based on mode
// This ensures old messages in chat history are also cleaned
try {
if (extensionSettings.generationMode === 'together') {
await ensureJsonCleaningRegex(st_extension_settings, saveSettingsDebounced);
} else {
removeJsonCleaningRegex(st_extension_settings, saveSettingsDebounced);
}
} catch (error) {
console.error('[RPG Companion] JSON cleaning regex update failed:', error);
}
});
$('#rpg-toggle-user-stats').on('change', function() {
@@ -1000,17 +988,10 @@ jQuery(async () => {
// Non-critical - continue without it
}
// Import the JSON cleaning regex for Together mode if enabled
// Import the JSON cleaning regex to clean up JSON in messages
// This cleans historical messages when displayed
// Note: We also clean directly in message handler for redundancy
try {
// console.log('[RPG Companion] Checking JSON cleaning regex. Generation mode:', extensionSettings.generationMode);
if (extensionSettings.generationMode === 'together') {
await ensureJsonCleaningRegex(st_extension_settings, saveSettingsDebounced);
} else {
// Remove the regex if switching to separate mode
removeJsonCleaningRegex(st_extension_settings, saveSettingsDebounced);
}
await ensureJsonCleaningRegex(st_extension_settings, saveSettingsDebounced);
} catch (error) {
console.error('[RPG Companion] JSON cleaning regex setup failed:', error);
// Non-critical - continue without it