Compatability update for latest AIDCAT export format

This commit is contained in:
KoboldAI Dev 2021-05-16 17:45:21 -04:00
parent ce2e4e1f9e
commit 95cb94e979
1 changed files with 23 additions and 6 deletions

View File

@ -1235,7 +1235,10 @@ def importRequest():
ob["descr"] = story["description"]
else:
ob["descr"] = "(No Description)"
if("actions" in story):
ob["acts"] = len(story["actions"])
elif("actionWindow" in story):
ob["acts"] = len(story["actionWindow"])
emit('from_server', {'cmd': 'addimportline', 'data': ob})
num += 1
@ -1252,19 +1255,33 @@ def importgame():
# Copy game contents to vars
vars.gamestarted = True
if("actions" in ref):
if(len(ref["actions"]) > 0):
vars.prompt = ref["actions"][0]["text"]
else:
vars.prompt = ""
elif("actionWindow" in ref):
if(len(ref["actionWindow"]) > 0):
vars.prompt = ref["actionWindow"][0]["text"]
else:
vars.prompt = ""
else:
vars.prompt = ""
vars.memory = ref["memory"]
vars.authornote = ref["authorsNote"]
vars.actions = []
vars.worldinfo = []
# Get all actions except for prompt
if("actions" in ref):
if(len(ref["actions"]) > 1):
for act in ref["actions"][1:]:
vars.actions.append(act["text"])
elif("actionWindow" in ref):
if(len(ref["actionWindow"]) > 1):
for act in ref["actionWindow"][1:]:
vars.actions.append(act["text"])
# Get just the important parts of world info
if(ref["worldInfo"] != None):