Improve type handling

12335f48609b86a8a6d28f48b146ce22dbd8784f

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +3 -1Showing whitespace changes
public/script.js+3 -1
@@ -6210,7 +6210,7 @@ export function resetChatState() {
62106210 // replaces deleted charcter name with system user since it will be displayed next.
62116211 name2 = (this_chid === undefined && neutralCharacterName) ? neutralCharacterName : systemUserName;
62126212 //unsets expected chid before reloading (related to getCharacters/printCharacters from using old arrays)
6213- this_chid = undefined;
6213+ setCharacterId(undefined);
62146214 // sets up system user to tell user about having deleted a character
62156215 chat.splice(0, chat.length, ...SAFETY_CHAT);
62166216 // resets chat metadata
@@ -6239,12 +6239,14 @@ export function setExternalAbortController(controller) {
62396239 */
62406240export function setCharacterId(value) {
62416241 switch (typeof value) {
6242+ case 'bigint':
62426243 case 'number':
62436244 this_chid = String(value);
62446245 break;
62456246 case 'string':
62466247 this_chid = !isNaN(parseInt(value)) ? value : undefined;
62476248 break;
6249+ case 'object':
62486250 case 'undefined':
62496251 this_chid = undefined;
62506252 break;