From 4b54b970804039466660fa58f34987542f48555f Mon Sep 17 00:00:00 2001 From: ebolam Date: Fri, 18 Nov 2022 09:50:14 -0500 Subject: [PATCH] Fixed double space removal to also remove double spaces that span actions --- koboldai_settings.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/koboldai_settings.py b/koboldai_settings.py index 5c22ecff..ded55a1e 100644 --- a/koboldai_settings.py +++ b/koboldai_settings.py @@ -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