Previously, there was a checkbox to select placement as MD display.
This was counterintuitive since some users believed MD display
enclosed the other placement options.
Now, add a universal switch to finely tune what parts of a chat should
be excluded with MD formatting. For example a regex with the option
enabled with AI output selected will only format replies from the
character.
This is an improvement since users can now choose what parts of a
chat to format rather than sticking with a global display specifier.
Signed-off-by: kingbri <bdashore3@proton.me>
Through the impersonate function it is possible for the AI to create a text as if it were in the place of the user's character, but the text is randomly generated without the user being able to suggest what he wants to be created. By including this new macro, the user will be able to guide the impersonate generation.
Multiple scripts were not running due to improper variable assingment.
For efficiency's sake, do not do a string comparison before returning
and instead do another variable assignment in the parent function.
Doing this reduces the length of regex hooks in the parent calls,
but also removes the need for unnecessary O(n) complexity of comparing
two string variables.
If there are errors, it would be advisable to add string comparison
and revert back to the old logic in parent function calls.
Signed-off-by: kingbri <bdashore3@proton.me>
As opposed to making the match variable include the entire regex
match, overlay the replacement string over the regex match and splice
out whatever's already in the replacement string from the regex match.
This new strategy helps save time when editing messages since match
prefix and suffix phrases have a lower chance of being repeated on
every edit. The overlay strategy also preserves uniqueness if the user
decides to change something in the edited text.
However, overlay can cause issues especially with punctiation,
so the strategy isn't chosen by default when creating a new regex.
Signed-off-by: kingbri <bdashore3@proton.me>
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>