From 711e5fefb0f7c63ca5c80018cd2796699d6f04c9 Mon Sep 17 00:00:00 2001 From: SillyLossy Date: Thu, 20 Apr 2023 13:40:43 +0300 Subject: [PATCH] Fix impersonation in empty chat --- public/script.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/script.js b/public/script.js index 42700ea8e..ee41d9b48 100644 --- a/public/script.js +++ b/public/script.js @@ -1344,7 +1344,7 @@ async function Generate(type, automatic_trigger, force_name2) { } else { //console.log('Regenerate call detected') var textareaText = ""; - if (chat[chat.length - 1]['is_user']) {//If last message from You + if (chat.length && chat[chat.length - 1]['is_user']) {//If last message from You } else if (type !== "swipe" && !isImpersonate) {