Merge pull request #2767 from SillyTavern/af-verbiage Update Advanced Formatting verbiage

7040f640f43f770e3873447ffb57cbba83377a6c

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

Signed
4 files changed, +65 -46Ignore whitespace
public/index.html+19 -19
@@ -3073,15 +3073,15 @@
30733073 </h4>
30743074 <div class="flex-container justifyCenter">
30753075 <input type="file" hidden data-preset-manager-file="context" accept=".json, .settings">
30763076 <i id="context_set_default" class="menu_button fa-solid fa-heart" title="Auto-select this presettemplate for Instruct Mode." data-i18n="[title]Auto-select this presettemplate for Instruct Mode"></i>
30773077 <i data-preset-manager-update="context" class="menu_button fa-solid fa-save" title="Update current presettemplate" data-i18n="[title]Update current presettemplate"></i>
30783078 <i data-preset-manager-new="context" class="menu_button fa-solid fa-file-circle-plus" title="Save presettemplate as" data-i18n="[title]Save presettemplate as"></i>
30793079 <i data-preset-manager-import="context" class="menu_button fa-solid fa-file-import" title="Import presettemplate" data-i18n="[title]Import presettemplate"></i>
30803080 <i data-preset-manager-export="context" class="menu_button fa-solid fa-file-export" title="Export presettemplate" data-i18n="[title]Export presettemplate"></i>
30813081 <i data-preset-manager-restore="context" class="menu_button fa-solid fa-recycle" title="Restore current presettemplate" data-i18n="[title]Restore current presettemplate"></i>
30823082 <i id="context_delete_preset" data-preset-manager-delete="context" class="menu_button fa-solid fa-trash-can" title="Delete the presettemplate" data-i18n="[title]Delete the presettemplate"></i>
30833083 </div>
3084- <div class="flex-container">
3084+ <div class="flex-container" title="Select your current Context Template" data-i18n="[title]Select your current Context Template">
30853085 <select id="context_presets" data-preset-manager-for="context" class="flex1 text_pole"></select>
30863086 </div>
30873087 <div>
@@ -3196,7 +3196,7 @@
31963196 <div id="instructSettingsBlock">
31973197 <h4 class="standoutHeader title_restorable justifySpaceBetween">
31983198 <div class="flex-container">
31993199 <span data-i18n="Instruct ModeTemplate">Instruct ModeTemplate</span>
32003200 <a href="https://docs.sillytavern.app/usage/core-concepts/instructmode/" class="notes-link" target="_blank">
32013201 <span class="fa-solid fa-circle-question note-link-span"></span>
32023202 </a>
@@ -3214,22 +3214,22 @@
32143214 </h4>
32153215 <div class="flex-container margin0 justifyCenter">
32163216 <input type="file" hidden data-preset-manager-file="instruct" accept=".json, .settings">
32173217 <i id="instruct_set_default" class="menu_button fa-solid fa-heart" title="Auto-select this presettemplate on API connection." data-i18n="[title]Auto-select this presettemplate on API connection"></i>
32183218 <i data-preset-manager-update="instruct" class="menu_button fa-solid fa-save" title="Update current presettemplate" data-i18n="[title]Update current presettemplate"></i>
32193219 <i data-preset-manager-new="instruct" class="menu_button fa-solid fa-file-circle-plus" title="Save presettemplate as" data-i18n="[title]Save presettemplate as"></i>
32203220 <i data-preset-manager-import="instruct" class=" menu_button fa-solid fa-file-import" title="Import presettemplate" data-i18n="[title]Import presettemplate"></i>
32213221 <i data-preset-manager-export="instruct" class=" menu_button fa-solid fa-file-export" title="Export presettemplate" data-i18n="[title]Export presettemplate"></i>
32223222 <i data-preset-manager-restore="instruct" class=" menu_button fa-solid fa-recycle" title="Restore current presettemplate" data-i18n="[title]Restore current presettemplate"></i>
32233223 <i data-preset-manager-delete="instruct" class=" menu_button fa-solid fa-trash-can" title="Delete the presettemplate" data-i18n="[title]Delete the presettemplate"></i>
32243224 </div>
32253225
3226- <div class="flex-container">
3226+ <div class="flex-container" title="Select your current Instruct Template" data-i18n="[title]Select your current Instruct Template">
32273227 <select id="instruct_presets" data-preset-manager-for="instruct" class="flex1 text_pole"></select>
32283228 </div>
32293229 <label>
32303230 <small>
32313231 <span data-i18n="Activation Regex">Activation Regex</span>
32323232 <span class="fa-solid fa-circle-question" title="When connecting to an API or choosing a model, automatically activate this Instruct Mode templateTemplate if the model name matches the provided regular expression."></span>
32333233 </small>
32343234 </label>
32353235 <div>
public/script.js+8 -8
@@ -8511,7 +8511,7 @@ async function selectContextCallback(_, name) {
85118511 const result = fuse.search(name);
85128512
85138513 if (result.length === 0) {
85148514 toastr.warning(`Context presettemplate "${name}" not found`);
85158515 return '';
85168516 }
85178517
@@ -8530,7 +8530,7 @@ async function selectInstructCallback(_, name) {
85308530 const result = fuse.search(name);
85318531
85328532 if (result.length === 0) {
85338533 toastr.warning(`Instruct presettemplate "${name}" not found`);
85348534 return '';
85358535 }
85368536
@@ -9054,8 +9054,8 @@ API: ${getSettingsContents.main_api}
90549054API Type: ${getSettingsContents[getSettingsContents.main_api + '_settings'].type}
90559055API server: ${getSettingsContents.api_server}
90569056Model: ${getContextContents.onlineStatus}
90579057Context PresetTemplate: ${power_user.context.preset}
90589058Instruct PresetTemplate: ${power_user.instruct.preset}
90599059API Settings: ${JSON.stringify(getSettingsContents[getSettingsContents.main_api + '_settings'], null, 2)}
90609060\`\`\`
90619061 `;
@@ -9193,17 +9193,17 @@ jQuery(async function () {
91939193 SlashCommandParser.addCommandObject(SlashCommand.fromProps({
91949194 name: 'instruct',
91959195 callback: selectInstructCallback,
91969196 returns: 'current presettemplate',
91979197 unnamedArgumentList: [
91989198 SlashCommandArgument.fromProps({
91999199 description: 'instruct presettemplate name',
92009200 typeList: [ARGUMENT_TYPE.STRING],
92019201 enumProvider: () => instruct_presets.map(preset => new SlashCommandEnumValue(preset.name, null, enumTypes.enum, enumIcons.preset)),
92029202 }),
92039203 ],
92049204 helpString: `
92059205 <div>
92069206 Selects instruct mode presettemplate by name. Gets the current instruct template if no name is provided.
92079207 </div>
92089208 <div>
92099209 <strong>Example:</strong>
@@ -9231,7 +9231,7 @@ jQuery(async function () {
92319231 returns: 'template name',
92329232 unnamedArgumentList: [
92339233 SlashCommandArgument.fromProps({
92349234 description: 'context presettemplate name',
92359235 typeList: [ARGUMENT_TYPE.STRING],
92369236 enumProvider: () => context_presets.map(preset => new SlashCommandEnumValue(preset.name, null, enumTypes.enum, enumIcons.preset)),
92379237 }),
public/scripts/instruct-mode.js+3 -3
@@ -156,7 +156,7 @@ export function selectInstructPreset(preset) {
156156 // If instruct preset is not already selected, select it
157157 if (preset !== power_user.instruct.preset) {
158158 $('#instruct_presets').val(preset).trigger('change');
159159 toastr.info(`Instruct Mode: presettemplate "${preset}" auto-selected`);
160160 }
161161
162162 // If instruct mode is disabled, enable it
@@ -596,11 +596,11 @@ jQuery(() => {
596596 if (power_user.instruct.preset === power_user.default_instruct) {
597597 power_user.default_instruct = null;
598598 $(this).removeClass('default');
599599 toastr.info('Default instruct presettemplate cleared');
600600 } else {
601601 power_user.default_instruct = power_user.instruct.preset;
602602 $(this).addClass('default');
603603 toastr.info(`Default instruct presettemplate set to ${power_user.default_instruct}`);
604604 }
605605
606606 saveSettingsDebounced();
public/scripts/preset-manager.js+35 -16
@@ -160,20 +160,25 @@ class PresetManager {
160160
161161 const name = selected.text();
162162 await this.savePreset(name);
163- toastr.success('Preset updated');
163+
164+ const successToast = !this.isAdvancedFormatting() ? 'Preset updated' : 'Template updated';
165+ toastr.success(successToast);
164166 }
165167
166168 async savePresetAs() {
167169 const inputValue = this.getSelectedPresetName();
168170 const popupText = !this.isNonGenericApiisAdvancedFormatting() ? '<h4>Hint: Use a character/group name to bind preset to a specific chat.</h4>' : '';
169171 const nameheaderText = await Popup.show!this.inputisAdvancedFormatting() ? 'Preset name:', popupText,: inputValue)'Template name:';
172+ const name = await Popup.show.input(headerText, popupText, inputValue);
170173 if (!name) {
171174 console.log('Preset name not provided');
172175 return;
173176 }
174177
175178 await this.savePreset(name);
176- toastr.success('Preset saved');
179+
180+ const successToast = !this.isAdvancedFormatting() ? 'Preset saved' : 'Template saved';
181+ toastr.success(successToast);
177182 }
178183
179184 async savePreset(name, settings) {
@@ -234,7 +239,7 @@ class PresetManager {
234239 return this.apiId == 'textgenerationwebui' || this.apiId == 'context' || this.apiId == 'instruct';
235240 }
236241
237242 isNonGenericApiisAdvancedFormatting() {
238243 return this.apiId == 'context' || this.apiId == 'instruct';
239244 }
240245
@@ -342,7 +347,7 @@ class PresetManager {
342347 }
343348 }
344349
345350 if (!this.isNonGenericApiisAdvancedFormatting()) {
346351 settings['genamt'] = amount_gen;
347352 settings['max_length'] = max_context;
348353 }
@@ -394,7 +399,8 @@ class PresetManager {
394399 });
395400
396401 if (!response.ok) {
397402 toastrconst errorToast = !this.errorisAdvancedFormatting() ? 'Failed to restore default preset') : 'Failed to restore default template';
403+ toastr.error(errorToast);
398404 return;
399405 }
400406
@@ -580,7 +586,8 @@ export async function initPresetManager() {
580586 data['name'] = name;
581587
582588 await presetManager.savePreset(name, data);
583- toastr.success('Preset imported');
589+ const successToast = !presetManager.isAdvancedFormatting() ? 'Preset imported' : 'Template imported';
590+ toastr.success(successToast);
584591 e.target.value = null;
585592 });
586593
@@ -598,7 +605,8 @@ export async function initPresetManager() {
598605 return;
599606 }
600607
601- const confirm = await Popup.show.confirm('Delete the preset?', 'This action is irreversible and your current settings will be overwritten.');
608+ const headerText = !presetManager.isAdvancedFormatting() ? 'Delete this preset?' : 'Delete this template?';
609+ const confirm = await Popup.show.confirm(headerText, 'This action is irreversible and your current settings will be overwritten.');
602610 if (!confirm) {
603611 return;
604612 }
@@ -606,9 +614,11 @@ export async function initPresetManager() {
606614 const result = await presetManager.deleteCurrentPreset();
607615
608616 if (result) {
609- toastr.success('Preset deleted');
617+ const successToast = !presetManager.isAdvancedFormatting() ? 'Preset deleted' : 'Template deleted';
618+ toastr.success(successToast);
610619 } else {
611620 toastrconst warningToast = !presetManager.warningisAdvancedFormatting() ? 'Preset was not deleted from server') : 'Template was not deleted from server';
621+ toastr.warning(warningToast);
612622 }
613623
614624 saveSettingsDebounced();
@@ -637,11 +647,15 @@ export async function initPresetManager() {
637647
638648 if (data.isDefault) {
639649 if (Object.keys(data.preset).length === 0) {
640650 toastrconst errorToast = !presetManager.errorisAdvancedFormatting() ? 'Default preset cannot be restored') : 'Default template cannot be restored';
651+ toastr.error(errorToast);
641652 return;
642653 }
643654
644- const confirm = await Popup.show.confirm('Are you sure?', 'Resetting a <b>default preset</b> will restore the default settings.');
655+ const confirmText = !presetManager.isAdvancedFormatting()
656+ ? 'Resetting a <b>default preset</b> will restore the default settings.'
657+ : 'Resetting a <b>default template</b> will restore the default settings.';
658+ const confirm = await Popup.show.confirm('Are you sure?', confirmText);
645659 if (!confirm) {
646660 return;
647661 }
@@ -650,16 +664,21 @@ export async function initPresetManager() {
650664 await presetManager.savePreset(name, data.preset);
651665 const option = presetManager.findPreset(name);
652666 presetManager.selectPreset(option);
653- toastr.success('Default preset restored');
667+ const successToast = !presetManager.isAdvancedFormatting() ? 'Default preset restored' : 'Default template restored';
668+ toastr.success(successToast);
654669 } else {
655- const confirm = await Popup.show.confirm('Are you sure?', 'Resetting a <b>custom preset</b> will restore to the last saved state.');
670+ const confirmText = !presetManager.isAdvancedFormatting()
671+ ? 'Resetting a <b>custom preset</b> will restore to the last saved state.'
672+ : 'Resetting a <b>custom template</b> will restore to the last saved state.';
673+ const confirm = await Popup.show.confirm('Are you sure?', confirmText);
656674 if (!confirm) {
657675 return;
658676 }
659677
660678 const option = presetManager.findPreset(name);
661679 presetManager.selectPreset(option);
662- toastr.success('Preset restored');
680+ const successToast = !presetManager.isAdvancedFormatting() ? 'Preset restored' : 'Template restored';
681+ toastr.success(successToast);
663682 }
664683 });
665684}