Fixed double space removal to also remove double spaces that span actions

This commit is contained in:
ebolam
2022-11-18 09:50:14 -05:00
parent 8aecb5116d
commit 4b54b97080

View File

@@ -1261,6 +1261,9 @@ class KoboldStoryRegister(object):
if self.koboldai_vars.remove_double_space:
while " " in text:
text = text.replace(" ", " ")
if i > 0:
if self.actions[i-1]['Selected Text'][-1] == " " and text[0] == " ":
text = text[1:]
if i in self.actions:
old = self.actions[i]
old_text = self.actions[i]["Selected Text"]
@@ -1334,6 +1337,9 @@ class KoboldStoryRegister(object):
if self.koboldai_vars.remove_double_space:
while " " in text:
text = text.replace(" ", " ")
if action_id_offset > 0:
if self.actions[action_id_offset-1]['Selected Text'][-1] == " " and text[0] == " ":
text = text[1:]
self.clear_unused_options()
self.action_count+=1
action_id = self.action_count + action_id_offset