Merge branch 'staging' into reasoning-continue

This commit is contained in:
Cohee
2025-01-31 13:51:09 +00:00
4 changed files with 26 additions and 7 deletions

View File

@ -2003,7 +2003,7 @@ export function messageFormatting(mes, ch_name, isSystem, isUser, messageId, san
return ''; return '';
} }
if (Number(messageId) === 0 && !isSystem && !isUser) { if (Number(messageId) === 0 && !isSystem && !isUser && !isReasoning) {
const mesBeforeReplace = mes; const mesBeforeReplace = mes;
const chatMessage = chat[messageId]; const chatMessage = chat[messageId];
mes = substituteParams(mes, undefined, ch_name); mes = substituteParams(mes, undefined, ch_name);
@ -3171,7 +3171,7 @@ class StreamingProcessor {
this.sendTextarea.dispatchEvent(new Event('input', { bubbles: true })); this.sendTextarea.dispatchEvent(new Event('input', { bubbles: true }));
} }
else { else {
await saveReply(this.type, text, true); await saveReply(this.type, text, true, '', [], '');
messageId = chat.length - 1; messageId = chat.length - 1;
this.#checkDomElements(messageId); this.#checkDomElements(messageId);
this.showMessageButtons(messageId); this.showMessageButtons(messageId);
@ -3365,7 +3365,7 @@ class StreamingProcessor {
const timestamps = []; const timestamps = [];
for await (const { text, swipes, logprobs, toolCalls, state } of this.generator()) { for await (const { text, swipes, logprobs, toolCalls, state } of this.generator()) {
timestamps.push(Date.now()); timestamps.push(Date.now());
if (this.isStopped) { if (this.isStopped || this.abortController.signal.aborted) {
return; return;
} }

View File

@ -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) { function onLockBackgroundClick(e) {
e.stopPropagation(); e?.stopPropagation();
const chatName = getCurrentChatId(); const chatName = getCurrentChatId();
@ -114,8 +119,13 @@ function onLockBackgroundClick(e) {
return ''; return '';
} }
/**
* Locks the background for the current chat
* @param {Event} e Click event
* @returns {string} Empty string
*/
function onUnlockBackgroundClick(e) { function onUnlockBackgroundClick(e) {
e.stopPropagation(); e?.stopPropagation();
removeBackgroundMetadata(); removeBackgroundMetadata();
unsetCustomBackground(); unsetCustomBackground();
highlightLockedBackground(); highlightLockedBackground();
@ -513,12 +523,12 @@ export function initBackgrounds() {
$('#add_bg_button').on('change', onBackgroundUploadSelected); $('#add_bg_button').on('change', onBackgroundUploadSelected);
$('#bg-filter').on('input', onBackgroundFilterInput); $('#bg-filter').on('input', onBackgroundFilterInput);
SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'lockbg', SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'lockbg',
callback: onLockBackgroundClick, callback: () => onLockBackgroundClick(new CustomEvent('click')),
aliases: ['bglock'], aliases: ['bglock'],
helpString: 'Locks a background for the currently selected chat', helpString: 'Locks a background for the currently selected chat',
})); }));
SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'unlockbg', SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'unlockbg',
callback: onUnlockBackgroundClick, callback: () => onUnlockBackgroundClick(new CustomEvent('click')),
aliases: ['bgunlock'], aliases: ['bgunlock'],
helpString: 'Unlocks a background for the currently selected chat', helpString: 'Unlocks a background for the currently selected chat',
})); }));

View File

@ -123,6 +123,7 @@ function loadReasoningSettings() {
function registerReasoningSlashCommands() { function registerReasoningSlashCommands() {
SlashCommandParser.addCommandObject(SlashCommand.fromProps({ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
name: 'reasoning-get', name: 'reasoning-get',
aliases: ['get-reasoning'],
returns: ARGUMENT_TYPE.STRING, 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.`, 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: [ unnamedArgumentList: [
@ -142,6 +143,7 @@ function registerReasoningSlashCommands() {
SlashCommandParser.addCommandObject(SlashCommand.fromProps({ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
name: 'reasoning-set', name: 'reasoning-set',
aliases: ['set-reasoning'],
returns: ARGUMENT_TYPE.STRING, returns: ARGUMENT_TYPE.STRING,
helpString: t`Set the reasoning block of a message. Returns the reasoning block content.`, helpString: t`Set the reasoning block of a message. Returns the reasoning block content.`,
namedArgumentList: [ namedArgumentList: [
@ -176,6 +178,7 @@ function registerReasoningSlashCommands() {
SlashCommandParser.addCommandObject(SlashCommand.fromProps({ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
name: 'reasoning-parse', name: 'reasoning-parse',
aliases: ['parse-reasoning'],
returns: 'reasoning string', returns: 'reasoning string',
helpString: t`Extracts the reasoning block from a string using the Reasoning Formatting settings.`, helpString: t`Extracts the reasoning block from a string using the Reasoning Formatting settings.`,
namedArgumentList: [ namedArgumentList: [

View File

@ -54,6 +54,12 @@ const OPENROUTER_PROVIDERS = [
'xAI', 'xAI',
'Cloudflare', 'Cloudflare',
'SF Compute', 'SF Compute',
'Minimax',
'Nineteen',
'Liquid',
'Nebius',
'Chutes',
'Kluster',
'01.AI', '01.AI',
'HuggingFace', 'HuggingFace',
'Mancer', 'Mancer',