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