From 12335f48609b86a8a6d28f48b146ce22dbd8784f Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Fri, 28 Feb 2025 13:46:16 +0000 Subject: [PATCH] Improve type handling --- public/script.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/script.js b/public/script.js index d45f7940e..1aea41fc4 100644 --- a/public/script.js +++ b/public/script.js @@ -6210,7 +6210,7 @@ export function resetChatState() { // replaces deleted charcter name with system user since it will be displayed next. name2 = (this_chid === undefined && neutralCharacterName) ? neutralCharacterName : systemUserName; //unsets expected chid before reloading (related to getCharacters/printCharacters from using old arrays) - this_chid = undefined; + setCharacterId(undefined); // sets up system user to tell user about having deleted a character chat.splice(0, chat.length, ...SAFETY_CHAT); // resets chat metadata @@ -6239,12 +6239,14 @@ export function setExternalAbortController(controller) { */ export function setCharacterId(value) { switch (typeof value) { + case 'bigint': case 'number': this_chid = String(value); break; case 'string': this_chid = !isNaN(parseInt(value)) ? value : undefined; break; + case 'object': case 'undefined': this_chid = undefined; break;