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

6c8714c016c3497c3c44da99261a2e2fceb27895

Wolfsblvt <wolfsblvt@gmail.com>

1 files changed, +9 -0Showing whitespace changes
public/scripts/reasoning.js+9 -0
@@ -832,6 +832,12 @@ function registerReasoningSlashCommands() {
832832 typeList: ARGUMENT_TYPE.NUMBER,
833833 enumProvider: commonEnumProviders.messages(),
834834 }),
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+ }),
835841 ],
836842 unnamedArgumentList: [
837843 SlashCommandArgument.fromProps({
@@ -856,6 +862,9 @@ function registerReasoningSlashCommands() {
856862
857863 closeMessageEditor('reasoning');
858864 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', '');
859868 return message.extra.reasoning;
860869 },
861870 }));