Skip to content

About

No description, website, or topics provided.

Resources

Stars

4 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Regex Reload Guard

Stops the current chat from fully reloading every time you switch Connection Profiles — but still reloads when it's genuinely needed.

The problem

When you change the Connection Profile in API Connections, the Connection Manager re-applies every setting stored in that profile, including the regex preset. The built-in Regex extension always calls reloadCurrentChat() when a preset is applied — even when the applied preset produces the exact same on-screen result. That full re-render of the message list is what feels like "the whole app reloading" on every profile switch.

What "really necessary" means

A chat reload only changes what you see by re-running display-time regex. In that pass (getRegexedString with isMarkdown = true), only scripts flagged markdownOnly are applied. Non-markdown scripts mutate stored message text at generation time and are not re-applied on reload.

So a profile switch needs a reload only if the set (and relevant fields/order) of enabled markdownOnly scripts changes.

What this does

It wraps the /regex-preset slash command (what Connection Manager calls internally) and compares the display-affecting regex scripts before vs. after:

  • Display output will change → defers to the original command: full apply + reload (unchanged behavior).
  • Display output won't change → applies the preset's enable/disable/order itself (so generation-only scripts are still swapped correctly) and skips the chat reload.

The guard always fails open: on any error it falls back to the original command.

Caveat

In the no-reload branch, the core Regex editor's script list isn't re-rendered and its internal "unsaved changes" tracking isn't updated — both are private to the regex module and can't be invoked from an extension. This is cosmetic, only visible if you have the Regex panel open, and self-heals on the next regex operation. The actual script data and the chat remain correct.

Installation

Copy this folder into:

SillyTavern/public/scripts/extensions/third-party/SillyTavern-RegexReloadGuard/

Then enable Regex Reload Guard in the Extensions panel and refresh.

Notes

  • Requires the built-in Regex extension to be enabled (it owns the /regex-preset command and the engine helpers this extension imports).
  • No settings, no UI — it installs the guard on startup.
  • Look for [RegexReloadGuard] Installed in the browser console to confirm it loaded, and Applied "<preset>" without reloading the chat (debug level) when it skips a reload.

About

No description, website, or topics provided.

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages