mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-06-05 21:59:24 +02:00
Compatability update for latest AIDCAT export format
This commit is contained in:
17
aiserver.py
17
aiserver.py
@ -1235,7 +1235,10 @@ def importRequest():
|
|||||||
ob["descr"] = story["description"]
|
ob["descr"] = story["description"]
|
||||||
else:
|
else:
|
||||||
ob["descr"] = "(No Description)"
|
ob["descr"] = "(No Description)"
|
||||||
|
if("actions" in story):
|
||||||
ob["acts"] = len(story["actions"])
|
ob["acts"] = len(story["actions"])
|
||||||
|
elif("actionWindow" in story):
|
||||||
|
ob["acts"] = len(story["actionWindow"])
|
||||||
emit('from_server', {'cmd': 'addimportline', 'data': ob})
|
emit('from_server', {'cmd': 'addimportline', 'data': ob})
|
||||||
num += 1
|
num += 1
|
||||||
|
|
||||||
@ -1252,19 +1255,33 @@ def importgame():
|
|||||||
|
|
||||||
# Copy game contents to vars
|
# Copy game contents to vars
|
||||||
vars.gamestarted = True
|
vars.gamestarted = True
|
||||||
|
|
||||||
|
if("actions" in ref):
|
||||||
if(len(ref["actions"]) > 0):
|
if(len(ref["actions"]) > 0):
|
||||||
vars.prompt = ref["actions"][0]["text"]
|
vars.prompt = ref["actions"][0]["text"]
|
||||||
else:
|
else:
|
||||||
vars.prompt = ""
|
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.memory = ref["memory"]
|
||||||
vars.authornote = ref["authorsNote"]
|
vars.authornote = ref["authorsNote"]
|
||||||
vars.actions = []
|
vars.actions = []
|
||||||
vars.worldinfo = []
|
vars.worldinfo = []
|
||||||
|
|
||||||
# Get all actions except for prompt
|
# Get all actions except for prompt
|
||||||
|
if("actions" in ref):
|
||||||
if(len(ref["actions"]) > 1):
|
if(len(ref["actions"]) > 1):
|
||||||
for act in ref["actions"][1:]:
|
for act in ref["actions"][1:]:
|
||||||
vars.actions.append(act["text"])
|
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
|
# Get just the important parts of world info
|
||||||
if(ref["worldInfo"] != None):
|
if(ref["worldInfo"] != None):
|
||||||
|
Reference in New Issue
Block a user