mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Regex: Fix markdown format bugs
If a regex cannot be parsed, silently return out and don't run the script. May be a good idea to display a toast message saying the script didn't run. Also only reload the chat if a chat is actually loaded. Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { callPopup, eventSource, event_types, reloadCurrentChat, saveSettingsDebounced } from "../../../script.js";
|
||||
import { callPopup, eventSource, event_types, getCurrentChatId, reloadCurrentChat, saveSettingsDebounced } from "../../../script.js";
|
||||
import { extension_settings } from "../../extensions.js";
|
||||
import { uuidv4, waitUntilCondition } from "../../utils.js";
|
||||
import { regex_placement } from "./engine.js";
|
||||
@@ -50,7 +50,10 @@ async function saveRegexScript(regexScript, existingScriptIndex) {
|
||||
|
||||
// Markdown is global, so reload the chat.
|
||||
if (regexScript.placement.includes(regex_placement.MD_DISPLAY)) {
|
||||
await reloadCurrentChat();
|
||||
const currentChatId = getCurrentChatId();
|
||||
if (currentChatId !== undefined && currentChatId !== null) {
|
||||
await reloadCurrentChat();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user