mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-06-05 21:59:24 +02:00
Fix for missing prompt on prompt only story load
This commit is contained in:
@@ -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) + "<br/>"
|
||||
else:
|
||||
txt = "<span>Welcome to <span class=\"color_cyan\">KoboldAI</span>! You are running <span class=\"color_green\">"+getmodelname()+"</span>.<br/>"
|
||||
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!</span>"
|
||||
if(koboldai_vars.noai):
|
||||
txt = txt + "Please load or import a story to read. There is no AI in this mode."
|
||||
|
@@ -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)
|
||||
|
@@ -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 {
|
||||
|
@@ -45,6 +45,7 @@
|
||||
<!------------ Game Text Screen--------------------->
|
||||
<div class="gamescreen" id="gamescreen">
|
||||
<div id="disconnect_message"><center><h1>Disconnected</h1></center></div>
|
||||
<div id="welcome_text" class="var_sync_model_welcome"></div>
|
||||
<div class="gametext" id="Selected Text" contenteditable=false onblur="select_game_text(null);" onclick="select_game_text(null);" onkeyup="select_game_text(event);">
|
||||
<span id="story_prompt" class="var_sync_story_prompt var_sync_alt_story_prompt_length var_sync_alt_story_prompt_in_ai rawtext hidden" chunk="-1"></span>
|
||||
<div id="Delete Me" class="noselect" contenteditable=false>
|
||||
|
Reference in New Issue
Block a user