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>
This commit is contained in:
Tosd
2025-09-08 17:35:14 +08:00
committed by GitHub
parent 6221c540e4
commit 57e363cae6
7 changed files with 575 additions and 60 deletions
@@ -43,6 +43,7 @@ const CC_COMMANDS = [
'reasoning-template',
'prompt-post-processing',
'secret-id',
'regex-preset',
];
const TC_COMMANDS = [
@@ -60,6 +61,7 @@ const TC_COMMANDS = [
'start-reply-with',
'reasoning-template',
'secret-id',
'regex-preset',
];
const FANCY_NAMES = {
@@ -79,6 +81,7 @@ const FANCY_NAMES = {
'reasoning-template': 'Reasoning Template',
'prompt-post-processing': 'Prompt Post-Processing',
'secret-id': 'Secret',
'regex-preset': 'Regex Preset',
};
/**
@@ -357,6 +360,14 @@ function makeFancyProfile(profile) {
}
}
if (key === 'regex-preset') {
const label = extension_settings.regex_presets?.find(p => p.id === profile[key])?.name;
if (label) {
acc[value] = label;
return acc;
}
}
acc[value] = profile[key];
return acc;
}, {});