| 5301 | const itemName = chatItem.is_user ? chatItem['name'] : characterName; | 5301 | const itemName = chatItem.is_user ? chatItem['name'] : characterName; |
| 5302 | const shouldPrependName = !isNarratorType; | 5302 | const shouldPrependName = !isNarratorType; |
| 5303 | | 5303 | |
| | 5304 | // Don't format messages with undefined content |
| | 5305 | if (chatItem.mes === undefined) { |
| | 5306 | return "" |
| | 5307 | } |
| | 5308 | |
| 5304 | // Don't include a name if it's empty | 5309 | // Don't include a name if it's empty |
| 5305 | let textResult = chatItem?.name && shouldPrependName ? `${itemName}: ${chatItem.mes}\n` : `${chatItem.mes}\n`; | 5310 | let textResult = chatItem?.name && shouldPrependName ? `${itemName}: ${chatItem.mes}\n` : `${chatItem.mes}\n`; |
| 5306 | | 5311 | |