From 9d88c1578b218777dcea1d7be83606fb4eee8d4e Mon Sep 17 00:00:00 2001 From: qvink Date: Tue, 25 Mar 2025 22:31:44 -0600 Subject: [PATCH 01/13] don't format messages with undefined content --- public/script.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/public/script.js b/public/script.js index 001cc72fc..7e288ca22 100644 --- a/public/script.js +++ b/public/script.js @@ -5301,6 +5301,11 @@ function formatMessageHistoryItem(chatItem, isInstruct, forceOutputSequence) { const itemName = chatItem.is_user ? chatItem['name'] : characterName; const shouldPrependName = !isNarratorType; + // Don't format messages with undefined content + if (chatItem.mes === undefined) { + return "" + } + // Don't include a name if it's empty let textResult = chatItem?.name && shouldPrependName ? `${itemName}: ${chatItem.mes}\n` : `${chatItem.mes}\n`; From abb908e62c690d1ad42636d0fcf5c14604d32938 Mon Sep 17 00:00:00 2001 From: qvink Date: Tue, 25 Mar 2025 22:36:05 -0600 Subject: [PATCH 02/13] semi --- public/script.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/script.js b/public/script.js index 7e288ca22..ad6d810e0 100644 --- a/public/script.js +++ b/public/script.js @@ -5303,7 +5303,7 @@ function formatMessageHistoryItem(chatItem, isInstruct, forceOutputSequence) { // Don't format messages with undefined content if (chatItem.mes === undefined) { - return "" + return ''; } // Don't include a name if it's empty From 72f91a4994dd4c50e26d98c349ece1b9b6e743f9 Mon Sep 17 00:00:00 2001 From: qvink Date: Wed, 26 Mar 2025 09:28:42 -0600 Subject: [PATCH 03/13] use custom flag instead --- public/script.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/public/script.js b/public/script.js index ad6d810e0..73aefe7fb 100644 --- a/public/script.js +++ b/public/script.js @@ -5301,8 +5301,9 @@ function formatMessageHistoryItem(chatItem, isInstruct, forceOutputSequence) { const itemName = chatItem.is_user ? chatItem['name'] : characterName; const shouldPrependName = !isNarratorType; - // Don't format messages with undefined content - if (chatItem.mes === undefined) { + // If this flag is set, completely ignore the message. + // This can be used to hide messages without affecting the number of messages in the chat. + if (chatItem.ignore_formatting) { return ''; } From 251d242a0d26a555b67eb3ba112cbbb012c58f6d Mon Sep 17 00:00:00 2001 From: qvink Date: Wed, 26 Mar 2025 13:10:50 -0600 Subject: [PATCH 04/13] custom flag in message.extra, also apply to chat completion --- public/script.js | 2 +- public/scripts/openai.js | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/public/script.js b/public/script.js index 73aefe7fb..941626660 100644 --- a/public/script.js +++ b/public/script.js @@ -5303,7 +5303,7 @@ function formatMessageHistoryItem(chatItem, isInstruct, forceOutputSequence) { // If this flag is set, completely ignore the message. // This can be used to hide messages without affecting the number of messages in the chat. - if (chatItem.ignore_formatting) { + if (chatItem.extra?.ignore) { return ''; } diff --git a/public/scripts/openai.js b/public/scripts/openai.js index 695db39a0..d2d4d978e 100644 --- a/public/scripts/openai.js +++ b/public/scripts/openai.js @@ -527,6 +527,12 @@ function setOpenAIMessages(chat) { let role = chat[j]['is_user'] ? 'user' : 'assistant'; let content = chat[j]['mes']; + // If this flag is set, completely ignore the message + if (chat[j].extra?.ignore) { + j++; + continue; + } + // 100% legal way to send a message as system if (chat[j].extra?.type === system_message_types.NARRATOR) { role = 'system'; From 8d06582b584e9ad889562f18e55686068d95ecf5 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Wed, 26 Mar 2025 21:15:41 +0200 Subject: [PATCH 05/13] Add expand editor for WI content Closes #3764 --- public/index.html | 7 +++++-- public/scripts/world-info.js | 6 +++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/public/index.html b/public/index.html index 12ae48143..4f75657bb 100644 --- a/public/index.html +++ b/public/index.html @@ -6101,8 +6101,11 @@