Commit Graph

3151 Commits

Author SHA1 Message Date
kingbri
afdab4c5b6 Regex: Add character name override
Sendas uses a different character's name for messages, so allow
the use of a character name override in the regex match function.
This overrides substituteParams to use a different value.

Signed-off-by: kingbri <bdashore3@proton.me>
2023-07-05 01:35:52 -04:00
kingbri
b8f86d55da Regex: Add substitution to regex and undefined checks
Sometimes a user may want to substitute variables in the regex
itself rather than just matching those variables. This can be
optionally enabled in the editor.

In addition, try preventing crashes by checking for undefined
variables or null coalescing.

Signed-off-by: kingbri <bdashore3@proton.me>
2023-07-05 01:30:50 -04:00
kingbri
fee801c2a4 Regex: Upgrade engine
If the extension is disabled, don't use any regex formatting. In
addition, wrap all foreach logic into its own function which
reduces the size of all regex injections.

This commit also removes the need for working around static imports
as UI is separate from the engine and is therefore imported at the
same time as other non-static extensions.

Signed-off-by: kingbri <bdashore3@proton.me>
2023-07-05 01:30:50 -04:00
kingbri
fb02c00402 Extensions: Workaround loading static extensions
Some extensions are statically imported inside script.js, bypassing
the extension load method. The true method to solve this is using
dynamic imports and undefined checks, but implementing this is
extremely time-consuming.

For now, add the extension_first_load event which fires when
first load is about to start. This changes loading priority to
static -> offline -> online/API.

In addition, initialize the event source earlier since it's more
important than most of the other imports.

Signed-off-by: kingbri <bdashore3@proton.me>
2023-07-05 01:30:50 -04:00
kingbri
7c0222a15b Regex: Migrate CSS styling
Universal styling has been moved to the main styles.css.

Signed-off-by: kingbri <bdashore3@proton.me>
2023-07-05 01:30:50 -04:00
kingbri
e6eae0aad1 Regex: Fix script duplication on edit
Editing a script can bypass the unique naming system by just renaming
the script to another one. This change ensures that no two script
names can be the same by checking if the existing index and found indices
differ.

If something goes wrong, it would be better to use a filter and a
map and then check the index array length/includes. FindIndex
is used here for efficiency's sake since each array index is unique.

Signed-off-by: kingbri <bdashore3@proton.me>
2023-07-05 01:30:50 -04:00
kingbri
0f8d07053e Regex: Don't wrap scriptTemplate elements
Fix some UI for flex element wrapping. Text overflow for a script
name is now truncated if it exceeds one line of text. Also fix
how extension settings are laid out to prevent unnecessary
flex resizing.

Signed-off-by: kingbri <bdashore3@proton.me>
2023-07-05 01:30:50 -04:00
kingbri
b362dba726 Regex: Fix edit message hook
The only way to distinguish between a user and AI is if the is_user
property is changed.

Signed-off-by: kingbri <bdashore3@proton.me>
2023-07-05 01:30:50 -04:00
kingbri
ee6a6603a3 Regex: Add trimStrings option
Sometimes the matched regex string needs to be pruned before
replacement. Add a method for the user to provide strings which
globally trims a regex match before any replacement is done.

Example without trim:
input - <Manami's thoughts: This is a thought>
regex - /<([^>]*)>/g
output - <Manami's thoughts: Manami's thoughts: This is a thought>

With trim:
input - <Manami's thoughts: This is a thought>
regex - /<([^>]*)>/g
trim - ["{{char}}'s thoughts: "]
output - <Manami's thoughts: This is a thought>

Signed-off-by: kingbri <bdashore3@proton.me>
2023-07-05 01:30:50 -04:00
kingbri
ef7aa3941b Extensions: Add regex engine
Regex is a method that is commonly used to find and replace parts
of a string using a single pattern. Add support for using regex in
SillyTavern which allows users to dynamically change various aspects
of the chatting experience.

Users are able to choose where a given regex script should apply
(both invasive and non-invasive options!). Invasive options alter
chat history while non-invasive alters markdown display for the
entire chat.

A new variable called {{match}} is added in regex scripts which
substitutes in the found match from the original find regex script.

There is a lot more that can be added to this extension, but for now,
this is enough.

Signed-off-by: kingbri <bdashore3@proton.me>
2023-07-05 01:30:49 -04:00
kingbri
6bc9535040 Popups: Allow substitution of primary button
This allows for more flexible popups with options rather than
implementing a brand new popup just to change button text.

