diff --git a/aiserver.py b/aiserver.py index aa18166d..743c65f8 100644 --- a/aiserver.py +++ b/aiserver.py @@ -1122,7 +1122,7 @@ def loadmodelsettings(): if setting in js["formatoptns"]: setattr(koboldai_vars, setting, js["formatoptns"][setting]) if("welcome" in js): - koboldai_vars.welcome = js["welcome"] + koboldai_vars.welcome = js["welcome"] if js["welcome"] != False else "" if("newlinemode" in js): koboldai_vars.newlinemode = js["newlinemode"] if("antemplate" in js): @@ -4367,11 +4367,11 @@ def kml(txt): # Send start message and tell Javascript to set UI state #==================================================================# def setStartState(): - if koboldai_vars.welcome and isinstance(koboldai_vars.welcome, str): + if koboldai_vars.welcome != "": txt = kml(koboldai_vars.welcome) + "
" else: txt = "Welcome to KoboldAI! You are running "+getmodelname()+".
" - if(not koboldai_vars.noai and not koboldai_vars.welcome): + if(not koboldai_vars.noai and koboldai_vars.welcome == ""): txt = txt + "Please load a game or enter a prompt below to begin!
" if(koboldai_vars.noai): txt = txt + "Please load or import a story to read. There is no AI in this mode." diff --git a/koboldai_settings.py b/koboldai_settings.py index 0247c3a2..273c87f8 100644 --- a/koboldai_settings.py +++ b/koboldai_settings.py @@ -554,6 +554,7 @@ class model_settings(settings): self.oaiapikey = "" # API key to use for OpenAI API calls self.configname = None self.online_model = '' + self.welcome = "" # Custom Welcome Text def reset_for_model_load(self): self.max_length = 2048 # Maximum number of tokens to submit per action @@ -956,7 +957,6 @@ class system_settings(settings): self.comregex_ui = re.compile(r'(<\|(?:.|\n)*?\|>)') # Pattern for matching comments in the editor self.host = False self.flaskwebgui = False - self.welcome = False # Custom Welcome Text (False is default) self.quiet = False # If set will suppress any story text from being printed to the console (will only be seen on the client web page) self.use_colab_tpu = os.environ.get("COLAB_TPU_ADDR", "") != "" or os.environ.get("TPU_NAME", "") != "" # Whether or not we're in a Colab TPU instance or Kaggle TPU instance and are going to use the TPU rather than the CPU self.aria2_port = 6799 #Specify the port on which aria2's RPC interface will be open if aria2 is installed (defaults to 6799) diff --git a/static/koboldai.js b/static/koboldai.js index cacb1fd7..04093c4b 100644 --- a/static/koboldai.js +++ b/static/koboldai.js @@ -170,17 +170,7 @@ function reset_story() { for (const item of temp) { item.remove(); } - dummy_span = document.createElement("div"); - dummy_span.id = "Delete Me"; - dummy_span.classList.add("noselect"); document.getElementById("Selected Text").setAttribute("contenteditable", "false"); - text = ""; - for (i=0;i<154;i++) { - text += "\xa0 "; - } - dummy_span.textContent = text; - dummy_span.setAttribute("contenteditable", false); - story_area.append(dummy_span); var option_area = document.getElementById("Select Options"); while (option_area.firstChild) { option_area.removeChild(option_area.firstChild); @@ -386,10 +376,6 @@ function do_prompt(data) { document.getElementById('input_text').placeholder = "Enter text here (shift+enter for new line)"; document.getElementById('themerow').classList.add("hidden"); document.getElementById('themetext').value = ""; - if (document.getElementById("Delete Me")) { - document.getElementById("Delete Me").remove(); - document.getElementById("Selected Text").setAttribute("contenteditable", "true"); - } //enable editing document.getElementById("Selected Text").setAttribute("contenteditable", "true"); } else { @@ -542,6 +528,11 @@ function var_changed(data) { if ((data.classname == 'actions') && (data.name == 'Action Count')) { current_action = data.value; + if (current_action <= 0) { + document.getElementById("story_prompt").classList.remove("hidden"); + scroll_trigger_element = undefined; + document.getElementById("Selected Text").onscroll = undefined; + } } //Special Case for Actions if ((data.classname == "story") && (data.name == "actions")) { @@ -2446,7 +2437,7 @@ function select_game_text(event) { } function edit_game_text() { - if ((selected_game_chunk != null) && (selected_game_chunk.textContent != selected_game_chunk.original_text) && (selected_game_chunk != document.getElementById("Delete Me"))) { + if ((selected_game_chunk != null) && (selected_game_chunk.textContent != selected_game_chunk.original_text) && (selected_game_chunk != document.getElementById("welcome_text"))) { if (selected_game_chunk.id == "story_prompt") { sync_to_server(selected_game_chunk); } else { diff --git a/templates/index_new.html b/templates/index_new.html index 661daf66..4462e6bb 100644 --- a/templates/index_new.html +++ b/templates/index_new.html @@ -45,6 +45,7 @@

Disconnected

+