mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-06-05 21:59:24 +02:00
Fix for save game load error
This commit is contained in:
@@ -4254,7 +4254,7 @@ def kml(txt):
|
|||||||
# Send start message and tell Javascript to set UI state
|
# Send start message and tell Javascript to set UI state
|
||||||
#==================================================================#
|
#==================================================================#
|
||||||
def setStartState():
|
def setStartState():
|
||||||
if(koboldai_vars.welcome):
|
if koboldai_vars.welcome and isinstance(koboldai_vars.welcome, str):
|
||||||
txt = kml(koboldai_vars.welcome) + "<br/>"
|
txt = kml(koboldai_vars.welcome) + "<br/>"
|
||||||
else:
|
else:
|
||||||
txt = "<span>Welcome to <span class=\"color_cyan\">KoboldAI</span>! You are running <span class=\"color_green\">"+getmodelname()+"</span>.<br/>"
|
txt = "<span>Welcome to <span class=\"color_cyan\">KoboldAI</span>! You are running <span class=\"color_green\">"+getmodelname()+"</span>.<br/>"
|
||||||
@@ -6687,7 +6687,7 @@ def load_story_v1(js):
|
|||||||
data = js["actions_metadata"][key]["Alternative Text"]
|
data = js["actions_metadata"][key]["Alternative Text"]
|
||||||
for i in range(len(js["actions_metadata"][key]["Alternative Text"])):
|
for i in range(len(js["actions_metadata"][key]["Alternative Text"])):
|
||||||
data[i]["text"] = data[i].pop("Text")
|
data[i]["text"] = data[i].pop("Text")
|
||||||
koboldai_vars.actions.set_options(data, key)
|
koboldai_vars.actions.set_options(data, int(key))
|
||||||
|
|
||||||
# Try not to break older save files
|
# Try not to break older save files
|
||||||
if("authorsnote" in js):
|
if("authorsnote" in js):
|
||||||
|
@@ -156,7 +156,8 @@ class koboldai_vars(object):
|
|||||||
#we're going to split our actions by sentence for better context. We'll add in which actions the sentence covers. Prompt will be added at a -1 ID
|
#we're going to split our actions by sentence for better context. We'll add in which actions the sentence covers. Prompt will be added at a -1 ID
|
||||||
actions = {i: self.actions[i] for i in range(len(self.actions))}
|
actions = {i: self.actions[i] for i in range(len(self.actions))}
|
||||||
actions[-1] = self.prompt
|
actions[-1] = self.prompt
|
||||||
action_text = self.prompt + str(self.actions)
|
action_text = str(self.actions)
|
||||||
|
action_text = "{}{}".format(self.prompt, action_text)
|
||||||
###########action_text_split = [sentence, actions used in sentence, token length, included in AI context]################
|
###########action_text_split = [sentence, actions used in sentence, token length, included in AI context]################
|
||||||
action_text_split = [[x+" ", [], 0 if self.tokenizer is None else len(self.tokenizer.encode(x+" ")), False] for x in re.split("(?<=[.!?])\s+", action_text)]
|
action_text_split = [[x+" ", [], 0 if self.tokenizer is None else len(self.tokenizer.encode(x+" ")), False] for x in re.split("(?<=[.!?])\s+", action_text)]
|
||||||
#The last action shouldn't have the extra space from the sentence splitting, so let's remove it
|
#The last action shouldn't have the extra space from the sentence splitting, so let's remove it
|
||||||
|
Reference in New Issue
Block a user