diff --git a/gensettings.py b/gensettings.py index c071264a..04ee9e77 100644 --- a/gensettings.py +++ b/gensettings.py @@ -345,13 +345,13 @@ gensettingstf = [ "uitype": "dropdown", "unit": "text", "label": "Story Mode", - "id": "actionmode", + "id": "storymode", "default": 0, "tooltip": "Choose the mode of KoboldAI.", "menu_path": "Home", "sub_path": "", "classname": "story", - "name": "actionmode", + "name": "storymode", 'children': [{'text': 'Story', 'value': 0}, {'text':'Adventure','value':1}, {'text':'Chat', 'value':2}] }, { diff --git a/koboldai_settings.py b/koboldai_settings.py index 3a4da6e3..a6c7fd52 100644 --- a/koboldai_settings.py +++ b/koboldai_settings.py @@ -431,7 +431,7 @@ class model_settings(settings): self.badwordsids = [] self.fp32_model = False # Whether or not the most recently loaded HF model was in fp32 format self.modeldim = -1 # Embedding dimension of your model (e.g. it's 4096 for GPT-J-6B and 2560 for GPT-Neo-2.7B) - self.sampler_order = [0, 1, 2, 3, 4, 5] + self.sampler_order = [6, 0, 1, 2, 3, 4, 5] self.newlinemode = "n" self.lazy_load = True # Whether or not to use torch_lazy_loader.py for transformers models in order to reduce CPU memory usage self.revision = None @@ -552,6 +552,7 @@ class story_settings(settings): self.chatname = "You" self.adventure = False self.actionmode = 0 + self.storymode = 0 self.dynamicscan = False self.recentedit = False self.notes = "" #Notes for the story. Does nothing but save @@ -638,7 +639,7 @@ class story_settings(settings): ignore = self.koboldai_vars.calc_ai_text() #Because we have seperate variables for action types, this syncs them - elif name == 'actionmode': + elif name == 'storymode': if value == 0: self.adventure = False self.chatmode = False @@ -650,14 +651,14 @@ class story_settings(settings): self.chatmode = True elif name == 'adventure' and value == True: self.chatmode = False - self.actionmode = 1 + self.storymode = 1 elif name == 'adventure' and value == False and self.chatmode == False: - self.actionmode = 0 + self.storymode = 0 elif name == 'chatmode' and value == True: self.adventure = False - self.actionmode = 2 + self.storymode = 2 elif name == 'chatmode' and value == False and self.adventure == False: - self.actionmode = 0 + self.storymode = 0 class user_settings(settings): local_only_variables = ['socketio', 'importjs'] diff --git a/static/koboldai.css b/static/koboldai.css index 25a54405..bc74c324 100644 --- a/static/koboldai.css +++ b/static/koboldai.css @@ -199,6 +199,10 @@ border-top-right-radius: var(--tabs_rounding); margin: 2px; } +.chat_mode[story_chatmode="false"] { + display: none; +} + #story_menu_author .setting_container { display: grid; grid-template-areas: "label value" @@ -1305,6 +1309,17 @@ body { gap: 1px; } + +.inputrow[story_storymode="1"] { + grid-template-areas: "adventure_mode textarea statusbar statusbar statusbar" + "adventure_mode textarea submit submit submit" + "adventure_mode textarea back redo retry"; + grid-template-columns: 80px auto 30px 30px 30px; + grid-template-rows: 0px 60px 40px; + gap: 1px; + +} + #random_game_prompt{ display: flex; flex-direction: column; @@ -1319,6 +1334,16 @@ body { border-radius: var(--radius_inputbox); } +#adventure_mode { + grid-area: adventure_mode +} + +#adventure_mode[story_storymode]:not([story_storymode="1"]) { + display: none; +} + + + #input_text { grid-area: textarea; background-color: var(--input_background); diff --git a/static/koboldai.js b/static/koboldai.js index f9955f2b..29284221 100644 --- a/static/koboldai.js +++ b/static/koboldai.js @@ -511,6 +511,14 @@ function var_changed(data) { //Special case for context viewer } else if (data.classname == "story" && data.name == "context") { update_context(data.value); + //special case for story_actionmode + } else if (data.classname == "story" && data.name == "actionmode") { + const button = document.getElementById('adventure_mode'); + if (data.value == 1) { + button.childNodes[1].textContent = "Adventure"; + } else { + button.childNodes[1].textContent = "Story"; + } //Basic Data Syncing } else { var elements_to_change = document.getElementsByClassName("var_sync_"+data.classname.replace(" ", "_")+"_"+data.name.replace(" ", "_")); @@ -2012,6 +2020,25 @@ function load_tweaks(data) { } +function toggle_adventure_mode(button) { + if (button.textContent == "Mode: Story") { + button.childNodes[1].textContent = "Adventure"; + var actionmode = 1 + } else { + button.childNodes[1].textContent = "Story"; + var actionmode = 0 + } + button.classList.add("pulse"); + socket.emit("var_change", {"ID": "story_actionmode", "value": actionmode}, (response) => { + if ('status' in response) { + if (response['status'] == 'Saved') { + document.getElementById("adventure_mode").classList.remove("pulse"); + } + } + }); + +} + //--------------------------------------------General UI Functions------------------------------------ function autoResize(element) { element.style.height = 'auto'; diff --git a/templates/index_new.html b/templates/index_new.html index f8be2eec..177c6bad 100644 --- a/templates/index_new.html +++ b/templates/index_new.html @@ -69,12 +69,13 @@ -
+
+