custom flag in message.extra, also apply to chat completion

251d242a0d26a555b67eb3ba112cbbb012c58f6d

qvink <qvink@users.noreply.github.com>

2 files changed, +7 -1Showing whitespace changes
public/script.js+1 -1
@@ -5303,7 +5303,7 @@ function formatMessageHistoryItem(chatItem, isInstruct, forceOutputSequence) {
53035303
53045304 // If this flag is set, completely ignore the message.
53055305 // This can be used to hide messages without affecting the number of messages in the chat.
53065306 if (chatItem.ignore_formattingextra?.ignore) {
53075307 return '';
53085308 }
53095309
public/scripts/openai.js+6 -0
@@ -527,6 +527,12 @@ function setOpenAIMessages(chat) {
527527 let role = chat[j]['is_user'] ? 'user' : 'assistant';
528528 let content = chat[j]['mes'];
529529
530+ // If this flag is set, completely ignore the message
531+ if (chat[j].extra?.ignore) {
532+ j++;
533+ continue;
534+ }
535+
530536 // 100% legal way to send a message as system
531537 if (chat[j].extra?.type === system_message_types.NARRATOR) {
532538 role = 'system';