Remove long deprecated STscript commands and parameters (#5312)
* Remove deprecated 'format' argument from /listinjects and /listvars commands * Remove deprecated /lock command and add as alias to /persona-lock * Add 'bind' as an alias for /persona-lock command (#5321) * Initial plan * Add 'bind' as an alias for /persona-lock command Co-authored-by: Cohee1207 <18619528+Cohee1207@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Cohee1207 <18619528+Cohee1207@users.noreply.github.com> --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: Cohee1207 <18619528+Cohee1207@users.noreply.github.com>
This commit is contained in:
@@ -1897,6 +1897,7 @@ function syncCallback() {
|
|||||||
function registerPersonaSlashCommands() {
|
function registerPersonaSlashCommands() {
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'persona-lock',
|
name: 'persona-lock',
|
||||||
|
aliases: ['lock', 'bind'],
|
||||||
callback: lockPersonaCallback,
|
callback: lockPersonaCallback,
|
||||||
returns: 'The current lock state for the given type',
|
returns: 'The current lock state for the given type',
|
||||||
helpString: 'Locks/unlocks a persona (name and avatar) to the current chat. Gets the current lock state for the given type if no state is provided.',
|
helpString: 'Locks/unlocks a persona (name and avatar) to the current chat. Gets the current lock state for the given type if no state is provided.',
|
||||||
@@ -1921,43 +1922,6 @@ function registerPersonaSlashCommands() {
|
|||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
}));
|
}));
|
||||||
// TODO: Legacy command. Might be removed in the future and replaced by /persona-lock with aliases.
|
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|
||||||
name: 'lock',
|
|
||||||
/** @type {(args: { type: string }, value: string) => Promise<string>} */
|
|
||||||
callback: (args, value) => {
|
|
||||||
if (!value) {
|
|
||||||
value = 'toggle';
|
|
||||||
toastr.warning(t`Using /lock without a provided state to toggle the persona is deprecated. Please use /persona-lock instead.
|
|
||||||
In the future this command with no state provided will return the current state, instead of toggling it.`, t`Deprecation Warning`);
|
|
||||||
}
|
|
||||||
return lockPersonaCallback(args, value);
|
|
||||||
},
|
|
||||||
returns: 'The current lock state for the given type',
|
|
||||||
aliases: ['bind'],
|
|
||||||
helpString: 'Locks/unlocks a persona (name and avatar) to the current chat. Gets the current lock state for the given type if no state is provided.',
|
|
||||||
namedArgumentList: [
|
|
||||||
SlashCommandNamedArgument.fromProps({
|
|
||||||
name: 'type',
|
|
||||||
description: 'The type of the lock, where it should apply to',
|
|
||||||
typeList: [ARGUMENT_TYPE.STRING],
|
|
||||||
defaultValue: 'chat',
|
|
||||||
enumList: [
|
|
||||||
new SlashCommandEnumValue('chat', 'Lock the persona to the current chat.'),
|
|
||||||
new SlashCommandEnumValue('character', 'Lock this persona to the currently selected character. If the setting is enabled, multiple personas can be locked to the same character.'),
|
|
||||||
new SlashCommandEnumValue('default', 'Lock this persona as the default persona for all new chats.'),
|
|
||||||
],
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
unnamedArgumentList: [
|
|
||||||
SlashCommandArgument.fromProps({
|
|
||||||
description: 'state',
|
|
||||||
typeList: [ARGUMENT_TYPE.STRING],
|
|
||||||
defaultValue: 'toggle',
|
|
||||||
enumProvider: commonEnumProviders.boolean('onOffToggle'),
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
}));
|
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
name: 'persona-set',
|
name: 'persona-set',
|
||||||
callback: setNameCallback,
|
callback: setNameCallback,
|
||||||
|
|||||||
@@ -2939,19 +2939,6 @@ export function initDefaultSlashCommands() {
|
|||||||
enumList: slashCommandReturnHelper.enumList({ allowPipe: false, allowObject: true, allowChat: true, allowPopup: true, allowTextVersion: false }),
|
enumList: slashCommandReturnHelper.enumList({ allowPipe: false, allowObject: true, allowChat: true, allowPopup: true, allowTextVersion: false }),
|
||||||
forceEnum: true,
|
forceEnum: true,
|
||||||
}),
|
}),
|
||||||
// TODO remove some day
|
|
||||||
SlashCommandNamedArgument.fromProps({
|
|
||||||
name: 'format',
|
|
||||||
description: t`!!! DEPRECATED - use "return" instead !!! output format`,
|
|
||||||
typeList: [ARGUMENT_TYPE.STRING],
|
|
||||||
isRequired: true,
|
|
||||||
forceEnum: true,
|
|
||||||
enumList: [
|
|
||||||
new SlashCommandEnumValue('popup', t`Show injects in a popup.`, enumTypes.enum, enumIcons.default),
|
|
||||||
new SlashCommandEnumValue('chat', t`Post a system message to the chat.`, enumTypes.enum, enumIcons.default),
|
|
||||||
new SlashCommandEnumValue('none', t`Just return the injects as a JSON object.`, enumTypes.enum, enumIcons.default),
|
|
||||||
],
|
|
||||||
}),
|
|
||||||
],
|
],
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
@@ -3810,27 +3797,6 @@ async function listInjectsCallback(args) {
|
|||||||
/** @type {import('./slash-commands/SlashCommandReturnHelper.js').SlashCommandReturnType} */
|
/** @type {import('./slash-commands/SlashCommandReturnHelper.js').SlashCommandReturnType} */
|
||||||
let returnType = args.return;
|
let returnType = args.return;
|
||||||
|
|
||||||
// Old legacy return type handling
|
|
||||||
if (args.format) {
|
|
||||||
toastr.warning(t`Legacy argument 'format' with value '${args.format}' is deprecated. Please use 'return' instead. Routing to the correct return type...`, t`Deprecation warning`);
|
|
||||||
const type = String(args?.format).toLowerCase().trim();
|
|
||||||
if (!chat_metadata.script_injects || !Object.keys(chat_metadata.script_injects).length) {
|
|
||||||
type !== 'none' && toastr.info(t`No script injections for the current chat`);
|
|
||||||
}
|
|
||||||
switch (type) {
|
|
||||||
case 'none':
|
|
||||||
returnType = 'none';
|
|
||||||
break;
|
|
||||||
case 'chat':
|
|
||||||
returnType = 'chat-html';
|
|
||||||
break;
|
|
||||||
case 'popup':
|
|
||||||
default:
|
|
||||||
returnType = 'popup-html';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now the actual new return type handling
|
// Now the actual new return type handling
|
||||||
const buildTextValue = (injects) => {
|
const buildTextValue = (injects) => {
|
||||||
const injectsStr = Object.entries(injects)
|
const injectsStr = Object.entries(injects)
|
||||||
|
|||||||
@@ -264,24 +264,6 @@ async function listVariablesCallback(args) {
|
|||||||
/** @type {import('./slash-commands/SlashCommandReturnHelper.js').SlashCommandReturnType} */
|
/** @type {import('./slash-commands/SlashCommandReturnHelper.js').SlashCommandReturnType} */
|
||||||
let returnType = args.return;
|
let returnType = args.return;
|
||||||
|
|
||||||
// Old legacy return type handling
|
|
||||||
if (args.format) {
|
|
||||||
toastr.warning(`Legacy argument 'format' with value '${args.format}' is deprecated. Please use 'return' instead. Routing to the correct return type...`, 'Deprecation warning');
|
|
||||||
const type = String(args?.format).toLowerCase().trim();
|
|
||||||
switch (type) {
|
|
||||||
case 'none':
|
|
||||||
returnType = 'none';
|
|
||||||
break;
|
|
||||||
case 'chat':
|
|
||||||
returnType = 'chat-html';
|
|
||||||
break;
|
|
||||||
case 'popup':
|
|
||||||
default:
|
|
||||||
returnType = 'popup-html';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now the actual new return type handling
|
// Now the actual new return type handling
|
||||||
const scope = String(args?.scope || '').toLowerCase().trim() || 'all';
|
const scope = String(args?.scope || '').toLowerCase().trim() || 'all';
|
||||||
if (!chat_metadata.variables) {
|
if (!chat_metadata.variables) {
|
||||||
@@ -946,19 +928,6 @@ export function registerVariableCommands() {
|
|||||||
enumList: slashCommandReturnHelper.enumList({ allowPipe: false, allowObject: true, allowChat: true, allowPopup: true, allowTextVersion: false }),
|
enumList: slashCommandReturnHelper.enumList({ allowPipe: false, allowObject: true, allowChat: true, allowPopup: true, allowTextVersion: false }),
|
||||||
forceEnum: true,
|
forceEnum: true,
|
||||||
}),
|
}),
|
||||||
// TODO remove some day
|
|
||||||
SlashCommandNamedArgument.fromProps({
|
|
||||||
name: 'format',
|
|
||||||
description: '!!! DEPRECATED - use "return" instead !!! output format',
|
|
||||||
typeList: [ARGUMENT_TYPE.STRING],
|
|
||||||
isRequired: true,
|
|
||||||
forceEnum: true,
|
|
||||||
enumList: [
|
|
||||||
new SlashCommandEnumValue('popup', 'Show variables in a popup.', enumTypes.enum, enumIcons.default),
|
|
||||||
new SlashCommandEnumValue('chat', 'Post a system message to the chat.', enumTypes.enum, enumIcons.message),
|
|
||||||
new SlashCommandEnumValue('none', 'Just return the variables as a JSON list.', enumTypes.enum, enumIcons.array),
|
|
||||||
],
|
|
||||||
}),
|
|
||||||
],
|
],
|
||||||
}));
|
}));
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
|
|||||||
Reference in New Issue
Block a user