From 6c8714c016c3497c3c44da99261a2e2fceb27895 Mon Sep 17 00:00:00 2001 From: Wolfsblvt Date: Sun, 6 Apr 2025 21:21:37 +0200 Subject: [PATCH] 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 --- public/scripts/reasoning.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/public/scripts/reasoning.js b/public/scripts/reasoning.js index b63b26f63..10793c915 100644 --- a/public/scripts/reasoning.js +++ b/public/scripts/reasoning.js @@ -832,6 +832,12 @@ function registerReasoningSlashCommands() { typeList: ARGUMENT_TYPE.NUMBER, enumProvider: commonEnumProviders.messages(), }), + SlashCommandNamedArgument.fromProps({ + name: 'collapse', + description: 'Whether to collapse the reasoning block. (If not provided, uses the default expand setting)', + typeList: [ARGUMENT_TYPE.BOOLEAN], + enumList: commonEnumProviders.boolean('trueFalse')(), + }), ], unnamedArgumentList: [ SlashCommandArgument.fromProps({ @@ -856,6 +862,9 @@ function registerReasoningSlashCommands() { closeMessageEditor('reasoning'); updateMessageBlock(messageId, message); + + if (isTrueBoolean(String(args.collapse))) $(`#chat [mesid="${messageId}"] .mes_reasoning_details`).removeAttr('open'); + if (isFalseBoolean(String(args.collapse))) $(`#chat [mesid="${messageId}"] .mes_reasoning_details`).attr('open', ''); return message.extra.reasoning; }, }));