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
This commit is contained in:
Wolfsblvt
2025-04-06 21:21:37 +02:00
parent 3d79885ddd
commit 6c8714c016

View File

@ -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;
},
}));