Merge pull request #2767 from SillyTavern/af-verbiage Update Advanced Formatting verbiage
Signed| @@ -3073,15 +3073,15 @@ | ||
| 3073 | 3073 | </h4> |
| 3074 | 3074 | <div class="flex-container justifyCenter"> |
| 3075 | 3075 | <input type="file" hidden data-preset-manager-file="context" accept=".json, .settings"> |
| 3076 | 3076 | <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> |
| 3077 | 3077 | <i data-preset-manager-update="context" class="menu_button fa-solid fa-save" title="Update current presettemplate" data-i18n="[title]Update current presettemplate"></i> |
| 3078 | 3078 | <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> |
| 3079 | 3079 | <i data-preset-manager-import="context" class="menu_button fa-solid fa-file-import" title="Import presettemplate" data-i18n="[title]Import presettemplate"></i> |
| 3080 | 3080 | <i data-preset-manager-export="context" class="menu_button fa-solid fa-file-export" title="Export presettemplate" data-i18n="[title]Export presettemplate"></i> |
| 3081 | 3081 | <i data-preset-manager-restore="context" class="menu_button fa-solid fa-recycle" title="Restore current presettemplate" data-i18n="[title]Restore current presettemplate"></i> |
| 3082 | 3082 | <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> |
| 3083 | 3083 | </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"> | |
| 3085 | 3085 | <select id="context_presets" data-preset-manager-for="context" class="flex1 text_pole"></select> |
| 3086 | 3086 | </div> |
| 3087 | 3087 | <div> |
| @@ -3196,7 +3196,7 @@ | ||
| 3196 | 3196 | <div id="instructSettingsBlock"> |
| 3197 | 3197 | <h4 class="standoutHeader title_restorable justifySpaceBetween"> |
| 3198 | 3198 | <div class="flex-container"> |
| 3199 | 3199 | <span data-i18n="Instruct ModeTemplate">Instruct ModeTemplate</span> |
| 3200 | 3200 | <a href="https://docs.sillytavern.app/usage/core-concepts/instructmode/" class="notes-link" target="_blank"> |
| 3201 | 3201 | <span class="fa-solid fa-circle-question note-link-span"></span> |
| 3202 | 3202 | </a> |
| @@ -3214,22 +3214,22 @@ | ||
| 3214 | 3214 | </h4> |
| 3215 | 3215 | <div class="flex-container margin0 justifyCenter"> |
| 3216 | 3216 | <input type="file" hidden data-preset-manager-file="instruct" accept=".json, .settings"> |
| 3217 | 3217 | <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> |
| 3218 | 3218 | <i data-preset-manager-update="instruct" class="menu_button fa-solid fa-save" title="Update current presettemplate" data-i18n="[title]Update current presettemplate"></i> |
| 3219 | 3219 | <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> |
| 3220 | 3220 | <i data-preset-manager-import="instruct" class=" menu_button fa-solid fa-file-import" title="Import presettemplate" data-i18n="[title]Import presettemplate"></i> |
| 3221 | 3221 | <i data-preset-manager-export="instruct" class=" menu_button fa-solid fa-file-export" title="Export presettemplate" data-i18n="[title]Export presettemplate"></i> |
| 3222 | 3222 | <i data-preset-manager-restore="instruct" class=" menu_button fa-solid fa-recycle" title="Restore current presettemplate" data-i18n="[title]Restore current presettemplate"></i> |
| 3223 | 3223 | <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> |
| 3224 | 3224 | </div> |
| 3225 | 3225 | |
| 3226 | - <div class="flex-container"> | |
| 3226 | + <div class="flex-container" title="Select your current Instruct Template" data-i18n="[title]Select your current Instruct Template"> | |
| 3227 | 3227 | <select id="instruct_presets" data-preset-manager-for="instruct" class="flex1 text_pole"></select> |
| 3228 | 3228 | </div> |
| 3229 | 3229 | <label> |
| 3230 | 3230 | <small> |
| 3231 | 3231 | <span data-i18n="Activation Regex">Activation Regex</span> |
| 3232 | 3232 | <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> |
| 3233 | 3233 | </small> |
| 3234 | 3234 | </label> |
| 3235 | 3235 | <div> |
| @@ -8511,7 +8511,7 @@ async function selectContextCallback(_, name) { | ||
| 8511 | 8511 | const result = fuse.search(name); |
| 8512 | 8512 | |
| 8513 | 8513 | if (result.length === 0) { |
| 8514 | 8514 | toastr.warning(`Context presettemplate "${name}" not found`); |
| 8515 | 8515 | return ''; |
| 8516 | 8516 | } |
| 8517 | 8517 | |
| @@ -8530,7 +8530,7 @@ async function selectInstructCallback(_, name) { | ||
| 8530 | 8530 | const result = fuse.search(name); |
| 8531 | 8531 | |
| 8532 | 8532 | if (result.length === 0) { |
| 8533 | 8533 | toastr.warning(`Instruct presettemplate "${name}" not found`); |
| 8534 | 8534 | return ''; |
| 8535 | 8535 | } |
| 8536 | 8536 | |
| @@ -9054,8 +9054,8 @@ API: ${getSettingsContents.main_api} | ||
| 9054 | 9054 | API Type: ${getSettingsContents[getSettingsContents.main_api + '_settings'].type} |
| 9055 | 9055 | API server: ${getSettingsContents.api_server} |
| 9056 | 9056 | Model: ${getContextContents.onlineStatus} |
| 9057 | 9057 | Context PresetTemplate: ${power_user.context.preset} |
| 9058 | 9058 | Instruct PresetTemplate: ${power_user.instruct.preset} |
| 9059 | 9059 | API Settings: ${JSON.stringify(getSettingsContents[getSettingsContents.main_api + '_settings'], null, 2)} |
| 9060 | 9060 | \`\`\` |
| 9061 | 9061 | `; |
| @@ -9193,17 +9193,17 @@ jQuery(async function () { | ||
| 9193 | 9193 | SlashCommandParser.addCommandObject(SlashCommand.fromProps({ |
| 9194 | 9194 | name: 'instruct', |
| 9195 | 9195 | callback: selectInstructCallback, |
| 9196 | 9196 | returns: 'current presettemplate', |
| 9197 | 9197 | unnamedArgumentList: [ |
| 9198 | 9198 | SlashCommandArgument.fromProps({ |
| 9199 | 9199 | description: 'instruct presettemplate name', |
| 9200 | 9200 | typeList: [ARGUMENT_TYPE.STRING], |
| 9201 | 9201 | enumProvider: () => instruct_presets.map(preset => new SlashCommandEnumValue(preset.name, null, enumTypes.enum, enumIcons.preset)), |
| 9202 | 9202 | }), |
| 9203 | 9203 | ], |
| 9204 | 9204 | helpString: ` |
| 9205 | 9205 | <div> |
| 9206 | 9206 | Selects instruct mode presettemplate by name. Gets the current instruct template if no name is provided. |
| 9207 | 9207 | </div> |
| 9208 | 9208 | <div> |
| 9209 | 9209 | <strong>Example:</strong> |
| @@ -9231,7 +9231,7 @@ jQuery(async function () { | ||
| 9231 | 9231 | returns: 'template name', |
| 9232 | 9232 | unnamedArgumentList: [ |
| 9233 | 9233 | SlashCommandArgument.fromProps({ |
| 9234 | 9234 | description: 'context presettemplate name', |
| 9235 | 9235 | typeList: [ARGUMENT_TYPE.STRING], |
| 9236 | 9236 | enumProvider: () => context_presets.map(preset => new SlashCommandEnumValue(preset.name, null, enumTypes.enum, enumIcons.preset)), |
| 9237 | 9237 | }), |
| @@ -156,7 +156,7 @@ export function selectInstructPreset(preset) { | ||
| 156 | 156 | // If instruct preset is not already selected, select it |
| 157 | 157 | if (preset !== power_user.instruct.preset) { |
| 158 | 158 | $('#instruct_presets').val(preset).trigger('change'); |
| 159 | 159 | toastr.info(`Instruct Mode: presettemplate "${preset}" auto-selected`); |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | // If instruct mode is disabled, enable it |
| @@ -596,11 +596,11 @@ jQuery(() => { | ||
| 596 | 596 | if (power_user.instruct.preset === power_user.default_instruct) { |
| 597 | 597 | power_user.default_instruct = null; |
| 598 | 598 | $(this).removeClass('default'); |
| 599 | 599 | toastr.info('Default instruct presettemplate cleared'); |
| 600 | 600 | } else { |
| 601 | 601 | power_user.default_instruct = power_user.instruct.preset; |
| 602 | 602 | $(this).addClass('default'); |
| 603 | 603 | toastr.info(`Default instruct presettemplate set to ${power_user.default_instruct}`); |
| 604 | 604 | } |
| 605 | 605 | |
| 606 | 606 | saveSettingsDebounced(); |
| @@ -160,20 +160,25 @@ class PresetManager { | ||
| 160 | 160 | |
| 161 | 161 | const name = selected.text(); |
| 162 | 162 | await this.savePreset(name); |
| 163 | - toastr.success('Preset updated'); | |
| 163 | + | |
| 164 | + const successToast = !this.isAdvancedFormatting() ? 'Preset updated' : 'Template updated'; | |
| 165 | + toastr.success(successToast); | |
| 164 | 166 | } |
| 165 | 167 | |
| 166 | 168 | async savePresetAs() { |
| 167 | 169 | const inputValue = this.getSelectedPresetName(); |
| 168 | 170 | const popupText = !this.isNonGenericApiisAdvancedFormatting() ? '<h4>Hint: Use a character/group name to bind preset to a specific chat.</h4>' : ''; |
| 169 | 171 | const nameheaderText = await Popup.show!this.inputisAdvancedFormatting() ? 'Preset name:', popupText,: inputValue)'Template name:'; |
| 172 | + const name = await Popup.show.input(headerText, popupText, inputValue); | |
| 170 | 173 | if (!name) { |
| 171 | 174 | console.log('Preset name not provided'); |
| 172 | 175 | return; |
| 173 | 176 | } |
| 174 | 177 | |
| 175 | 178 | await this.savePreset(name); |
| 176 | - toastr.success('Preset saved'); | |
| 179 | + | |
| 180 | + const successToast = !this.isAdvancedFormatting() ? 'Preset saved' : 'Template saved'; | |
| 181 | + toastr.success(successToast); | |
| 177 | 182 | } |
| 178 | 183 | |
| 179 | 184 | async savePreset(name, settings) { |
| @@ -234,7 +239,7 @@ class PresetManager { | ||
| 234 | 239 | return this.apiId == 'textgenerationwebui' || this.apiId == 'context' || this.apiId == 'instruct'; |
| 235 | 240 | } |
| 236 | 241 | |
| 237 | 242 | isNonGenericApiisAdvancedFormatting() { |
| 238 | 243 | return this.apiId == 'context' || this.apiId == 'instruct'; |
| 239 | 244 | } |
| 240 | 245 | |
| @@ -342,7 +347,7 @@ class PresetManager { | ||
| 342 | 347 | } |
| 343 | 348 | } |
| 344 | 349 | |
| 345 | 350 | if (!this.isNonGenericApiisAdvancedFormatting()) { |
| 346 | 351 | settings['genamt'] = amount_gen; |
| 347 | 352 | settings['max_length'] = max_context; |
| 348 | 353 | } |
| @@ -394,7 +399,8 @@ class PresetManager { | ||
| 394 | 399 | }); |
| 395 | 400 | |
| 396 | 401 | if (!response.ok) { |
| 397 | 402 | toastrconst errorToast = !this.errorisAdvancedFormatting() ? 'Failed to restore default preset') : 'Failed to restore default template'; |
| 403 | + toastr.error(errorToast); | |
| 398 | 404 | return; |
| 399 | 405 | } |
| 400 | 406 | |
| @@ -580,7 +586,8 @@ export async function initPresetManager() { | ||
| 580 | 586 | data['name'] = name; |
| 581 | 587 | |
| 582 | 588 | await presetManager.savePreset(name, data); |
| 583 | - toastr.success('Preset imported'); | |
| 589 | + const successToast = !presetManager.isAdvancedFormatting() ? 'Preset imported' : 'Template imported'; | |
| 590 | + toastr.success(successToast); | |
| 584 | 591 | e.target.value = null; |
| 585 | 592 | }); |
| 586 | 593 | |
| @@ -598,7 +605,8 @@ export async function initPresetManager() { | ||
| 598 | 605 | return; |
| 599 | 606 | } |
| 600 | 607 | |
| 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.'); | |
| 602 | 610 | if (!confirm) { |
| 603 | 611 | return; |
| 604 | 612 | } |
| @@ -606,9 +614,11 @@ export async function initPresetManager() { | ||
| 606 | 614 | const result = await presetManager.deleteCurrentPreset(); |
| 607 | 615 | |
| 608 | 616 | if (result) { |
| 609 | - toastr.success('Preset deleted'); | |
| 617 | + const successToast = !presetManager.isAdvancedFormatting() ? 'Preset deleted' : 'Template deleted'; | |
| 618 | + toastr.success(successToast); | |
| 610 | 619 | } else { |
| 611 | 620 | toastrconst warningToast = !presetManager.warningisAdvancedFormatting() ? 'Preset was not deleted from server') : 'Template was not deleted from server'; |
| 621 | + toastr.warning(warningToast); | |
| 612 | 622 | } |
| 613 | 623 | |
| 614 | 624 | saveSettingsDebounced(); |
| @@ -637,11 +647,15 @@ export async function initPresetManager() { | ||
| 637 | 647 | |
| 638 | 648 | if (data.isDefault) { |
| 639 | 649 | if (Object.keys(data.preset).length === 0) { |
| 640 | 650 | toastrconst errorToast = !presetManager.errorisAdvancedFormatting() ? 'Default preset cannot be restored') : 'Default template cannot be restored'; |
| 651 | + toastr.error(errorToast); | |
| 641 | 652 | return; |
| 642 | 653 | } |
| 643 | 654 | |
| 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); | |
| 645 | 659 | if (!confirm) { |
| 646 | 660 | return; |
| 647 | 661 | } |
| @@ -650,16 +664,21 @@ export async function initPresetManager() { | ||
| 650 | 664 | await presetManager.savePreset(name, data.preset); |
| 651 | 665 | const option = presetManager.findPreset(name); |
| 652 | 666 | presetManager.selectPreset(option); |
| 653 | - toastr.success('Default preset restored'); | |
| 667 | + const successToast = !presetManager.isAdvancedFormatting() ? 'Default preset restored' : 'Default template restored'; | |
| 668 | + toastr.success(successToast); | |
| 654 | 669 | } 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); | |
| 656 | 674 | if (!confirm) { |
| 657 | 675 | return; |
| 658 | 676 | } |
| 659 | 677 | |
| 660 | 678 | const option = presetManager.findPreset(name); |
| 661 | 679 | presetManager.selectPreset(option); |
| 662 | - toastr.success('Preset restored'); | |
| 680 | + const successToast = !presetManager.isAdvancedFormatting() ? 'Preset restored' : 'Template restored'; | |
| 681 | + toastr.success(successToast); | |
| 663 | 682 | } |
| 664 | 683 | }); |
| 665 | 684 | } |