custom flag in message.extra, also apply to chat completion
| @@ -5303,7 +5303,7 @@ function formatMessageHistoryItem(chatItem, isInstruct, forceOutputSequence) { | |||
| 5303 | 5303 | ||
| 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 | } |
| 5309 | 5309 | ||
| @@ -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']; |
| 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 | // 100% legal way to send a message as system | 536 | // 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'; |