Fix reasoning-get with no argument

This commit is contained in:
Cohee 2025-02-04 23:41:16 +02:00
parent acf71fd702
commit ed46b96ba2

View File

@ -153,7 +153,7 @@ function registerReasoningSlashCommands() {
}),
],
callback: (_args, value) => {
const messageId = !isNaN(Number(value)) ? Number(value) : chat.length - 1;
const messageId = !isNaN(parseInt(value.toString())) ? parseInt(value.toString()) : chat.length - 1;
const message = chat[messageId];
const reasoning = String(message?.extra?.reasoning ?? '');
return reasoning.replace(PromptReasoning.REASONING_PLACEHOLDER_REGEX, '');