Commit Graph

99 Commits

Author SHA1 Message Date
Cohee 2e4ca3dabf fix: improve sanitation of toasts that bypass HTML escaping (#5540)
* fix: improve sanitation of toasts that bypass HTML escaping

* fix: replace absolute lib.js import with relative

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-04-28 01:00:31 +03:00
Wolfsblvt f3521e7007 Migrate built-in extensions to use manifest-based activate hooks (#5435)
* Convert jQuery/IIFE wrappers to exported init() functions and register activate hooks in 8 extension manifests

* Convert remaining extensions to exported init() with activate hooks and await initExtensions()

- Convert jQuery/IIFE wrappers to exported init() functions in expressions, memory, quick-reply, regex, stable-diffusion, translate, tts, and vectors extensions

- Register init functions as activate hooks in extension manifests

- Properly await async initExtensions() in firstLoadInit()

* Fix eslint

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-04-09 23:49:55 +03:00
Wolfsblvt fb915b4321 Add /regex-state slash command to check regex script status (#5428)
* feat: add /regex-state command to check script enabled status

Adds a new slash command that returns 'on' or 'off' to indicate whether a regex script is currently enabled or disabled.

* refactor: change /regex-state return values from 'on'/'off' to 'true'/'false'

Updates the /regex-state slash command to return boolean string values ('true'/'false') instead of ('on'/'off') for better consistency with standard boolean conventions.
2026-04-09 23:27:36 +03:00
Cohee 357da3219b Chore: Add code formatting conventions as eslint rules (#5158)
* Add code formatting conventions as eslint rules

* Improve formatting in addQuickReply
2026-02-15 01:16:34 +02:00
Cohee b370808753 Migrate substituteParams calls to new engine (#4901) 2025-12-18 00:01:08 +02:00
Cohee 0225562f4e Regex cache (#4858)
feat: optimize regex extension performance

- Implemented caching mechanism for regex scripts to improve message rendering speed.
- Added automatic cache invalidation on script updates.
- Optimized regex compilation to reduce CPU usage.

---------

Co-authored-by: GhostXia <33112711+GhostXia@users.noreply.github.com>
2025-12-04 22:21:13 +02:00
Cohee 9246ca2779 Fix: enum/readonly comment order 2025-11-30 01:53:11 +02:00
Cohee 929d377da8 Update group chat metadata format (#4805)
* Migrate group metadata to group chat files

* Skip migration if chat already has metadata

* Fix active group not being set on group conversion

* Improve types in createGroup

* Fix padding in hotswap group avatars

* Fix centering of empty hotswap avatar

* Added automatic backups of migrated data

* Fix 'OVERWRITE' for GC

* Fix metadata parsing order in migration

* Remove color accents from regular migration logs

* Always set gen_id in converted message

* Clone messages before conversion

* Reduce size of add/remove buttons

* Fix group chat file size calculation
2025-11-25 23:48:43 +02:00
Serena a0bff84e4e Fix: Prevent data loss on bulk regex move to scoped scripts (#4760)
* Fix: Prevent data loss in regex bulk move

* prevents moving to scoped scripts with group selected for bulkedit
2025-11-11 15:20:16 +02:00
StageDog 5a2b325ff7 fix: reorder regex import target popup (#4744) 2025-11-06 10:57:06 +02:00
StageDog 4bda4444e4 feat: Apply preset regexes before scoped regexes + avoid unnecessary popping up (#4672)
* feat: apply preset regexes before scoped regexes

* feat: apply preset regexes before scoped regexes for debugger list

* fix: don't notify reload regexes when save preset through ui button

* docs: add comment for SCRIPT_TYPES order

* fix: updatePreset is wrongly reset preset
2025-10-18 19:08:11 +03:00
StageDog 7dda524284 feat: set sortable handle for regex (#4667) 2025-10-17 22:13:18 +03:00
Cohee df7f046912 Preset Regex: add preset type for script regexes (#4642)
* feat: preset regex

* refactor: unify `saveScriptsByType`

* fix: default branch for `saveScriptsByType`

* refactor: resolve some reviews

* fix: lint

* refactor: getPresetName -> getCurrentPresetName

* refactor: unify regex allow operation

* feat: notify whether to reload current chat when preset is changed

* refacotr: set timeout for reload current chat notification

* fix: _ -> lodash

* i18n

* Refactor API ID access

* refactor: replace UNKNOWN type with a separate constant

* refactor: consolidate CSS rules for scoped and preset script blocks

* Extend toast timeout

* Fix bug with moving, refactor

* Refactor bulk toggle operations

* Use for..of for preset application

* refactor: enhance parameter documentation for scriptType in regex functions

* fix: await loadRegexScripts in event handlers

* fix: correct script type in saveScriptsByType for preset handling

* fix: add null checks for preset manager and API ID in regex functions

* feat: implement expandable regex script options in UI

* Always show edit/delete buttons

* Add title attribute to regex script name

* fix: correct class name for regex script display

* Remove extra paddings from script blocks

* fix: ensure preset scripts are only disallowed if currently allowed during rename

* fix: reload on bulk script toggle

* feat: add PRESET_RENAMED_BEFORE event type and emit it during preset renaming

* fix: always preserve preset extensions on rename

* Handle horde in getPresetManager

---------

Co-authored-by: ZoinkCN <zoinkcn@outlook.com>
Co-authored-by: StageDog <aksanajw845@gmail.com>
2025-10-11 22:10:06 +03:00
Cohee 21eee36eb3 Regex: Re-export getRegexScripts for legacy extensions 2025-10-08 09:26:06 +00:00
Cohee 9dddbbb04a Regex: Code clean-up (#4628)
* Add confirmation for bulk move, add UNKNOWN type, improve JSDoc

* Fix toggle all bulk move visibility

* Improve function documentation

* Refactor currentChatId check and improve JSDoc for getScriptDecorators function

* Check against known values in moveRegexScript

* Fix console warning spam

* Simplify currentChatId check

* Prevent moving scripts into the void

* Make texts translatable
2025-10-07 23:49:20 +03:00
StageDog f15c91fa8e Preset Regex: refactor regex scope detection (#4618)
* refactor: explicit type for regex scope + feat: bulk move regex

* fix: eslint

* i18n: polish

* refactor: jsdoc + use object type for option

* fix: default return type for `getScriptsByType`

* refactor: simplify

* refactor: share default options

* refactor: remove unrequired css

* fix: move regexes to global + refactor: make regex operation interfaces more consistant

---------

Co-authored-by: ZoinkCN <zoinkcn@outlook.com>
2025-10-07 22:30:11 +03:00
Yokayo 1e05eac7df Update ru-ru locale (#4522)
* Work on tl

* eslint fix

* Update data-i18n attribute for expand view button

* Add data-i18n to button

---------

Co-authored-by: Yokayo <nonameutubecomm@gmail.com>
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-09-14 20:57:33 +03:00
Tosd 57e363cae6 feat: Regex Presets (#4468)
* Work in progress

* feat: save confirmation

* Fix eslint, add typedef

* Add slash command and compatibility with profiles

* Move UI label up

* Null safety

* Fix duplicate block title

* i18n: zh-CN translation

* Adjust debugger styles

* Move presets block down

* Do not generate id twice for new entries

* Add missing translations

* Simplify settings migration logic

* Fix type comment

* Add missing keys

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-09-08 12:35:14 +03:00
MAX-TAB 176825bdb8 feat: Advanced Regex Chain Debugger and Testing Panel (#4418)
* feat: Advanced Regex Chain Debugger and Testing Panel

* fix

* fix_2

* fix_3

* Address code review suggestions for debugger feature

* feat: Add match statistics to debugger

* ESLint

* feat: Enhance debugger with diff view and nav popup

* ESLint

* Fix styles and full results expand

* Diff clean-up

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-08-25 21:44:01 +03:00
zengls fd00b5a5b8 Add support for named regex capture groups. (#4397)
* Update UpdateAndStart.bat

* regex named capture group

* Add row to replace with textarea

* Move checkbox up

* Revert toggle and syntax preferences

* Remove comment

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-08-18 21:27:36 +03:00
Cohee 7bf1da7384 Perform save if fixing placement 2025-06-25 22:03:25 +03:00
Cohee 7d7f1b1e29 Check if regex script placement is an array 2025-06-25 22:01:45 +03:00
Cohee dfe1cdee21 Fix type errors in regex extension 2025-06-16 23:06:58 +03:00
Cohee 7614e5e9fe Reset toggle icon on render list 2025-06-16 22:20:42 +03:00
Cohee 412b0fce0f Change icon on individual checkbox toggle 2025-06-16 22:19:58 +03:00
I 8cf30fd519 regex bulkedit select all button add 2025-06-15 23:04:33 -05:00
Yokayo 5b4198957a Work on tl 2025-06-13 00:37:21 +07:00
Cohee 9bcbe957af Refactor transition durations to use CSS variables 2025-06-07 16:40:30 +03:00
Cohee b6d282b4ee Fix for eslint 2025-06-03 00:11:06 +03:00
Cohee b72d7f37d7 regex: update for new popup 2025-06-03 00:05:33 +03:00
Cohee 523cc36b46 Implement bulk operations for regex 2025-05-26 22:21:48 +03:00
gk 6df95b98ec Regex: add export buttons for global and scoped scripts 2025-05-08 01:27:03 +09:00
gk 2650d88606 Regex: allow multiple definitions in a single file 2025-05-07 18:48:18 +09:00
Cohee 78bda9954d Increase maximum injection depth and WI order (#3800) 2025-04-13 21:31:57 +03:00
Yokayo 40c3674da1 Update tl 2025-03-17 16:09:36 +07:00
Cohee b8afa96de5 Replace link to docs about regex flags 2025-03-15 23:07:58 +02:00
Wolfsblvt 18fa33d816 On review feedback of /regex-toggle
- Add quiet arg to suppress success toast
- Fix return values
- Switch-case instead of nested ternaries
- state uses onOfToggle
2025-03-14 01:03:08 +01:00
Wolfsblvt 7537192c9a Add /regex-toggle slash command
- Add /regex-toggle command, similarly to /extension-toggle
- toggles the state of both global and character-bound scripts
- Update jsdoc being inconsistent

Closes #3613
2025-03-13 23:55:08 +01:00
Reithan 01ef823da9 Dont count Continue as message 0 (#3594)
* continue works same as swipe continued message isn't depth counted

* correct early-out check

* update regex depth setting tooltips for accuracy

* update max tooltip

* remove redundant check

* Allow -1 as a min depth value

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-03-12 19:59:15 +02:00
Cohee 71a3aefe86 Replace link to regex editor docs 2025-03-10 10:40:25 +00:00
Cohee 0f8a17b652 Refactor regex info block to use a shared function 2025-03-09 23:29:00 +02:00
Cohee 34b2ef0fd7 Clean-up code 2025-03-09 17:47:23 +02:00
Cohee eef9c3ef62 Add info block for find regex flags
#3647
2025-03-09 17:41:38 +02:00
Cohee d5bdf1cb90 Add settings.json-backed KV string storage
Fixes #3461, #3443
2025-02-11 20:17:48 +02:00
Cohee a6a7810be2 Regex: fix "Alter Outgoing Prompt" applying when unchecked (#3380)
* Regex: rework ephemerality options.

* Fix ephemeral regex being executed when unwanted

* Revert to old code style
2025-01-29 11:39:32 +02:00
Cohee 6fc342d446 Add regex processing for reasoning blocks 2025-01-27 23:06:07 +02:00
Cohee da42d0a47a Add 3-state find substitution select
Fixes #3104
2024-11-23 19:39:02 +02:00
Yokayo 9d664bc679 Update tl 2024-11-06 01:33:24 +07:00
Cohee 48d8e6e2c3 Port #3031 onto new engine 2024-11-02 00:55:34 +02:00
Cohee 9e50ff34c9 Make Run on edit actually work
Fixes #2958
2024-10-07 20:21:07 +03:00