diff --git a/aiserver.py b/aiserver.py index 1338d859..7a89980b 100644 --- a/aiserver.py +++ b/aiserver.py @@ -7053,11 +7053,13 @@ def load_story_v1(js): else: koboldai_vars.gamestarted = False if(koboldai_vars.gamestarted): + #We set the action count higher so that we don't trigger a scroll in the UI. + #Once all but the last is loaded we can bring it back down and do the last one so we scroll to it koboldai_vars.actions.action_count += 1 - for i in range(len(js["actions"])): - if i == len(js["actions"])-1: - koboldai_vars.actions.action_count -= 1 - koboldai_vars.actions.append(js["actions"][i]) + for i in range(len(js["actions"])-1): + koboldai_vars.actions.append(js["actions"][i], action_id_offset=-1) + koboldai_vars.actions.action_count -= 1 + koboldai_vars.actions.append(js["actions"][len(js["actions"])-1]) if "actions_metadata" in js: if type(js["actions_metadata"]) == dict: diff --git a/koboldai_settings.py b/koboldai_settings.py index f4017042..2e188947 100644 --- a/koboldai_settings.py +++ b/koboldai_settings.py @@ -1113,30 +1113,31 @@ class KoboldStoryRegister(object): self.set_game_saved() self.story_settings.save_story() - def append(self, text): + def append(self, text, action_id_offset=0): self.clear_unused_options() self.action_count+=1 - if self.action_count in self.actions: - if self.actions[self.action_count]["Selected Text"] != text: - self.actions[self.action_count]["Selected Text"] = text - self.actions[i]["WI Search Text"] = re.sub("[^0-9a-z \'\"]", "", text) - self.actions[self.action_count]["Probabilities"] = [] + action_id = self.action_count + action_id_offset + if action_id in self.actions: + if self.actions[action_id]["Selected Text"] != text: + self.actions[action_id]["Selected Text"] = text + self.actions[action_id]["WI Search Text"] = re.sub("[^0-9a-z \'\"]", "", text) + self.actions[action_id]["Probabilities"] = [] selected_text_length = 0 - self.actions[self.action_count]["Selected Text Length"] = selected_text_length - self.actions[self.action_count]["In AI Input"] = False - for item in self.actions[self.action_count]["Options"]: + self.actions[action_id]["Selected Text Length"] = selected_text_length + self.actions[action_id]["In AI Input"] = False + for item in self.actions[action_id]["Options"]: if item['text'] == text: - old_options = self.actions[self.action_count]["Options"] + old_options = self.actions[action_id]["Options"] del item else: selected_text_length = 0 - self.actions[self.action_count] = {"Selected Text": text, "Selected Text Length": selected_text_length, + self.actions[action_id] = {"Selected Text": text, "Selected Text Length": selected_text_length, "WI Search Text": re.sub("[^0-9a-z \'\"]", "", text), "In AI Input": False, "Options": [], "Probabilities": []} - process_variable_changes(self.socketio, "story", 'actions', {"id": self.action_count, 'action': self.actions[self.action_count]}, None) + process_variable_changes(self.socketio, "story", 'actions', {"id": action_id, 'action': self.actions[action_id]}, None) self.set_game_saved() logger.debug("Calcing AI Text from Action Append") ignore = self.koboldai_vars.calc_ai_text() diff --git a/templates/story flyout.html b/templates/story flyout.html index be09b35a..313aeb47 100644 --- a/templates/story flyout.html +++ b/templates/story flyout.html @@ -7,14 +7,14 @@
-

Memory

+

Important information the AI should always keep in mind.
-

Auto-Memory (non-functional)

+

What the system would use for automatic memory summarized from the game @@ -29,9 +29,9 @@ Heavily influences the direction and style of the AI's writing. - Template:
-
- Author's Notes:
+
+
+

{% with menu='author_notes' %} @@ -44,11 +44,11 @@