diff --git a/public/script.js b/public/script.js index 001cc72fc..7e288ca22 100644 --- a/public/script.js +++ b/public/script.js @@ -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`;