From b6facd3afa63b7f76c885eec5f7c552643bac230 Mon Sep 17 00:00:00 2001 From: somebody Date: Sat, 22 Oct 2022 17:57:36 -0500 Subject: [PATCH 01/10] Fix logo dragging --- koboldai_settings.py | 2 +- static/koboldai.css | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/koboldai_settings.py b/koboldai_settings.py index baf1ae80..2a6d4d51 100644 --- a/koboldai_settings.py +++ b/koboldai_settings.py @@ -593,7 +593,7 @@ class model_settings(settings): self.oaiapikey = "" # API key to use for OpenAI API calls self.configname = None self.online_model = '' - self.welcome_default = "
Please load a model from the left." # Custom Welcome Text + self.welcome_default = "
Please load a model from the left." # Custom Welcome Text self.welcome = self.welcome_default self.koboldai_vars = koboldai_vars diff --git a/static/koboldai.css b/static/koboldai.css index 44ffeedc..2385273b 100644 --- a/static/koboldai.css +++ b/static/koboldai.css @@ -2400,7 +2400,11 @@ body { color: white } - +#welcome-logo { + pointer-events: none; + max-width: 720px; + width: 100%; +} /*---------------------------------- Global ------------------------------------------------*/ .hidden { display: none; From 0a17b5dddbad68a140cd1cc9d2c49da7400823ad Mon Sep 17 00:00:00 2001 From: ebolam Date: Sat, 22 Oct 2022 20:00:49 -0400 Subject: [PATCH 02/10] Potential fix for game screen size issue --- static/koboldai.css | 16 +++++++--------- static/koboldai.js | 23 ++++++++++++----------- templates/index_new.html | 2 +- 3 files changed, 20 insertions(+), 21 deletions(-) diff --git a/static/koboldai.css b/static/koboldai.css index 44ffeedc..6b6fa3ea 100644 --- a/static/koboldai.css +++ b/static/koboldai.css @@ -1141,28 +1141,26 @@ body { grid-template-areas: "menuicon gamescreen options lefticon" "menuicon theme theme lefticon" "menuicon inputrow inputrow lefticon"; - grid-template-columns: 30px auto var(--story_options_size) 30px; + grid-template-columns: 30px auto fit-content(30%) 30px; grid-template-rows: auto min-content 100px; } +.main-grid[option_length="0"][model_numseqs="1"] { + grid-template-columns: 30px auto 0px 30px; +} .main-grid.settings_pinned { margin-left: var(--flyout_menu_width); - *grid-template-columns: 30px auto var(--story_options_size) 30px; } + .main-grid.story_pinned { margin-right: var(--flyout_menu_width); - /*margin-left: var(--setting_menu_closed_width_no_pins_width); - grid-template-areas: var(--story_pinned_areas); - grid-template-columns: var(--story_pinned_area_widths);*/ } .main-grid.settings_pinned.story_pinned { margin-left: var(--flyout_menu_width); margin-right: var(--flyout_menu_width); - grid-template-areas: "menuicon gamescreen options lefticon" - "menuicon theme theme lefticon" - "menuicon inputrow inputrow lefticon"; - grid-template-columns: 30px auto var(--story_options_size) 30px; } + + } @media only screen and (max-aspect-ratio: 7/5) { diff --git a/static/koboldai.js b/static/koboldai.js index a531eff6..03a74888 100644 --- a/static/koboldai.js +++ b/static/koboldai.js @@ -211,6 +211,7 @@ function fix_text(val) { function create_options(action) { //Set all options before the next chunk to hidden + document.getElementById('main-grid').setAttribute('option_length', action.action.Options.length); var option_container = document.getElementById("Select Options"); var current_chunk = parseInt(document.getElementById("action_count").textContent)+1; if (current_chunk != action.id.toString()) { @@ -757,17 +758,17 @@ function var_changed(data) { } //if we changed the gen amount, make sure our option area is set/not set - if ((data.classname == 'model') && (data.name == 'numseqs')) { - if (data.value == 1) { - //allow our options to collapse to 0%, but no more than 30% (in case there is a redo or the like) - var r = document.querySelector(':root'); - r.style.setProperty('--story_options_size', 'fit-content(30%)'); - } else { - //static 30% - var r = document.querySelector(':root'); - r.style.setProperty('--story_options_size', '30%'); - } - } + //if ((data.classname == 'model') && (data.name == 'numseqs')) { + // if (data.value == 1) { + // //allow our options to collapse to 0%, but no more than 30% (in case there is a redo or the like) + // var r = document.querySelector(':root'); + // r.style.setProperty('--story_options_size', 'fit-content(30%)'); + // } else { + // //static 30% + // var r = document.querySelector(':root'); + // r.style.setProperty('--story_options_size', 'fit-content(30%)'); + // } + //} //if we're updating generated tokens, let's show that in our status bar if ((data.classname == 'model') && (data.name == 'tqdm_progress')) { diff --git a/templates/index_new.html b/templates/index_new.html index 8e3bdace..599a7444 100644 --- a/templates/index_new.html +++ b/templates/index_new.html @@ -41,7 +41,7 @@ -
+

