Remove the concept of default context and instruct. Swap columns

bf5b6090eb7727f16dadf01acd6cd0548a2c2864

Cohee <18619528+Cohee1207@users.noreply.github.com>

6 files changed, +137 -220Showing whitespace changes
default/content/settings.json+0 -2
@@ -150,7 +150,6 @@
150 "continue_on_send": false,150 "continue_on_send": false,
151 "trim_spaces": true,151 "trim_spaces": true,
152 "relaxed_api_urls": false,152 "relaxed_api_urls": false,
153 "default_instruct": "",
154 "instruct": {153 "instruct": {
155 "enabled": false,154 "enabled": false,
156 "preset": "Alpaca",155 "preset": "Alpaca",
@@ -178,7 +177,6 @@
178 "name": "Neutral - Chat",177 "name": "Neutral - Chat",
179 "content": "Write {{char}}'s next reply in a fictional chat between {{char}} and {{user}}."178 "content": "Write {{char}}'s next reply in a fictional chat between {{char}} and {{user}}."
180 },179 },
181 "default_context": "Default",
182 "context": {180 "context": {
183 "preset": "Default",181 "preset": "Default",
184 "story_string": "{{#if system}}{{system}}\n{{/if}}{{#if wiBefore}}{{wiBefore}}\n{{/if}}{{#if description}}{{description}}\n{{/if}}{{#if personality}}{{char}}'s personality: {{personality}}\n{{/if}}{{#if scenario}}Scenario: {{scenario}}\n{{/if}}{{#if wiAfter}}{{wiAfter}}\n{{/if}}{{#if persona}}{{persona}}\n{{/if}}",182 "story_string": "{{#if system}}{{system}}\n{{/if}}{{#if wiBefore}}{{wiBefore}}\n{{/if}}{{#if description}}{{description}}\n{{/if}}{{#if personality}}{{char}}'s personality: {{personality}}\n{{/if}}{{#if scenario}}Scenario: {{scenario}}\n{{/if}}{{#if wiAfter}}{{wiAfter}}\n{{/if}}{{#if persona}}{{persona}}\n{{/if}}",
public/index.html+137 -139
@@ -3190,7 +3190,6 @@
3190 </h4>3190 </h4>
3191 <div class="flex-container justifyCenter">3191 <div class="flex-container justifyCenter">
3192 <input type="file" hidden data-preset-manager-file="context" accept=".json, .settings">3192 <input type="file" hidden data-preset-manager-file="context" accept=".json, .settings">
3193 <i id="context_set_default" class="menu_button fa-solid fa-heart" title="Auto-select this template for Instruct Mode." data-i18n="[title]Auto-select this template for Instruct Mode"></i>
3194 <i data-preset-manager-update="context" class="menu_button fa-solid fa-save" title="Update current template" data-i18n="[title]Update current template"></i>3193 <i data-preset-manager-update="context" class="menu_button fa-solid fa-save" title="Update current template" data-i18n="[title]Update current template"></i>
3195 <i data-preset-manager-new="context" class="menu_button fa-solid fa-file-circle-plus" title="Save template as" data-i18n="[title]Save template as"></i>3194 <i data-preset-manager-new="context" class="menu_button fa-solid fa-file-circle-plus" title="Save template as" data-i18n="[title]Save template as"></i>
3196 <i data-preset-manager-import="context" class="displayNone menu_button fa-solid fa-file-import" title="Import template" data-i18n="[title]Import template"></i>3195 <i data-preset-manager-import="context" class="displayNone menu_button fa-solid fa-file-import" title="Import template" data-i18n="[title]Import template"></i>
@@ -3285,143 +3284,6 @@
3285 </div>3284 </div>
3286 </div>3285 </div>
3287 </div>3286 </div>
3288 <div id="SystemPromptColumn" class="flex-container flexNoGap flexFlowColumn flex1">
3289 <div id="SystemPromptBlock">
3290 <h4 class="standoutHeader title_restorable justifySpaceBetween">
3291 <div class="flex-container">
3292 <span data-i18n="System Prompt">System Prompt</span>
3293 <a href="https://docs.sillytavern.app/usage/core-concepts/advancedformatting/#system-prompt" class="notes-link" target="_blank">
3294 <span class="fa-solid fa-circle-question note-link-span"></span>
3295 </a>
3296 </div>
3297 <div class="flex-container">
3298 <label for="sysprompt_enabled" class="checkbox_label flex1" title="Enable System Prompt" data-i18n="[title]sysprompt_enabled">
3299 <input id="sysprompt_enabled" type="checkbox" style="display:none;" />
3300 <small><i class="fa-solid fa-power-off menu_button margin0"></i></small>
3301 </label>
3302 </div>
3303 </h4>
3304
3305 <div class="flex-container margin0 justifyCenter">
3306 <input type="file" hidden data-preset-manager-file="sysprompt" accept=".json, .settings">
3307 <i data-preset-manager-update="sysprompt" class="menu_button fa-solid fa-save" title="Update current prompt" data-i18n="[title]Update current prompt"></i>
3308 <i data-preset-manager-new="sysprompt" class="menu_button fa-solid fa-file-circle-plus" title="Save prompt as" data-i18n="[title]Save prompt as"></i>
3309 <i data-preset-manager-import="sysprompt" class="displayNone menu_button fa-solid fa-file-import" title="Import template" data-i18n="[title]Import template"></i>
3310 <i data-preset-manager-export="sysprompt" class="displayNone menu_button fa-solid fa-file-export" title="Export template" data-i18n="[title]Export template"></i>
3311 <i data-preset-manager-restore="sysprompt" class="menu_button fa-solid fa-recycle" title="Restore current prompt" data-i18n="[title]Restore current prompt"></i>
3312 <i data-preset-manager-delete="sysprompt" class="menu_button fa-solid fa-trash-can" title="Delete prompt" data-i18n="[title]Delete prompt"></i>
3313 </div>
3314
3315 <div class="flex-container" title="Select your current System Prompt" data-i18n="[title]Select your current System Prompt">
3316 <select id="sysprompt_select" data-preset-manager-for="sysprompt" class="flex1 text_pole"></select>
3317 </div>
3318
3319 <div>
3320 <label for="sysprompt_content" class="flex-container">
3321 <small data-i18n="Prompt Content">Prompt Content</small>
3322 <i class="editor_maximize fa-solid fa-maximize right_menu_button" data-for="sysprompt_content" title="Expand the editor" data-i18n="[title]Expand the editor"></i>
3323 </label>
3324 <textarea id="sysprompt_content" class="text_pole textarea_compact autoSetHeight"></textarea>
3325 </div>
3326 </div>
3327
3328 <div>
3329 <h4 class="range-block-title justifyLeft standoutHeader">
3330 <span data-i18n="Custom Stopping Strings">
3331 Custom Stopping Strings
3332 </span>
3333 <a href="https://docs.sillytavern.app/usage/core-concepts/advancedformatting/#custom-stopping-strings" class="notes-link" target="_blank">
3334 <span class="fa-solid fa-circle-question note-link-span"></span>
3335 </a>
3336 </h4>
3337 <div>
3338 <small>
3339 <span data-i18n="JSON serialized array of strings">JSON serialized array of strings</span>
3340 <i class="fa-solid fa-question-circle opacity50p" title="e.g: [&quot;Ford&quot;, &quot;BMW&quot;, &quot;Fiat&quot;]"></i>
3341 </small>
3342 </div>
3343 <div>
3344 <textarea id="custom_stopping_strings" class="text_pole textarea_compact monospace autoSetHeight"></textarea>
3345 </div>
3346 <label class="checkbox_label" for="custom_stopping_strings_macro">
3347 <input id="custom_stopping_strings_macro" type="checkbox" checked>
3348 <small data-i18n="Replace Macro in Custom Stopping Strings">
3349 Replace Macro in Custom Stopping Strings
3350 </small>
3351 </label>
3352 </div>
3353
3354 <div name="tokenizerSettingsBlock">
3355 <div name="tokenizerSelectorBlock">
3356 <h4 class="standoutHeader"><span data-i18n="Tokenizer">Tokenizer</span>
3357 <a href="https://docs.sillytavern.app/usage/core-concepts/advancedformatting/#tokenizer" class="notes-link" target="_blank">
3358 <span class="fa-solid fa-circle-question note-link-span"></span>
3359 </a>
3360 </h4>
3361 <select id="tokenizer">
3362 <option value="99">Best match (recommended)</option>
3363 <option value="0">None / Estimated</option>
3364 <option value="1">GPT-2</option>
3365 <!-- Option #2 was a legacy GPT-2/3 tokenizer -->
3366 <option value="3">Llama 1/2</option>
3367 <option value="12">Llama 3</option>
3368 <option value="13">Gemma / Gemini</option>
3369 <option value="14">Jamba</option>
3370 <option value="15">Qwen2</option>
3371 <option value="16">Command-R</option>
3372 <option value="4">NerdStash (NovelAI Clio)</option>
3373 <option value="5">NerdStash v2 (NovelAI Kayra)</option>
3374 <option value="7">Mistral V1</option>
3375 <option value="17">Mistral Nemo</option>
3376 <option value="8">Yi</option>
3377 <option value="11">Claude 1/2</option>
3378 <option value="6">API (WebUI / koboldcpp)</option>
3379 </select>
3380 </div>
3381 <div class="range-block flex-container flexnowrap" name="tokenPaddingBlock">
3382 <div class="range-block-title justifyLeft">
3383 <small data-i18n="Token Padding" class="flex-container">Token Padding
3384 <a href="https://docs.sillytavern.app/usage/core-concepts/advancedformatting/#token-padding" class="notes-link" target="_blank">
3385 <span class="fa-solid fa-circle-question note-link-span"></span>
3386 </a>
3387 </small>
3388 </div>
3389 <input id="token_padding" class="text_pole textarea_compact" type="number" min="-2048" max="2048" />
3390 </div>
3391 </div>
3392 <div>
3393 <h4 class="standoutHeader" data-i18n="Miscellaneous">Miscellaneous</h4>
3394 <div>
3395 <small>
3396 <span data-i18n="Non-markdown strings">
3397 Non-markdown strings
3398 </span>
3399 </small>
3400 <div>
3401 <input id="markdown_escape_strings" class="text_pole textarea_compact" type="text" data-i18n="[placeholder]comma delimited,no spaces between" placeholder="comma delimited,no spaces between" />
3402 </div>
3403 </div>
3404
3405 <div name="startReplyWithBlock">
3406 <div>
3407 <small>
3408 <span data-i18n="Start Reply With">
3409 Start Reply With
3410 </span>
3411 </small>
3412 <div>
3413 <textarea id="start_reply_with" class="text_pole textarea_compact autoSetHeight"></textarea>
3414 </div>
3415 <label class="checkbox_label" for="chat-show-reply-prefix-checkbox">
3416 <input id="chat-show-reply-prefix-checkbox" type="checkbox" />
3417 <small data-i18n="Show reply prefix in chat">
3418 Show reply prefix in chat
3419 </small>
3420 </label>
3421 </div>
3422 </div>
3423 </div>
3424 </div>
3425 <div id="InstructSettingsColumn" class="flex-container flexNoGap flexFlowColumn flex1">3287 <div id="InstructSettingsColumn" class="flex-container flexNoGap flexFlowColumn flex1">
3426 <div id="instructSettingsBlock">3288 <div id="instructSettingsBlock">
3427 <h4 class="standoutHeader title_restorable justifySpaceBetween">3289 <h4 class="standoutHeader title_restorable justifySpaceBetween">
@@ -3444,7 +3306,6 @@
3444 </h4>3306 </h4>
3445 <div class="flex-container margin0 justifyCenter">3307 <div class="flex-container margin0 justifyCenter">
3446 <input type="file" hidden data-preset-manager-file="instruct" accept=".json, .settings">3308 <input type="file" hidden data-preset-manager-file="instruct" accept=".json, .settings">
3447 <i id="instruct_set_default" class="menu_button fa-solid fa-heart" title="Auto-select this template on API connection." data-i18n="[title]Auto-select this template on API connection"></i>
3448 <i data-preset-manager-update="instruct" class="menu_button fa-solid fa-save" title="Update current template" data-i18n="[title]Update current template"></i>3309 <i data-preset-manager-update="instruct" class="menu_button fa-solid fa-save" title="Update current template" data-i18n="[title]Update current template"></i>
3449 <i data-preset-manager-new="instruct" class="menu_button fa-solid fa-file-circle-plus" title="Save template as" data-i18n="[title]Save template as"></i>3310 <i data-preset-manager-new="instruct" class="menu_button fa-solid fa-file-circle-plus" title="Save template as" data-i18n="[title]Save template as"></i>
3450 <i data-preset-manager-import="instruct" class="displayNone menu_button fa-solid fa-file-import" title="Import template" data-i18n="[title]Import template"></i>3311 <i data-preset-manager-import="instruct" class="displayNone menu_button fa-solid fa-file-import" title="Import template" data-i18n="[title]Import template"></i>
@@ -3597,6 +3458,143 @@
3597 </div>3458 </div>
3598 </div>3459 </div>
3599 </div>3460 </div>
3461 <div id="SystemPromptColumn" class="flex-container flexNoGap flexFlowColumn flex1">
3462 <div id="SystemPromptBlock">
3463 <h4 class="standoutHeader title_restorable justifySpaceBetween">
3464 <div class="flex-container">
3465 <span data-i18n="System Prompt">System Prompt</span>
3466 <a href="https://docs.sillytavern.app/usage/core-concepts/advancedformatting/#system-prompt" class="notes-link" target="_blank">
3467 <span class="fa-solid fa-circle-question note-link-span"></span>
3468 </a>
3469 </div>
3470 <div class="flex-container">
3471 <label for="sysprompt_enabled" class="checkbox_label flex1" title="Enable System Prompt" data-i18n="[title]sysprompt_enabled">
3472 <input id="sysprompt_enabled" type="checkbox" style="display:none;" />
3473 <small><i class="fa-solid fa-power-off menu_button margin0"></i></small>
3474 </label>
3475 </div>
3476 </h4>
3477
3478 <div class="flex-container margin0 justifyCenter">
3479 <input type="file" hidden data-preset-manager-file="sysprompt" accept=".json, .settings">
3480 <i data-preset-manager-update="sysprompt" class="menu_button fa-solid fa-save" title="Update current prompt" data-i18n="[title]Update current prompt"></i>
3481 <i data-preset-manager-new="sysprompt" class="menu_button fa-solid fa-file-circle-plus" title="Save prompt as" data-i18n="[title]Save prompt as"></i>
3482 <i data-preset-manager-import="sysprompt" class="displayNone menu_button fa-solid fa-file-import" title="Import template" data-i18n="[title]Import template"></i>
3483 <i data-preset-manager-export="sysprompt" class="displayNone menu_button fa-solid fa-file-export" title="Export template" data-i18n="[title]Export template"></i>
3484 <i data-preset-manager-restore="sysprompt" class="menu_button fa-solid fa-recycle" title="Restore current prompt" data-i18n="[title]Restore current prompt"></i>
3485 <i data-preset-manager-delete="sysprompt" class="menu_button fa-solid fa-trash-can" title="Delete prompt" data-i18n="[title]Delete prompt"></i>
3486 </div>
3487
3488 <div class="flex-container" title="Select your current System Prompt" data-i18n="[title]Select your current System Prompt">
3489 <select id="sysprompt_select" data-preset-manager-for="sysprompt" class="flex1 text_pole"></select>
3490 </div>
3491
3492 <div>
3493 <label for="sysprompt_content" class="flex-container">
3494 <small data-i18n="Prompt Content">Prompt Content</small>
3495 <i class="editor_maximize fa-solid fa-maximize right_menu_button" data-for="sysprompt_content" title="Expand the editor" data-i18n="[title]Expand the editor"></i>
3496 </label>
3497 <textarea id="sysprompt_content" class="text_pole textarea_compact autoSetHeight"></textarea>
3498 </div>
3499 </div>
3500
3501 <div>
3502 <h4 class="range-block-title justifyLeft standoutHeader">
3503 <span data-i18n="Custom Stopping Strings">
3504 Custom Stopping Strings
3505 </span>
3506 <a href="https://docs.sillytavern.app/usage/core-concepts/advancedformatting/#custom-stopping-strings" class="notes-link" target="_blank">
3507 <span class="fa-solid fa-circle-question note-link-span"></span>
3508 </a>
3509 </h4>
3510 <div>
3511 <small>
3512 <span data-i18n="JSON serialized array of strings">JSON serialized array of strings</span>
3513 <i class="fa-solid fa-question-circle opacity50p" title="e.g: [&quot;Ford&quot;, &quot;BMW&quot;, &quot;Fiat&quot;]"></i>
3514 </small>
3515 </div>
3516 <div>
3517 <textarea id="custom_stopping_strings" class="text_pole textarea_compact monospace autoSetHeight"></textarea>
3518 </div>
3519 <label class="checkbox_label" for="custom_stopping_strings_macro">
3520 <input id="custom_stopping_strings_macro" type="checkbox" checked>
3521 <small data-i18n="Replace Macro in Custom Stopping Strings">
3522 Replace Macro in Custom Stopping Strings
3523 </small>
3524 </label>
3525 </div>
3526
3527 <div name="tokenizerSettingsBlock">
3528 <div name="tokenizerSelectorBlock">
3529 <h4 class="standoutHeader"><span data-i18n="Tokenizer">Tokenizer</span>
3530 <a href="https://docs.sillytavern.app/usage/core-concepts/advancedformatting/#tokenizer" class="notes-link" target="_blank">
3531 <span class="fa-solid fa-circle-question note-link-span"></span>
3532 </a>
3533 </h4>
3534 <select id="tokenizer">
3535 <option value="99">Best match (recommended)</option>
3536 <option value="0">None / Estimated</option>
3537 <option value="1">GPT-2</option>
3538 <!-- Option #2 was a legacy GPT-2/3 tokenizer -->
3539 <option value="3">Llama 1/2</option>
3540 <option value="12">Llama 3</option>
3541 <option value="13">Gemma / Gemini</option>
3542 <option value="14">Jamba</option>
3543 <option value="15">Qwen2</option>
3544 <option value="16">Command-R</option>
3545 <option value="4">NerdStash (NovelAI Clio)</option>
3546 <option value="5">NerdStash v2 (NovelAI Kayra)</option>
3547 <option value="7">Mistral V1</option>
3548 <option value="17">Mistral Nemo</option>
3549 <option value="8">Yi</option>
3550 <option value="11">Claude 1/2</option>
3551 <option value="6">API (WebUI / koboldcpp)</option>
3552 </select>
3553 </div>
3554 <div class="range-block flex-container flexnowrap" name="tokenPaddingBlock">
3555 <div class="range-block-title justifyLeft">
3556 <small data-i18n="Token Padding" class="flex-container">Token Padding
3557 <a href="https://docs.sillytavern.app/usage/core-concepts/advancedformatting/#token-padding" class="notes-link" target="_blank">
3558 <span class="fa-solid fa-circle-question note-link-span"></span>
3559 </a>
3560 </small>
3561 </div>
3562 <input id="token_padding" class="text_pole textarea_compact" type="number" min="-2048" max="2048" />
3563 </div>
3564 </div>
3565 <div>
3566 <h4 class="standoutHeader" data-i18n="Miscellaneous">Miscellaneous</h4>
3567 <div>
3568 <small>
3569 <span data-i18n="Non-markdown strings">
3570 Non-markdown strings
3571 </span>
3572 </small>
3573 <div>
3574 <input id="markdown_escape_strings" class="text_pole textarea_compact" type="text" data-i18n="[placeholder]comma delimited,no spaces between" placeholder="comma delimited,no spaces between" />
3575 </div>
3576 </div>
3577
3578 <div name="startReplyWithBlock">
3579 <div>
3580 <small>
3581 <span data-i18n="Start Reply With">
3582 Start Reply With
3583 </span>
3584 </small>
3585 <div>
3586 <textarea id="start_reply_with" class="text_pole textarea_compact autoSetHeight"></textarea>
3587 </div>
3588 <label class="checkbox_label" for="chat-show-reply-prefix-checkbox">
3589 <input id="chat-show-reply-prefix-checkbox" type="checkbox" />
3590 <small data-i18n="Show reply prefix in chat">
3591 Show reply prefix in chat
3592 </small>
3593 </label>
3594 </div>
3595 </div>
3596 </div>
3597 </div>
3600 </div>3598 </div>
3601 </div>3599 </div>
3602 </div>3600 </div>
public/scripts/instruct-mode.js+0 -43
@@ -136,12 +136,6 @@ export async function loadInstructMode(data) {
136 option.selected = name === power_user.instruct.preset;136 option.selected = name === power_user.instruct.preset;
137 $('#instruct_presets').append(option);137 $('#instruct_presets').append(option);
138 });138 });
139
140 highlightDefaultPreset();
141}
142
143function highlightDefaultPreset() {
144 $('#instruct_set_default').toggleClass('default', power_user.default_instruct === power_user.instruct.preset);
145}139}
146140
147/**141/**
@@ -158,13 +152,6 @@ export function selectContextPreset(preset, { quiet = false, isAuto = false } =
158 !quiet && toastr.info(`Context Template: "${preset}" ${isAuto ? 'auto-' : ''}selected`);152 !quiet && toastr.info(`Context Template: "${preset}" ${isAuto ? 'auto-' : ''}selected`);
159 }153 }
160154
161 // If instruct mode is disabled, enable it, except for default context template
162 if (!power_user.instruct.enabled && preset !== power_user.default_context) {
163 power_user.instruct.enabled = true;
164 $('#instruct_enabled').prop('checked', true).trigger('change');
165 !quiet && toastr.info('Instruct Mode enabled');
166 }
167
168 saveSettingsDebounced();155 saveSettingsDebounced();
169}156}
170157
@@ -234,13 +221,6 @@ export function autoSelectInstructPreset(modelId) {
234 }221 }
235 }222 }
236 }223 }
237
238 if (power_user.instruct.bind_to_context && power_user.default_instruct && power_user.instruct.preset !== power_user.default_instruct) {
239 if (instruct_presets.some(p => p.name === power_user.default_instruct)) {
240 console.log(`Instruct mode: default preset "${power_user.default_instruct}" selected`);
241 $('#instruct_presets').val(power_user.default_instruct).trigger('change');
242 }
243 }
244 }224 }
245225
246 return false;226 return false;
@@ -579,10 +559,6 @@ function selectMatchingContextTemplate(name) {
579 break;559 break;
580 }560 }
581 }561 }
582 if (!foundMatch) {
583 // If no match was found, select default context preset
584 selectContextPreset(power_user.default_context, { isAuto: true });
585 }
586}562}
587563
588/**564/**
@@ -637,20 +613,6 @@ export function replaceInstructMacros(input, env) {
637}613}
638614
639jQuery(() => {615jQuery(() => {
640 $('#instruct_set_default').on('click', function () {
641 if (power_user.instruct.preset === power_user.default_instruct) {
642 power_user.default_instruct = null;
643 $(this).removeClass('default');
644 toastr.info('Default instruct template cleared');
645 } else {
646 power_user.default_instruct = power_user.instruct.preset;
647 $(this).addClass('default');
648 toastr.info(`Default instruct template set to ${power_user.default_instruct}`);
649 }
650
651 saveSettingsDebounced();
652 });
653
654 $('#instruct_system_same_as_user').on('input', function () {616 $('#instruct_system_same_as_user').on('input', function () {
655 const state = !!$(this).prop('checked');617 const state = !!$(this).prop('checked');
656 if (state) {618 if (state) {
@@ -679,9 +641,6 @@ jQuery(() => {
679 // When instruct mode gets enabled, select context template matching selected instruct preset641 // When instruct mode gets enabled, select context template matching selected instruct preset
680 if (power_user.instruct.enabled) {642 if (power_user.instruct.enabled) {
681 selectMatchingContextTemplate(power_user.instruct.preset);643 selectMatchingContextTemplate(power_user.instruct.preset);
682 } else {
683 // When instruct mode gets disabled, select default context preset
684 selectContextPreset(power_user.default_context);
685 }644 }
686 });645 });
687646
@@ -722,7 +681,5 @@ jQuery(() => {
722 // Select matching context template681 // Select matching context template
723 selectMatchingContextTemplate(name);682 selectMatchingContextTemplate(name);
724 }683 }
725
726 highlightDefaultPreset();
727 });684 });
728});685});
public/scripts/power-user.js+0 -23
@@ -207,7 +207,6 @@ let power_user = {
207 disable_group_trimming: false,207 disable_group_trimming: false,
208 single_line: false,208 single_line: false,
209209
210 default_instruct: '',
211 instruct: {210 instruct: {
212 enabled: false,211 enabled: false,
213 preset: 'Alpaca',212 preset: 'Alpaca',
@@ -234,7 +233,6 @@ let power_user = {
234 separator_sequence: '',233 separator_sequence: '',
235 },234 },
236235
237 default_context: 'Default',
238 context: {236 context: {
239 preset: 'Default',237 preset: 'Default',
240 story_string: defaultStoryString,238 story_string: defaultStoryString,
@@ -1824,29 +1822,8 @@ async function loadContextSettings() {
1824 }1822 }
1825 }1823 }
18261824
1827 highlightDefaultContext();
1828 saveSettingsDebounced();1825 saveSettingsDebounced();
1829 });1826 });
1830
1831 $('#context_set_default').on('click', function () {
1832 if (power_user.context.preset !== power_user.default_context) {
1833 power_user.default_context = power_user.context.preset;
1834 $(this).addClass('default');
1835 toastr.info(`Default context template set to ${power_user.default_context}`);
1836
1837 highlightDefaultContext();
1838
1839 saveSettingsDebounced();
1840 }
1841 });
1842
1843 highlightDefaultContext();
1844}
1845
1846function highlightDefaultContext() {
1847 $('#context_set_default').toggleClass('default', power_user.default_context === power_user.context.preset);
1848 $('#context_set_default').toggleClass('disabled', power_user.default_context === power_user.context.preset);
1849 $('#context_delete_preset').toggleClass('disabled', power_user.default_context === power_user.context.preset);
1850}1827}
18511828
1852/**1829/**
public/scripts/preset-manager.js+0 -5
@@ -615,11 +615,6 @@ export async function initPresetManager() {
615 return;615 return;
616 }616 }
617617
618 // default context preset cannot be deleted
619 if (apiId == 'context' && power_user.default_context === power_user.context.preset) {
620 return;
621 }
622
623 const headerText = !presetManager.isAdvancedFormatting() ? 'Delete this preset?' : 'Delete this template?';618 const headerText = !presetManager.isAdvancedFormatting() ? 'Delete this preset?' : 'Delete this template?';
624 const confirm = await Popup.show.confirm(headerText, 'This action is irreversible and your current settings will be overwritten.');619 const confirm = await Popup.show.confirm(headerText, 'This action is irreversible and your current settings will be overwritten.');
625 if (!confirm) {620 if (!confirm) {
public/style.css+0 -8
@@ -2630,14 +2630,6 @@ select option:not(:checked) {
2630 color: var(--active) !important;2630 color: var(--active) !important;
2631}2631}
26322632
2633#context_set_default.default {
2634 color: var(--preferred) !important;
2635}
2636
2637#instruct_set_default.default {
2638 color: var(--preferred) !important;
2639}
2640
2641.displayBlock {2633.displayBlock {
2642 display: block !important;2634 display: block !important;
2643}2635}