From 280b67e5119faf7bb4d5097b00f100ee1599df5b Mon Sep 17 00:00:00 2001 From: ebolam Date: Tue, 4 Oct 2022 19:18:30 -0400 Subject: [PATCH] Fix for prompt not showing up Fix for sentence splitting eating new lines. --- koboldai_settings.py | 2 +- static/koboldai.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/koboldai_settings.py b/koboldai_settings.py index 436bbc05..bfcd6c81 100644 --- a/koboldai_settings.py +++ b/koboldai_settings.py @@ -1465,7 +1465,7 @@ class KoboldStoryRegister(object): action_text = self.__str__() action_text = "{}{}".format("" if self.story_settings is None else self.story_settings.prompt, action_text) ###########action_text_split = [sentence, actions used in sentence, token length, included in AI context]################ - action_text_split = [[x+" ", [], 0, False] for x in re.split("(?<=[.!?])\s+", action_text)] + action_text_split = [[x+" ", [], 0, False] for x in re.split("(?<=[.!?])[ \t]+", action_text)] #The last action shouldn't have the extra space from the sentence splitting, so let's remove it action_text_split[-1][0] = action_text_split[-1][0][:-1] diff --git a/static/koboldai.js b/static/koboldai.js index f36b901e..3c932655 100644 --- a/static/koboldai.js +++ b/static/koboldai.js @@ -586,7 +586,7 @@ function var_changed(data) { scroll_trigger_element = document.getElementById("Selected Text Chunk "+actions[0].id); //if we hit the top, unhide the prompt and clear the scroll trigger - if (actions[actions.length-1].id == 0) { + if (actions[0].id == 0) { document.getElementById("story_prompt").classList.remove("hidden"); scroll_trigger_element = null; }