Disconnected

From adf2b481c3b66fc1b21b24b92b73a82ae998463d Mon Sep 17 00:00:00 2001 From: ebolam Date: Sat, 22 Oct 2022 20:20:26 -0400 Subject: [PATCH 03/10] Welcome Text Fix --- aiserver.py | 2 +- koboldai_settings.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/aiserver.py b/aiserver.py index ca200088..a4cce9c9 100644 --- a/aiserver.py +++ b/aiserver.py @@ -277,7 +277,7 @@ model_menu = { class Send_to_socketio(object): def write(self, bar): - bar = bar.replace("\r", "").replace("\n", "") + bar = bar.replace("\r", "").replace("\n", "").replace(chr(0), "") if bar != "": logger.info(bar) #print('\r' + bar, end='') diff --git a/koboldai_settings.py b/koboldai_settings.py index baf1ae80..86ad3145 100644 --- a/koboldai_settings.py +++ b/koboldai_settings.py @@ -568,7 +568,8 @@ class settings(object): class model_settings(settings): local_only_variables = ['badwordsids', 'apikey', 'tqdm', 'socketio', 'default_preset', 'koboldai_vars'] no_save_variables = ['tqdm', 'tqdm_progress', 'tqdm_rem_time', 'socketio', 'modelconfig', 'custmodpth', 'generated_tkns', - 'loaded_layers', 'total_layers', 'total_download_chunks', 'downloaded_chunks', 'presets', 'default_preset', 'koboldai_vars'] + 'loaded_layers', 'total_layers', 'total_download_chunks', 'downloaded_chunks', 'presets', 'default_preset', + 'koboldai_vars', 'welcome'] settings_name = "model" def __init__(self, socketio, koboldai_vars): self.socketio = socketio From 7571928830d026b9312d154ebf731cb0173762f0 Mon Sep 17 00:00:00 2001 From: ebolam Date: Sat, 22 Oct 2022 20:24:52 -0400 Subject: [PATCH 04/10] Welcome Text Tweak Update --- themes/tweaks/hide-welcome-logo.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/tweaks/hide-welcome-logo.css b/themes/tweaks/hide-welcome-logo.css index da273bfa..5e35d101 100644 --- a/themes/tweaks/hide-welcome-logo.css +++ b/themes/tweaks/hide-welcome-logo.css @@ -1 +1 @@ -div#welcome_text.var_sync_model_welcome { opacity: 0; pointer-events: none } +#welcome_text { display:none; pointer-events: none } From 4cc26a7f4b1913f12c9eb69711f3c36d97c01f9f Mon Sep 17 00:00:00 2001 From: ebolam Date: Sat, 22 Oct 2022 20:28:00 -0400 Subject: [PATCH 05/10] Welcome Drag Fix --- koboldai_settings.py | 2 +- templates/index_new.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/koboldai_settings.py b/koboldai_settings.py index a746d234..891fd2f6 100644 --- a/koboldai_settings.py +++ b/koboldai_settings.py @@ -594,7 +594,7 @@ class model_settings(settings): self.oaiapikey = "" # API key to use for OpenAI API calls self.configname = None self.online_model = '' - self.welcome_default = "
Please load a model from the left." # Custom Welcome Text + self.welcome_default = "
Please load a model from the left." # Custom Welcome Text self.welcome = self.welcome_default self.koboldai_vars = koboldai_vars diff --git a/templates/index_new.html b/templates/index_new.html index 599a7444..62de267b 100644 --- a/templates/index_new.html +++ b/templates/index_new.html @@ -45,7 +45,7 @@

Disconnected

-
+
From e6903b4b660bcf5126e01dc81544a8186879685d Mon Sep 17 00:00:00 2001 From: ebolam Date: Sat, 22 Oct 2022 20:40:56 -0400 Subject: [PATCH 06/10] Welcome Text Fix --- koboldai_settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koboldai_settings.py b/koboldai_settings.py index 891fd2f6..3a60a467 100644 --- a/koboldai_settings.py +++ b/koboldai_settings.py @@ -569,7 +569,7 @@ class model_settings(settings): local_only_variables = ['badwordsids', 'apikey', 'tqdm', 'socketio', 'default_preset', 'koboldai_vars'] no_save_variables = ['tqdm', 'tqdm_progress', 'tqdm_rem_time', 'socketio', 'modelconfig', 'custmodpth', 'generated_tkns', 'loaded_layers', 'total_layers', 'total_download_chunks', 'downloaded_chunks', 'presets', 'default_preset', - 'koboldai_vars', 'welcome'] + 'koboldai_vars', 'welcome', 'welcome_default'] settings_name = "model" def __init__(self, socketio, koboldai_vars): self.socketio = socketio From 06ee1426a1b80532186292a2c9f74b7f0b322595 Mon Sep 17 00:00:00 2001 From: ebolam Date: Sat, 22 Oct 2022 21:05:07 -0400 Subject: [PATCH 07/10] Progress Bar for UI1 fixed Console print for model loading fixed --- aiserver.py | 9 ++++----- utils.py | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/aiserver.py b/aiserver.py index a4cce9c9..572a0502 100644 --- a/aiserver.py +++ b/aiserver.py @@ -278,9 +278,9 @@ model_menu = { class Send_to_socketio(object): def write(self, bar): bar = bar.replace("\r", "").replace("\n", "").replace(chr(0), "") - if bar != "": - logger.info(bar) - #print('\r' + bar, end='') + if bar != "" and [ord(num) for num in bar] != [27, 91, 65]: #No idea why we're getting the 27, 1, 65 character set, just killing to so we can move on + #logger.info(bar) + print('\r' + bar, end='') time.sleep(0.01) try: emit('from_server', {'cmd': 'model_load_status', 'data': bar.replace(" ", " ")}, broadcast=True, room="UI_1") @@ -1788,9 +1788,8 @@ def patch_transformers_download(): class Send_to_socketio(object): def write(self, bar): bar = bar.replace("\r", "").replace("\n", "") - logger.debug(bar) - if bar != "": + if bar != "" and [ord(num) for num in bar] != [27, 91, 65]: #No idea why we're getting the 27, 1, 65 character set, just killing to so we can move on try: print('\r' + bar, end='') emit('from_server', {'cmd': 'model_load_status', 'data': bar.replace(" ", " ")}, broadcast=True, room="UI_1") diff --git a/utils.py b/utils.py index dc738e89..ac16d99b 100644 --- a/utils.py +++ b/utils.py @@ -183,7 +183,7 @@ def _download_with_aria2(aria2_config: str, total_length: int, directory: str = def write(self, bar): bar = bar.replace("\r", "").replace("\n", "") - if bar != "": + if bar != "" and [ord(num) for num in bar] != [27, 91, 65]: #No idea why we're getting the 27, 1, 65 character set, just killing to so we can move on try: print('\r' + bar, end='') try: From ae9ebba185620d44be5ce96c70712f712b039679 Mon Sep 17 00:00:00 2001 From: ebolam Date: Sat, 22 Oct 2022 21:09:45 -0400 Subject: [PATCH 08/10] Fix for Model Download Bar on UI2 --- koboldai_settings.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/koboldai_settings.py b/koboldai_settings.py index 3a60a467..23fdd82b 100644 --- a/koboldai_settings.py +++ b/koboldai_settings.py @@ -691,7 +691,12 @@ class model_settings(settings): else: self.tqdm.update(value-old_value) if self.total_download_chunks is not None: - self.tqdm_progress = 0 if self.total_download_chunks==0 else round(float(self.downloaded_chunks)/float(self.total_download_chunks)*100, 1) + if self.total_download_chunks==0: + self.tqdm_progress = 0 + elif float(self.downloaded_chunks) > float(self.total_download_chunks): + self.tqdm_progress = 100 + else: + self.tqdm_progress = round(float(self.downloaded_chunks)/float(self.total_download_chunks)*100, 1) else: self.tqdm_progress = 0 if self.tqdm.format_dict['rate'] is not None: From b719f8e8e894c46a4aa9fb0695b249ab54c3c184 Mon Sep 17 00:00:00 2001 From: ebolam Date: Sat, 22 Oct 2022 21:16:31 -0400 Subject: [PATCH 09/10] W++ Attribute Fix (tabs need work) --- static/koboldai.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/static/koboldai.js b/static/koboldai.js index 03a74888..289d5f43 100644 --- a/static/koboldai.js +++ b/static/koboldai.js @@ -1819,7 +1819,7 @@ function world_info_entry(data) { if (attribute != '') { i += 1; attribute_area = document.createElement("div"); - label = document.createElement("span"); + let label = document.createElement("span"); label.textContent = "\xa0\xa0\xa0\xa0Attribute: "; attribute_area.append(label); input = document.createElement("input"); @@ -1833,7 +1833,7 @@ function world_info_entry(data) { input.setAttribute("uid", data.uid); input.setAttribute("data_type", "attribute"); input.id = "wpp_"+data.uid+"_attr_"+i - input.onchange = function() {do_wpp(this.parentElement.parentElement)}; + input.onchange = function() {do_wpp(this.parentElement.parentElement.parentElement)}; attribute_area.append(input); wpp_attributes_area.append(attribute_area); j=-1; @@ -1847,7 +1847,7 @@ function world_info_entry(data) { input.type = "text"; input.setAttribute("contenteditable", true); input.ondragstart=function() {event.preventDefault();event.stopPropagation();}; - input.onchange = function() {do_wpp(this.parentElement.parentElement)}; + input.onchange = function() {do_wpp(this.parentElement.parentElement.parentElement)}; input.onfocus=function() {this.parentElement.parentElement.parentElement.setAttribute('draggable', 'false');this.setAttribute('draggable', 'false');}; input.onblur=function() {this.parentElement.parentElement.parentElement.setAttribute('draggable', 'true');this.setAttribute('draggable', 'true');}; input.ondragstart=function() {event.preventDefault();event.stopPropagation();}; @@ -1873,7 +1873,7 @@ function world_info_entry(data) { input.setAttribute("data_type", "value"); input.id = "wpp_"+data.uid+"_value_"+i+"_blank"; last_new_value = input; - input.onchange = function() {if (this.value != "") {on_new_wi_item = this.id;do_wpp(this.parentElement.parentElement)}}; + input.onchange = function() {if (this.value != "") {on_new_wi_item = this.id;do_wpp(this.parentElement.parentElement.parentElement)}}; value_area.append(input); wpp_attributes_area.append(value_area); } @@ -1894,7 +1894,7 @@ function world_info_entry(data) { input.setAttribute("value_num", i); input.setAttribute("data_type", "attribute"); input.id = "wpp_"+data.uid+"_attr_blank"; - input.onchange = function() {if (this.value != "") {on_new_wi_item=this.id;do_wpp(this.parentElement.parentElement)}}; + input.onchange = function() {if (this.value != "") {on_new_wi_item=this.id;do_wpp(this.parentElement.parentElement.parentElement)}}; attribute_area.append(input); wpp_attributes_area.append(attribute_area); From 34dfabfd9430ec4033f54ab01763a7cc5871e1e6 Mon Sep 17 00:00:00 2001 From: ebolam Date: Sat, 22 Oct 2022 21:18:20 -0400 Subject: [PATCH 10/10] W++ Tab Fix --- static/koboldai.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/koboldai.js b/static/koboldai.js index 289d5f43..ff675977 100644 --- a/static/koboldai.js +++ b/static/koboldai.js @@ -1690,7 +1690,7 @@ function world_info_entry(data) { var original_focus = null; if (document.getElementById("world_info_"+data.uid)) { //First let's get the id of the element we're on so we can restore it after removing the object - //original_focus = document.activeElement.id; + original_focus = document.activeElement.id; //console.log("Active ID: "+original_focus); //console.log(document.activeElement); //document.getElementById("world_info_"+data.uid).remove();