fix tab vs space error

This commit is contained in:
ebolam
2023-04-21 14:11:51 -04:00
parent 15bde91898
commit d7c46f668c

View File

@@ -7475,16 +7475,16 @@ def loadRequest(loadpath, filename=None):
start_time = time.time()
if(isinstance(loadpath, str)):
#Original UI only sends the story name and assumes it's always a .json file... here we check to see if it's a directory to load that way
if not isinstance(loadpath, dict) and not os.path.exists(loadpath):
if os.path.exists(loadpath.replace(".json", "")):
loadpath = loadpath.replace(".json", "")
if not isinstance(loadpath, dict) and not os.path.exists(loadpath):
if os.path.exists(loadpath.replace(".json", "")):
loadpath = loadpath.replace(".json", "")
if not isinstance(loadpath, dict) and os.path.isdir(loadpath):
if not valid_v3_story(loadpath):
raise RuntimeError(f"Tried to load {loadpath}, a non-save directory.")
koboldai_vars.update_story_path_structure(loadpath)
loadpath = os.path.join(loadpath, "story.json")
if not isinstance(loadpath, dict) and os.path.isdir(loadpath):
if not valid_v3_story(loadpath):
raise RuntimeError(f"Tried to load {loadpath}, a non-save directory.")
koboldai_vars.update_story_path_structure(loadpath)
loadpath = os.path.join(loadpath, "story.json")
with open(loadpath, "r", encoding="utf-8") as file:
js = json.load(file)
from_file=loadpath