mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-06-05 21:59:24 +02:00
Fix for Original UI to use new save formats/code
This commit is contained in:
25
fileops.py
25
fileops.py
@@ -110,6 +110,31 @@ def getstoryfiles():
|
||||
print(f"Browser loading error: {file} has incorrect format.")
|
||||
continue
|
||||
list.append(ob)
|
||||
elif os.path.isdir("stories/{}".format(file)):
|
||||
if os.path.exists("stories/{}/story.json".format(file)):
|
||||
ob = {}
|
||||
ob["name"] = file
|
||||
f = open("stories/{}/story.json".format(file), "r")
|
||||
try:
|
||||
js = json.load(f)
|
||||
except:
|
||||
print(f"Browser loading error: {file} is malformed or not a JSON file.")
|
||||
f.close()
|
||||
continue
|
||||
f.close()
|
||||
if 'file_version' in js:
|
||||
try:
|
||||
ob["actions"] = int(js["actions"]["action_count"])+1
|
||||
except TypeError:
|
||||
print(f"Browser loading error: {file} has incorrect format.")
|
||||
continue
|
||||
else:
|
||||
try:
|
||||
ob["actions"] = len(js["actions"])
|
||||
except TypeError:
|
||||
print(f"Browser loading error: {file} has incorrect format.")
|
||||
continue
|
||||
list.append(ob)
|
||||
return list
|
||||
|
||||
#==================================================================#
|
||||
|
Reference in New Issue
Block a user