Add quiet args to /instruct and /model
| @@ -8522,7 +8522,7 @@ async function selectContextCallback(_, name) { | ||
| 8522 | 8522 | return foundName; |
| 8523 | 8523 | } |
| 8524 | 8524 | |
| 8525 | 8525 | async function selectInstructCallback(_args, name) { |
| 8526 | 8526 | if (!name) { |
| 8527 | 8527 | return power_user.instruct.preset; |
| 8528 | 8528 | } |
| @@ -8536,8 +8536,9 @@ async function selectInstructCallback(_, name) { | ||
| 8536 | 8536 | return ''; |
| 8537 | 8537 | } |
| 8538 | 8538 | |
| 8539 | + const quiet = isTrueBoolean(args?.quiet); | |
| 8539 | 8540 | const foundName = result[0].item; |
| 8540 | 8541 | selectInstructPreset(foundName, quiet); |
| 8541 | 8542 | return foundName; |
| 8542 | 8543 | } |
| 8543 | 8544 | |
| @@ -9216,6 +9217,15 @@ jQuery(async function () { | ||
| 9216 | 9217 | name: 'instruct', |
| 9217 | 9218 | callback: selectInstructCallback, |
| 9218 | 9219 | returns: 'current template', |
| 9220 | + namedArgumentList: [ | |
| 9221 | + SlashCommandNamedArgument.fromProps({ | |
| 9222 | + name: 'quiet', | |
| 9223 | + description: 'Suppress the toast message on template change', | |
| 9224 | + typeList: [ARGUMENT_TYPE.BOOLEAN], | |
| 9225 | + defaultValue: 'false', | |
| 9226 | + enumList: commonEnumProviders.boolean('trueFalse')(), | |
| 9227 | + }), | |
| 9228 | + ], | |
| 9219 | 9229 | unnamedArgumentList: [ |
| 9220 | 9230 | SlashCommandArgument.fromProps({ |
| 9221 | 9231 | description: 'instruct template name', |
| @@ -151,19 +151,20 @@ export function selectContextPreset(preset) { | ||
| 151 | 151 | /** |
| 152 | 152 | * Select instruct preset if not already selected. |
| 153 | 153 | * @param {string} preset Preset name. |
| 154 | + * @param {boolean} quiet Suppress info message. | |
| 154 | 155 | */ |
| 155 | 156 | export function selectInstructPreset(preset, quiet) { |
| 156 | 157 | // If instruct preset is not already selected, select it |
| 157 | 158 | if (preset !== power_user.instruct.preset) { |
| 158 | 159 | $('#instruct_presets').val(preset).trigger('change'); |
| 159 | 160 | !quiet && toastr.info(`Instruct Mode: template "${preset}" auto-selected`); |
| 160 | 161 | } |
| 161 | 162 | |
| 162 | 163 | // If instruct mode is disabled, enable it |
| 163 | 164 | if (!power_user.instruct.enabled) { |
| 164 | 165 | power_user.instruct.enabled = true; |
| 165 | 166 | $('#instruct_enabled').prop('checked', true).trigger('change'); |
| 166 | 167 | !quiet && toastr.info('Instruct Mode enabled'); |
| 167 | 168 | } |
| 168 | 169 | |
| 169 | 170 | saveSettingsDebounced(); |
| @@ -1477,6 +1477,15 @@ export function initDefaultSlashCommands() { | ||
| 1477 | 1477 | name: 'model', |
| 1478 | 1478 | callback: modelCallback, |
| 1479 | 1479 | returns: 'current model', |
| 1480 | + namedArgumentList: [ | |
| 1481 | + SlashCommandNamedArgument.fromProps({ | |
| 1482 | + name: 'quiet', | |
| 1483 | + description: 'suppress the toast message on model change', | |
| 1484 | + typeList: [ARGUMENT_TYPE.BOOLEAN], | |
| 1485 | + defaultValue: 'false', | |
| 1486 | + enumList: commonEnumProviders.boolean('trueFalse')(), | |
| 1487 | + }), | |
| 1488 | + ], | |
| 1480 | 1489 | unnamedArgumentList: [ |
| 1481 | 1490 | SlashCommandArgument.fromProps({ |
| 1482 | 1491 | description: 'model name', |
| @@ -3382,11 +3391,11 @@ function getModelOptions() { | ||
| 3382 | 3391 | |
| 3383 | 3392 | /** |
| 3384 | 3393 | * Sets a model for the current API. |
| 3385 | 3394 | * @param {object} _args UnusedNamed arguments |
| 3386 | 3395 | * @param {string} model New model name |
| 3387 | 3396 | * @returns {string} New or existing model name |
| 3388 | 3397 | */ |
| 3389 | 3398 | function modelCallback(_args, model) { |
| 3390 | 3399 | const { control: modelSelectControl, options } = getModelOptions(); |
| 3391 | 3400 | |
| 3392 | 3401 | // If no model was found, the reason was already logged, we just return here |
| @@ -3426,7 +3435,8 @@ function modelCallback(_, model) { | ||
| 3426 | 3435 | if (newSelectedOption) { |
| 3427 | 3436 | modelSelectControl.value = newSelectedOption.value; |
| 3428 | 3437 | $(modelSelectControl).trigger('change'); |
| 3429 | - toastr.success(`Model set to "${newSelectedOption.text}"`); | |
| 3438 | + const quiet = isTrueBoolean(args?.quiet); | |
| 3439 | + !quiet && toastr.success(`Model set to "${newSelectedOption.text}"`); | |
| 3430 | 3440 | return newSelectedOption.value; |
| 3431 | 3441 | } else { |
| 3432 | 3442 | toastr.warning(`No model found with name "${model}"`); |