From 5f6a80a34998d0886d079aeba9333943b1da0e7c Mon Sep 17 00:00:00 2001 From: somebody Date: Sun, 13 Nov 2022 14:44:04 -0600 Subject: [PATCH] Add newline to last thing if it didnt exist on chatv2 --- koboldai_settings.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/koboldai_settings.py b/koboldai_settings.py index e339c266..4239ced8 100644 --- a/koboldai_settings.py +++ b/koboldai_settings.py @@ -185,6 +185,9 @@ class koboldai_vars(object): def reset_model(self): self._model_settings.reset_for_model_load() + def is_chat_v2(self): + return self.chat_style > 0 and self.chatmode + def get_token_representation(self, text: Union[str, list, None]) -> list: if not self.tokenizer or not text: return [] @@ -269,6 +272,10 @@ class koboldai_vars(object): ######################################### Get Action Text by Sentence ######################################################## action_text_split = self.actions.to_sentences(submitted_text=submitted_text) + + # Always add newlines on chat v2 + if self.is_chat_v2(): + action_text_split[-1][0] = action_text_split[-1][0].strip() + "\n" ######################################### Prompt ########################################################