From 4bf3bd8343ca186a6470e2bd70b87be165161ef6 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Fri, 31 Jan 2025 12:45:08 +0000 Subject: [PATCH 1/6] Fix /lockbg and /unlockbg commands --- public/scripts/backgrounds.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/public/scripts/backgrounds.js b/public/scripts/backgrounds.js index 683e9c4ee..4ec8bf1f6 100644 --- a/public/scripts/backgrounds.js +++ b/public/scripts/backgrounds.js @@ -96,8 +96,13 @@ function highlightLockedBackground() { }); } +/** + * Locks the background for the current chat + * @param {Event} e Click event + * @returns {string} Empty string + */ function onLockBackgroundClick(e) { - e.stopPropagation(); + e?.stopPropagation(); const chatName = getCurrentChatId(); @@ -114,8 +119,13 @@ function onLockBackgroundClick(e) { return ''; } +/** + * Locks the background for the current chat + * @param {Event} e Click event + * @returns {string} Empty string + */ function onUnlockBackgroundClick(e) { - e.stopPropagation(); + e?.stopPropagation(); removeBackgroundMetadata(); unsetCustomBackground(); highlightLockedBackground(); @@ -513,12 +523,12 @@ export function initBackgrounds() { $('#add_bg_button').on('change', onBackgroundUploadSelected); $('#bg-filter').on('input', onBackgroundFilterInput); SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'lockbg', - callback: onLockBackgroundClick, + callback: () => onLockBackgroundClick(new CustomEvent('click')), aliases: ['bglock'], helpString: 'Locks a background for the currently selected chat', })); SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'unlockbg', - callback: onUnlockBackgroundClick, + callback: () => onUnlockBackgroundClick(new CustomEvent('click')), aliases: ['bgunlock'], helpString: 'Unlocks a background for the currently selected chat', })); From 94af9fc1a3ed9ce6555e1065c59f5e16571200bf Mon Sep 17 00:00:00 2001 From: pcpthm Date: Fri, 31 Jan 2025 21:49:49 +0900 Subject: [PATCH 2/6] Add new OpenRouter providers --- public/scripts/textgen-models.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/public/scripts/textgen-models.js b/public/scripts/textgen-models.js index 824d5eec4..9523cfba5 100644 --- a/public/scripts/textgen-models.js +++ b/public/scripts/textgen-models.js @@ -54,6 +54,12 @@ const OPENROUTER_PROVIDERS = [ 'xAI', 'Cloudflare', 'SF Compute', + 'Minimax', + 'Nineteen', + 'Liquid', + 'Nebius', + 'Chutes', + 'Kluster', '01.AI', 'HuggingFace', 'Mancer', From 67a4d10b75e58922b519192d64b5a8fdd3dda430 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Fri, 31 Jan 2025 13:23:22 +0000 Subject: [PATCH 3/6] Fix substituting macros in reasoning of a first message --- public/script.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/script.js b/public/script.js index 9c9f8fc3a..b06003f8b 100644 --- a/public/script.js +++ b/public/script.js @@ -2003,7 +2003,7 @@ export function messageFormatting(mes, ch_name, isSystem, isUser, messageId, san return ''; } - if (Number(messageId) === 0 && !isSystem && !isUser) { + if (Number(messageId) === 0 && !isSystem && !isUser && !isReasoning) { const mesBeforeReplace = mes; const chatMessage = chat[messageId]; mes = substituteParams(mes, undefined, ch_name); From f7eab6602608fc39db6764c2be3dd4c8d4bb1c4b Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Fri, 31 Jan 2025 13:30:10 +0000 Subject: [PATCH 4/6] Fix streaming start appending undefined to reasoning block --- public/script.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/script.js b/public/script.js index b06003f8b..c4416f117 100644 --- a/public/script.js +++ b/public/script.js @@ -3171,7 +3171,7 @@ class StreamingProcessor { this.sendTextarea.dispatchEvent(new Event('input', { bubbles: true })); } else { - await saveReply(this.type, text, true); + await saveReply(this.type, text, true, '', [], ''); messageId = chat.length - 1; this.#checkDomElements(messageId); this.showMessageButtons(messageId); From ae376b4195eee98be1d9cf654b7a1b95afc833e8 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Fri, 31 Jan 2025 13:30:57 +0000 Subject: [PATCH 5/6] Add aliases for reasoning commands --- public/scripts/reasoning.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/public/scripts/reasoning.js b/public/scripts/reasoning.js index 26f276600..a97deda73 100644 --- a/public/scripts/reasoning.js +++ b/public/scripts/reasoning.js @@ -117,6 +117,7 @@ function loadReasoningSettings() { function registerReasoningSlashCommands() { SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'reasoning-get', + aliases: ['get-reasoning'], returns: ARGUMENT_TYPE.STRING, helpString: t`Get the contents of a reasoning block of a message. Returns an empty string if the message does not have a reasoning block.`, unnamedArgumentList: [ @@ -136,6 +137,7 @@ function registerReasoningSlashCommands() { SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'reasoning-set', + aliases: ['set-reasoning'], returns: ARGUMENT_TYPE.STRING, helpString: t`Set the reasoning block of a message. Returns the reasoning block content.`, namedArgumentList: [ @@ -170,6 +172,7 @@ function registerReasoningSlashCommands() { SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'reasoning-parse', + aliases: ['parse-reasoning'], returns: 'reasoning string', helpString: t`Extracts the reasoning block from a string using the Reasoning Formatting settings.`, namedArgumentList: [ From 9710d88a88a7cd02ad68cdcdc1cc857d2db154f0 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Fri, 31 Jan 2025 13:38:23 +0000 Subject: [PATCH 6/6] Stop smooth streaming immediately on abort --- public/script.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/script.js b/public/script.js index c4416f117..e25b9e4ef 100644 --- a/public/script.js +++ b/public/script.js @@ -3365,7 +3365,7 @@ class StreamingProcessor { const timestamps = []; for await (const { text, swipes, logprobs, toolCalls, state } of this.generator()) { timestamps.push(Date.now()); - if (this.isStopped) { + if (this.isStopped || this.abortController.signal.aborted) { return; }