From ba0ece7263ccaf6bd08ef81fb9110ac600711c4b Mon Sep 17 00:00:00 2001 From: ebolam Date: Sun, 18 Dec 2022 16:24:36 -0500 Subject: [PATCH] Changed story migration behavior to leave v1 stories in place and ignore stories that have a same name folder rather than moving the file to the new structure. --- aiserver.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/aiserver.py b/aiserver.py index a34fc7d8..43b8511f 100644 --- a/aiserver.py +++ b/aiserver.py @@ -7616,7 +7616,8 @@ def load_story_v1(js, from_file=None): if from_file is not None: #Save the file so we get a new V2 format, then move the save file into the proper directory koboldai_vars.save_story() - shutil.move(from_file, koboldai_vars.save_paths.story.replace("story.json", "v1_file.json")) + #We're no longer moving the original file. It'll stay in place. + #shutil.move(from_file, koboldai_vars.save_paths.story.replace("story.json", "v1_file.json")) def load_story_v2(js, from_file=None): @@ -8895,6 +8896,9 @@ def valid_story(path: str): if not path.endswith(".json"): return False + if os.path.exists(path.replace(".json", "/story.json")): + return False + try: with open(path, 'rb') as file: parser = ijson.parse(file)