From 9d88c1578b218777dcea1d7be83606fb4eee8d4e Mon Sep 17 00:00:00 2001 From: qvink Date: Tue, 25 Mar 2025 22:31:44 -0600 Subject: [PATCH] don't format messages with undefined content --- public/script.js | 5 +++++ 1 file changed, 5 insertions(+) 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`;