Signed-off-by: kingbri <bdashore3@proton.me>
2023-07-05 01:30:01 -04:00
Cohee
9a8e036ff9 Use floor rounding on chroma auto-calc 2023-07-05 01:25:43 +03:00
Cohee
0d858bdefb #591 Fix Chroma auto-adjust rounding N query to 0 2023-07-05 01:23:11 +03:00
Cohee
27ab509caf Split help command into pages 2023-07-05 01:06:24 +03:00
Cohee
093379dba9 Fix custom group avatar in hotswap bar 2023-07-05 00:35:08 +03:00
Cohee
872bbfad1a Slash command to quickly open a character by name 2023-07-05 00:15:12 +03:00
RossAscends
b8f3a7cbe0 fix code text color & default minimal light theme 2023-07-05 05:16:52 +09:00
RossAscends
deff2d24fb Merge branch 'dev' of https://github.com/Cohee1207/SillyTavern into dev 2023-07-05 04:45:57 +09:00
RossAscends
fde2a91d2a down the rabbit hole 2023-07-05 04:45:54 +09:00
Cohee
4ceb8cedef Merge pull request #626 from Teashrock/main
Added Stable Horde sampler "k_euler_a"
2023-07-04 21:44:35 +03:00
RossAscends
383a9f67a2 Merge branch 'dev' of https://github.com/Cohee1207/SillyTavern into dev 2023-07-05 02:44:06 +09:00
RossAscends
8cee880486 hopeful fix for resize spam on mobile 2023-07-05 02:43:52 +09:00
Cohee
36149fffa1 Merge pull request #631 from BlipRanger/BlipRanger-patch-1
Blip ranger patch 1
2023-07-04 20:34:37 +03:00
BlipRanger
80ac13ef20 Rare race condition patch 2023-07-04 12:26:21 -04:00
RossAscends
b994dbb2d1 dont punish rampant zoomers too much 2023-07-05 00:41:39 +09:00
RossAscends
83d954246f anti-Tav tactics (MovingUI resets on page zoom) 2023-07-05 00:16:36 +09:00
RossAscends
368f3ea968 minor skill issue *obliterated by Dalamud* 2023-07-04 23:10:08 +09:00
RossAscends
19502492c6 Merge branch 'dev' of https://github.com/Cohee1207/SillyTavern into dev 2023-07-04 23:00:13 +09:00
RossAscends
3426f80656 Impervious MovingUI 2023-07-04 23:00:10 +09:00
Cohee
6770ccbe91 Fix Chub embedded lorebooks import 2023-07-04 14:47:48 +03:00
Cohee
44a38f8588 #628 Fix form properties 2023-07-04 14:16:14 +03:00
Cohee
823dd8c47c Merge branch 'main' into dev 2023-07-04 12:06:25 +03:00
Cohee
c922f17f09 Fix main_api default value 1.8.1 2023-07-04 11:49:46 +03:00
Cohee
8ad431bea6 Fix waifu mode setting migration 2023-07-04 11:46:53 +03:00
Cohee
dbb18ac895 Bump package version 2023-07-04 11:42:01 +03:00
Cohee
856b835172 Fix migration of settings.json 2023-07-04 11:41:15 +03:00
Cohee
37000963d9 Update Coherent Creativity.settings 2023-07-04 10:03:51 +03:00
Cohee
6ddd804749 Merge pull request #627 from alicat22/SillyTavern 2023-07-04 09:36:14 +03:00
cass02
2130338c1d Preset Cleanup - Sampling Order Update / Preset Name Update
Removed the parameter size from many of the presets, as these can work well with many parameter sizes. Removed "Prompt Arena" from the ooba presets, as these are new defaults. Changed sampling order back to the originals. Rep Pen should should listed first, as this was how it was done originally, as well. Also cleaned up and removed the unused parameters.
2023-07-03 16:45:11 -06:00
RossAscends
b20f371a42 add help link on Persona panel 2023-07-04 06:28:46 +09:00
Teashrock
de425d97dd Added sampler "k_euler_a" 2023-07-03 22:41:28 +03:00
Cohee
d6fd5455e6 Merge pull request #625 from SillyTavern/dev
Dev
1.8.0
2023-07-03 19:23:26 +03:00
Cohee
f3c9f57cb9 Merge branch 'main' into dev 2023-07-03 19:22:44 +03:00
Cohee
3fcf232537 Bump package version 2023-07-03 19:19:22 +03:00
Cohee
6be18e4212 Fix Poe client 2023-07-03 19:18:42 +03:00
Cohee
9e3c55805f Better chat completion continue 2023-07-03 18:22:12 +03:00
Cohee
9ab7265053 Touch chat window to cancel auto scroll on mobile 2023-07-03 18:17:10 +03:00
Cohee
25e3005de9 Unlocked context warning should be unclickable 2023-07-03 13:51:05 +03:00
Cohee
2b8f5d14e9 Don't stack suggested replies on Poe with continue. 2023-07-03 13:49:26 +03:00
Cohee
13deac2527 Don't insert a newline on empty WI 2023-07-03 11:34:15 +03:00