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

251d242a0d26a555b67eb3ba112cbbb012c58f6d

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

2 files changed, +7 -1Ignore whitespace
public/script.js+1 -1
@@ -5303,7 +5303,7 @@ function formatMessageHistoryItem(chatItem, isInstruct, forceOutputSequence) {
53035303
5304 // If this flag is set, completely ignore the message.5304 // If this flag is set, completely ignore the message.
5305 // This can be used to hide messages without affecting the number of messages in the chat.5305 // This can be used to hide messages without affecting the number of messages in the chat.
5306 if (chatItem.ignore_formatting) {5306 if (chatItem.extra?.ignore) {
5307 return '';5307 return '';
5308 }5308 }
53095309
public/scripts/openai.js+6 -0
@@ -527,6 +527,12 @@ function setOpenAIMessages(chat) {
527 let role = chat[j]['is_user'] ? 'user' : 'assistant';527 let role = chat[j]['is_user'] ? 'user' : 'assistant';
528 let content = chat[j]['mes'];528 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
530 // 100% legal way to send a message as system536 // 100% legal way to send a message as system
531 if (chat[j].extra?.type === system_message_types.NARRATOR) {537 if (chat[j].extra?.type === system_message_types.NARRATOR) {
532 role = 'system';538 role = 'system';