custom flag in message.extra, also apply to chat completion
| @@ -5303,7 +5303,7 @@ function formatMessageHistoryItem(chatItem, isInstruct, forceOutputSequence) { | ||
| 5303 | 5303 | |
| 5304 | 5304 | // If this flag is set, completely ignore the message. |
| 5305 | 5305 | // This can be used to hide messages without affecting the number of messages in the chat. |
| 5306 | 5306 | if (chatItem.ignore_formattingextra?.ignore) { |
| 5307 | 5307 | return ''; |
| 5308 | 5308 | } |
| 5309 | 5309 | |
| @@ -527,6 +527,12 @@ function setOpenAIMessages(chat) { | ||
| 527 | 527 | let role = chat[j]['is_user'] ? 'user' : 'assistant'; |
| 528 | 528 | let content = chat[j]['mes']; |
| 529 | 529 | |
| 530 | + // If this flag is set, completely ignore the message | |
| 531 | + if (chat[j].extra?.ignore) { | |
| 532 | + j++; | |
| 533 | + continue; | |
| 534 | + } | |
| 535 | + | |
| 530 | 536 | // 100% legal way to send a message as system |
| 531 | 537 | if (chat[j].extra?.type === system_message_types.NARRATOR) { |
| 532 | 538 | role = 'system'; |