From 0d4e5c31e267fdc753e1fe3206bf181a3ec52bdb Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Sun, 12 Nov 2023 22:35:17 +0200 Subject: [PATCH] Code clean-up --- public/index.html | 3 --- public/script.js | 26 +++---------------- .../scripts/extensions/quick-reply/index.js | 2 +- public/scripts/world-info.js | 2 +- public/style.css | 8 ------ 5 files changed, 6 insertions(+), 35 deletions(-) diff --git a/public/index.html b/public/index.html index c2755cecb..678339613 100644 --- a/public/index.html +++ b/public/index.html @@ -2125,9 +2125,6 @@ -
- Overridden by the Character Definitions. -
diff --git a/public/script.js b/public/script.js index 84629df84..72c64e780 100644 --- a/public/script.js +++ b/public/script.js @@ -314,11 +314,6 @@ export const event_types = { export const eventSource = new EventEmitter(); -// Check for override warnings every 5 seconds... -setInterval(displayOverrideWarnings, 5000); -// ...or when the chat changes -eventSource.on(event_types.SETTINGS_LOADED, () => { settingsReady = true; }); -eventSource.on(event_types.CHAT_CHANGED, displayOverrideWarnings); eventSource.on(event_types.MESSAGE_RECEIVED, processExtensionHelpers); eventSource.on(event_types.MESSAGE_SENT, processExtensionHelpers); @@ -730,7 +725,7 @@ async function firstLoadInit() { sendSystemMessage(system_message_types.WELCOME); await readSecretState(); await getClientVersion(); - await getSettings("def"); + await getSettings(); await getUserAvatars(); await getCharacters(); await getBackgrounds(); @@ -1081,7 +1076,6 @@ async function printCharacters(fullRefresh = false) { } await delay(1); - displayOverrideWarnings(); } const storageKey = 'Characters_PerPage'; @@ -5236,7 +5230,7 @@ async function doOnboarding(avatarId) { //***************SETTINGS****************// /////////////////////////////////////////// -async function getSettings(type) { +async function getSettings() { const response = await fetch("/getsettings", { method: "POST", headers: getRequestHeaders(), @@ -5409,6 +5403,7 @@ async function getSettings(type) { } } + settingsReady = true; eventSource.emit(event_types.SETTINGS_LOADED); } @@ -7133,19 +7128,6 @@ const swipe_right = () => { } } - - -function displayOverrideWarnings() { - if (!this_chid || !selected_group) { - $('.prompt_overridden').hide(); - $('.jailbreak_overridden').hide(); - return; - } - - $('.prompt_overridden').toggle(!!(characters[this_chid]?.data?.system_prompt)); - $('.jailbreak_overridden').toggle(!!(characters[this_chid]?.data?.post_history_instructions)); -} - function connectAPISlash(_, text) { if (!text) return; @@ -8696,7 +8678,7 @@ jQuery(async function () { startStatusLoading(); // Check near immediately rather than waiting for up to 90s - setTimeout(getStatusNovel, 10); + await getStatusNovel(); }); //**************************CHARACTER IMPORT EXPORT*************************// diff --git a/public/scripts/extensions/quick-reply/index.js b/public/scripts/extensions/quick-reply/index.js index ff7264071..83c8086cd 100644 --- a/public/scripts/extensions/quick-reply/index.js +++ b/public/scripts/extensions/quick-reply/index.js @@ -21,7 +21,7 @@ const defaultSettings = { //method from worldinfo async function updateQuickReplyPresetList() { - var result = await fetch("/getsettings", { + const result = await fetch("/getsettings", { method: "POST", headers: getRequestHeaders(), body: JSON.stringify({}), diff --git a/public/scripts/world-info.js b/public/scripts/world-info.js index f5f3c60f5..7909e542c 100644 --- a/public/scripts/world-info.js +++ b/public/scripts/world-info.js @@ -227,7 +227,7 @@ async function loadWorldInfoData(name) { } async function updateWorldInfoList() { - var result = await fetch("/getsettings", { + const result = await fetch("/getsettings", { method: "POST", headers: getRequestHeaders(), body: JSON.stringify({}), diff --git a/public/style.css b/public/style.css index 1dc1888b4..3a8b1bcef 100644 --- a/public/style.css +++ b/public/style.css @@ -3492,14 +3492,6 @@ a { align-items: center; } -.prompt_overridden, -.jailbreak_overridden { - color: var(--SmartThemeQuoteColor); - font-weight: bold; - font-style: italic; - font-size: 0.8em; -} - .openai_restorable .right_menu_button img { height: 20px; }