don't format messages with undefined content

9d88c1578b218777dcea1d7be83606fb4eee8d4e

qvink <qvink@users.noreply.github.com>

1 files changed, +5 -0Showing whitespace changes
public/script.js+5 -0
@@ -5301,6 +5301,11 @@ function formatMessageHistoryItem(chatItem, isInstruct, forceOutputSequence) {
53015301 const itemName = chatItem.is_user ? chatItem['name'] : characterName;
53025302 const shouldPrependName = !isNarratorType;
53035303
5304+ // Don't format messages with undefined content
5305+ if (chatItem.mes === undefined) {
5306+ return ""
5307+ }
5308+
53045309 // Don't include a name if it's empty
53055310 let textResult = chatItem?.name && shouldPrependName ? `${itemName}: ${chatItem.mes}\n` : `${chatItem.mes}\n`;
53065311