From 7bd6e11adcf501ddca3c87a4bca2aa96e2a4d122 Mon Sep 17 00:00:00 2001 From: ebolam Date: Wed, 7 Sep 2022 17:36:40 -0400 Subject: [PATCH 01/20] fix for arguments being ignored --- aiserver.py | 17 ++++++++++------- koboldai_settings.py | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/aiserver.py b/aiserver.py index e344a657..25785c84 100644 --- a/aiserver.py +++ b/aiserver.py @@ -1040,7 +1040,14 @@ def general_startup(override_args=None): args = parser.parse_args(shlex.split(os.environ["KOBOLDAI_ARGS"])) else: args = parser.parse_args() - + + #load system and user settings + for setting in ['user_settings', 'system_settings']: + if os.path.exists("settings/{}.v2_settings".format(setting)): + with open("settings/{}.v2_settings".format(setting), "r") as settings_file: + getattr(koboldai_vars, "_{}".format(setting)).from_json(settings_file.read()) + + temp = [x for x in vars(args)] for arg in temp: if arg == "path": @@ -1102,7 +1109,9 @@ def general_startup(override_args=None): koboldai_vars.host = True; if args.host: + print("setting host") koboldai_vars.host = True; + print("koboldai_vars.host: {}".format(koboldai_vars.host)) if args.cpu: koboldai_vars.use_colab_tpu = False @@ -1132,11 +1141,6 @@ def general_startup(override_args=None): koboldai_settings.queue = multiprocessing.Queue() socketio.start_background_task(socket_io_relay, koboldai_settings.queue, socketio) - #load system and user settings - for setting in ['user_settings', 'system_settings']: - if os.path.exists("settings/{}.v2_settings".format(setting)): - with open("settings/{}.v2_settings".format(setting), "r") as settings_file: - getattr(koboldai_vars, "_{}".format(setting)).from_json(settings_file.read()) #==================================================================# # Load Model @@ -10501,7 +10505,6 @@ if __name__ == "__main__": print("{0}Webserver has started, you can now connect to this machine at port {1}{2}" .format(colors.GREEN, port, colors.END)) koboldai_vars.serverstarted = True - socketio.run(app, host='0.0.0.0', port=port) else: if args.unblock: diff --git a/koboldai_settings.py b/koboldai_settings.py index abf0c6fb..06db24ce 100644 --- a/koboldai_settings.py +++ b/koboldai_settings.py @@ -705,7 +705,7 @@ class user_settings(settings): class system_settings(settings): local_only_variables = ['socketio', 'lua_state', 'lua_logname', 'lua_koboldbridge', 'lua_kobold', 'lua_koboldcore', 'regex_sl', 'acregex_ai', 'acregex_ui', 'comregex_ai', 'comregex_ui', 'sp', '_horde_pid'] - no_save_variables = ['socketio', 'lua_state', 'lua_logname', 'lua_koboldbridge', 'lua_kobold', 'lua_koboldcore', 'sp', '_horde_pid', 'horde_share'] + no_save_variables = ['socketio', 'lua_state', 'lua_logname', 'lua_koboldbridge', 'lua_kobold', 'lua_koboldcore', 'sp', '_horde_pid', 'horde_share', 'aibusy', 'serverstarted'] settings_name = "system" def __init__(self, socketio): self.socketio = socketio From ed62f852ecfe3fd4b9206ba6219e436703bf1b76 Mon Sep 17 00:00:00 2001 From: ebolam Date: Wed, 7 Sep 2022 19:47:33 -0400 Subject: [PATCH 02/20] Fix for abort --- aiserver.py | 19 ++++++++++--------- koboldai_settings.py | 13 +++++++++---- static/koboldai.css | 5 +++++ templates/index_new.html | 2 +- 4 files changed, 25 insertions(+), 14 deletions(-) diff --git a/aiserver.py b/aiserver.py index 25785c84..49aabc34 100644 --- a/aiserver.py +++ b/aiserver.py @@ -918,17 +918,17 @@ def loadsettings(): # Load a soft prompt from a file #==================================================================# -def check_for_sp_change(): - while(True): - time.sleep(0.05) - - if(koboldai_vars.sp_changed): - with app.app_context(): - emit('from_server', {'cmd': 'spstatitems', 'data': {koboldai_vars.spfilename: koboldai_vars.spmeta} if koboldai_vars.allowsp and len(koboldai_vars.spfilename) else {}}, namespace=None, broadcast=True, room="UI_1") - koboldai_vars.sp_changed = False +#def check_for_sp_change(): +# while(True): +# time.sleep(0.05) +# +# if(koboldai_vars.sp_changed): +# with app.app_context(): +# emit('from_server', {'cmd': 'spstatitems', 'data': {koboldai_vars.spfilename: koboldai_vars.spmeta} if koboldai_vars.allowsp and len(koboldai_vars.spfilename) else {}}, namespace=None, broadcast=True, room="UI_1") +# koboldai_vars.sp_changed = False -socketio.start_background_task(check_for_sp_change) +#socketio.start_background_task(check_for_sp_change) def spRequest(filename): if(not koboldai_vars.allowsp): @@ -1798,6 +1798,7 @@ def patch_transformers(): if(koboldai_vars.abort or koboldai_vars.generated_tkns >= koboldai_vars.genamt): self.regeneration_required = False self.halt = False + koboldai_vars.abort = False return True if(koboldai_vars.standalone): return False diff --git a/koboldai_settings.py b/koboldai_settings.py index 06db24ce..cbdb3c44 100644 --- a/koboldai_settings.py +++ b/koboldai_settings.py @@ -317,7 +317,7 @@ class koboldai_vars(object): # return getattr(self._story_settings[self._sessions['story']], name) else: return getattr(self._story_settings['default'], name) - + class settings(object): def to_json(self): @@ -796,9 +796,14 @@ class system_settings(settings): if name not in self.local_only_variables and name[0] != "_" and not new_variable: process_variable_changes(self.socketio, self.__class__.__name__.replace("_settings", ""), name, value, old_value) - if name == "aibusy" and value == False: - koboldai_vars.abort = False - + #if name == "aibusy" and value == False and self.abort == True: + # koboldai_vars.abort = False + + #for original UI + if name == 'sp_changed': + self.socketio.emit('from_server', {'cmd': 'spstatitems', 'data': {koboldai_vars.spfilename: koboldai_vars.spmeta} if koboldai_vars.allowsp and len(koboldai_vars.spfilename) else {}}, namespace=None, broadcast=True, room="UI_1") + self.sp_changed = False + if name == 'horde_share': if self.on_colab == False: if os.path.exists("./KoboldAI-Horde"): diff --git a/static/koboldai.css b/static/koboldai.css index 548e054a..5fda3e58 100644 --- a/static/koboldai.css +++ b/static/koboldai.css @@ -1403,6 +1403,11 @@ body { height: 0px; } +.statusbar_outer[system_aibusy="false"] { + display: none; + height: 0px; +} + .statusbar_inner { background-color: var(--statusbar_color); color: var(--statusbar_text_color); diff --git a/templates/index_new.html b/templates/index_new.html index ec6884c3..e8f27c4d 100644 --- a/templates/index_new.html +++ b/templates/index_new.html @@ -80,7 +80,7 @@ document.getElementById("themetext").value = ""; }' onkeyup="calc_token_usage()"> - + + + \ No newline at end of file diff --git a/templates/settings flyout.html b/templates/settings flyout.html index d58b0a9a..f76ca472 100644 --- a/templates/settings flyout.html +++ b/templates/settings flyout.html @@ -104,6 +104,7 @@
+ Download debug dump