| 5295 | * @param {boolean} isInstruct Whether instruct mode is enabled. | 5295 | * @param {boolean} isInstruct Whether instruct mode is enabled. |
| 5296 | * @param {boolean|number} forceOutputSequence Whether to force the first/last output sequence for instruct mode. | 5296 | * @param {boolean|number} forceOutputSequence Whether to force the first/last output sequence for instruct mode. |
| 5297 | */ | 5297 | */ |
| 5298 | | | |
| 5299 | function formatMessageHistoryItem(chatItem, isInstruct, forceOutputSequence) { | 5298 | function formatMessageHistoryItem(chatItem, isInstruct, forceOutputSequence) { |
| 5300 | const isNarratorType = chatItem?.extra?.type === system_message_types.NARRATOR; | 5299 | const isNarratorType = chatItem?.extra?.type === system_message_types.NARRATOR; |
| 5301 | const characterName = chatItem?.name ? chatItem.name : name2; | 5300 | const characterName = chatItem?.name ? chatItem.name : name2; |
| 5302 | const itemName = chatItem.is_user ? chatItem['name'] : characterName; | 5301 | const itemName = chatItem.is_user ? chatItem['name'] : characterName; |
| 5303 | const shouldPrependName = !isNarratorType; | 5302 | const shouldPrependName = !isNarratorType; |
| 5304 | | 5303 | |
| 5305 | // If this flag is set, completely ignore the message. | 5304 | // If this symbol flag is set, completely ignore the message. |
| 5306 | // 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. |
| 5307 | if (chatItem.extra?.[IGNORE_SYMBOL]) { | 5306 | if (chatItem.extra?.[IGNORE_SYMBOL]) { |
| 5308 | return ''; | 5307 | return ''; |