From 0e038b8727ae038561c8828b658e9a3c77963e3d Mon Sep 17 00:00:00 2001 From: KoboldAI Dev Date: Fri, 14 May 2021 02:24:05 -0400 Subject: [PATCH] Bugfix for Add Sentence Spacing format option --- utils.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/utils.py b/utils.py index 10d4270f..2b43f167 100644 --- a/utils.py +++ b/utils.py @@ -66,9 +66,12 @@ def removespecialchars(txt): #==================================================================# # If the next action follows a sentence closure, add a space #==================================================================# -def addsentencespacing(txt, acts): +def addsentencespacing(txt, vars): # Get last character of last action - lastchar = acts[-1][-1] + if(len(vars.actions) > 0): + lastchar = vars.actions[-1][-1] + else: + lastchar = vars.prompt[-1] if(lastchar == "." or lastchar == "!" or lastchar == "?" or lastchar == "," or lastchar == ";" or lastchar == ":"): txt = " " + txt return txt