Fix for V1 story loads

This commit is contained in:
ebolam
2022-09-30 16:32:37 -04:00
parent b8765874bb
commit f3b55fdfed
2 changed files with 6 additions and 6 deletions

View File

@@ -7059,9 +7059,9 @@ def load_story_v1(js):
#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"])-1):
koboldai_vars.actions.append(js["actions"][i], action_id_offset=-1)
koboldai_vars.actions.append(js["actions"][i], action_id_offset=-1, recalc=False)
koboldai_vars.actions.action_count -= 1
koboldai_vars.actions.append(js["actions"][len(js["actions"])-1])
koboldai_vars.actions.append(js["actions"][len(js["actions"])-1], recalc=False)
if "actions_metadata" in js:
if type(js["actions_metadata"]) == dict:

View File

@@ -1113,7 +1113,7 @@ class KoboldStoryRegister(object):
self.set_game_saved()
self.story_settings.save_story()
def append(self, text, action_id_offset=0):
def append(self, text, action_id_offset=0, recalc=True):
self.clear_unused_options()
self.action_count+=1
action_id = self.action_count + action_id_offset
@@ -1139,8 +1139,9 @@ class KoboldStoryRegister(object):
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()
if recalc:
logger.debug("Calcing AI Text from Action Append")
ignore = self.koboldai_vars.calc_ai_text()
def append_options(self, option_list):
if self.action_count+1 in self.actions:
@@ -1819,7 +1820,6 @@ class KoboldWorldInfo(object):
#self.wifolders_u = {} # Dictionary of pairs of folder UID - list of WI UID
self.story_settings.wifolders_u = {folder_entries[x]: [y for y in self.story_settings.worldinfo if y['folder'] == x] for x in folder_entries}
def reset_used_in_game(self):
for key in self.world_info:
if self.world_info[key]["used_in_game"] != self.world_info[key]["constant"]: