Add collapse argument to /reasoning-set command Allows controlling visibility of reasoning blocks through slash commands by adding a boolean 'collapse' parameter Respects default expansion settings when not explicitly provided This gives users direct control over block visibility during command execution rather than relying solely on global preferences
| @@ -832,6 +832,12 @@ function registerReasoningSlashCommands() { | ||
| 832 | 832 | typeList: ARGUMENT_TYPE.NUMBER, |
| 833 | 833 | enumProvider: commonEnumProviders.messages(), |
| 834 | 834 | }), |
| 835 | + SlashCommandNamedArgument.fromProps({ | |
| 836 | + name: 'collapse', | |
| 837 | + description: 'Whether to collapse the reasoning block. (If not provided, uses the default expand setting)', | |
| 838 | + typeList: [ARGUMENT_TYPE.BOOLEAN], | |
| 839 | + enumList: commonEnumProviders.boolean('trueFalse')(), | |
| 840 | + }), | |
| 835 | 841 | ], |
| 836 | 842 | unnamedArgumentList: [ |
| 837 | 843 | SlashCommandArgument.fromProps({ |
| @@ -856,6 +862,9 @@ function registerReasoningSlashCommands() { | ||
| 856 | 862 | |
| 857 | 863 | closeMessageEditor('reasoning'); |
| 858 | 864 | updateMessageBlock(messageId, message); |
| 865 | + | |
| 866 | + if (isTrueBoolean(String(args.collapse))) $(`#chat [mesid="${messageId}"] .mes_reasoning_details`).removeAttr('open'); | |
| 867 | + if (isFalseBoolean(String(args.collapse))) $(`#chat [mesid="${messageId}"] .mes_reasoning_details`).attr('open', ''); | |
| 859 | 868 | return message.extra.reasoning; |
| 860 | 869 | }, |
| 861 | 870 | })); |