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 -0Ignore whitespace
public/scripts/reasoning.js+9 -0
@@ -832,6 +832,12 @@ function registerReasoningSlashCommands() {
832 typeList: ARGUMENT_TYPE.NUMBER,832 typeList: ARGUMENT_TYPE.NUMBER,
833 enumProvider: commonEnumProviders.messages(),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 unnamedArgumentList: [842 unnamedArgumentList: [
837 SlashCommandArgument.fromProps({843 SlashCommandArgument.fromProps({
@@ -856,6 +862,9 @@ function registerReasoningSlashCommands() {
856862
857 closeMessageEditor('reasoning');863 closeMessageEditor('reasoning');
858 updateMessageBlock(messageId, message);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 return message.extra.reasoning;868 return message.extra.reasoning;
860 },869 },
861 }));870 }));