mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
don't format messages with undefined content
This commit is contained in:
@ -5301,6 +5301,11 @@ function formatMessageHistoryItem(chatItem, isInstruct, forceOutputSequence) {
|
||||
const itemName = chatItem.is_user ? chatItem['name'] : characterName;
|
||||
const shouldPrependName = !isNarratorType;
|
||||
|
||||
// Don't format messages with undefined content
|
||||
if (chatItem.mes === undefined) {
|
||||
return ""
|
||||
}
|
||||
|
||||
// Don't include a name if it's empty
|
||||
let textResult = chatItem?.name && shouldPrependName ? `${itemName}: ${chatItem.mes}\n` : `${chatItem.mes}\n`;
|
||||
|
||||
|
Reference in New Issue
Block a user