Alias /note-pos command to match /inject
| @@ -76,15 +76,17 @@ function setNoteIntervalCommand(_, text) { | ||
| 76 | 76 | |
| 77 | 77 | function setNotePositionCommand(_, text) { |
| 78 | 78 | const validPositions = { |
| 79 | + 'after': 0, | |
| 79 | 80 | 'scenario': 0, |
| 80 | 81 | 'chat': 1, |
| 81 | 82 | 'before_scenario': 2, |
| 83 | + 'before': 2, | |
| 82 | 84 | }; |
| 83 | 85 | |
| 84 | 86 | if (text) { |
| 85 | 87 | const position = validPositions[text?.trim()?.toLowerCase()]; |
| 86 | 88 | |
| 87 | 89 | if (typeof position === 'undefined') { |
| 88 | 90 | toastr.error(t`Not a valid position`); |
| 89 | 91 | return; |
| 90 | 92 | } |
| @@ -94,22 +96,23 @@ function setNotePositionCommand(_, text) { | ||
| 94 | 96 | } |
| 95 | 97 | return Object.keys(validPositions).find(key => validPositions[key] == chat_metadata[metadata_keys.position]); |
| 96 | 98 | } |
| 99 | + | |
| 97 | 100 | function setNoteRoleCommand(_, text) { |
| 98 | 101 | const validRoles = { |
| 99 | 102 | 'system': 0, |
| 100 | 103 | 'user': 1, |
| 101 | 104 | 'assistant': 2, |
| 102 | 105 | }; |
| 103 | 106 | |
| 104 | 107 | if (text) { |
| 105 | 108 | const role = validRoles[text?.trim()?.toLowerCase()]; |
| 106 | 109 | |
| 107 | 110 | if (typeof role === 'undefined') { |
| 108 | 111 | toastr.error(t`Not a valid role`); |
| 109 | 112 | return; |
| 110 | 113 | } |
| 111 | 114 | |
| 112 | 115 | $(`'#extension_floating_role`').val(Math.abs(role)).trigger('input'); |
| 113 | 116 | toastr.info(t`Author's Note role updated`); |
| 114 | 117 | } |
| 115 | 118 | return Object.keys(validRoles).find(key => validRoles[key] == chat_metadata[metadata_keys.role]); |
| @@ -491,7 +494,8 @@ export function initAuthorsNote() { | ||
| 491 | 494 | }); |
| 492 | 495 | $('#option_toggle_AN').on('click', onANMenuItemClick); |
| 493 | 496 | |
| 494 | 497 | SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'note', |
| 498 | + name: 'note', | |
| 495 | 499 | callback: setNoteTextCommand, |
| 496 | 500 | returns: 'current author\'s note', |
| 497 | 501 | unnamedArgumentList: [ |
| @@ -505,8 +509,9 @@ export function initAuthorsNote() { | ||
| 505 | 509 | </div> |
| 506 | 510 | `, |
| 507 | 511 | })); |
| 508 | 512 | SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'depth', |
| 509 | 513 | aliasesname: ['note-depth'], |
| 514 | + aliases: ['depth'], | |
| 510 | 515 | callback: setNoteDepthCommand, |
| 511 | 516 | returns: 'current author\'s note depth', |
| 512 | 517 | unnamedArgumentList: [ |
| @@ -520,8 +525,9 @@ export function initAuthorsNote() { | ||
| 520 | 525 | </div> |
| 521 | 526 | `, |
| 522 | 527 | })); |
| 523 | 528 | SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'freq', |
| 524 | 529 | aliasesname: ['note-freqfrequency'], |
| 530 | + aliases: ['freq', 'note-freq'], | |
| 525 | 531 | callback: setNoteIntervalCommand, |
| 526 | 532 | returns: 'current author\'s note insertion frequency', |
| 527 | 533 | namedArgumentList: [], |
| @@ -536,14 +542,15 @@ export function initAuthorsNote() { | ||
| 536 | 542 | </div> |
| 537 | 543 | `, |
| 538 | 544 | })); |
| 539 | 545 | SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'pos', |
| 546 | + name: 'note-position', | |
| 540 | 547 | callback: setNotePositionCommand, |
| 541 | 548 | aliases: ['pos', 'note-pos'], |
| 542 | 549 | returns: 'current author\'s note insertion position', |
| 543 | 550 | namedArgumentList: [], |
| 544 | 551 | unnamedArgumentList: [ |
| 545 | 552 | new SlashCommandArgument( |
| 546 | 553 | 'position', [ARGUMENT_TYPE.STRING], false, false, null, ['chatbefore', 'scenarioafter', 'before_scenariochat'], |
| 547 | 554 | ), |
| 548 | 555 | ], |
| 549 | 556 | helpString: ` |
| @@ -552,7 +559,8 @@ export function initAuthorsNote() { | ||
| 552 | 559 | </div> |
| 553 | 560 | `, |
| 554 | 561 | })); |
| 555 | 562 | SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'note-role', |
| 563 | + name: 'note-role', | |
| 556 | 564 | callback: setNoteRoleCommand, |
| 557 | 565 | returns: 'current author\'s note chat insertion role', |
| 558 | 566 | namedArgumentList: [], |