From 36b6dcb6417349bdcd79a29bf5e12477e4880420 Mon Sep 17 00:00:00 2001 From: henk717 Date: Mon, 31 Jan 2022 19:39:32 +0100 Subject: [PATCH] Increase newlinemode compatibility Ran into issues with other modes like chatmode and adventure, moved it further down the pipeline and converting back to \n before processing additional formatting. Still has an issue with the html formatting not working, but at least the AI works now. --- aiserver.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/aiserver.py b/aiserver.py index a200bc9b..6ce7d6b4 100644 --- a/aiserver.py +++ b/aiserver.py @@ -2373,10 +2373,6 @@ def actionsubmit(data, actionmode=0, force_submit=False, force_prompt_gen=False, # Ignore new submissions if the AI is currently busy if(vars.aibusy): return - - # mode - if(vars.newlinemode == "s"): - data = data.replace('\n', "") while(True): set_aibusy(1) @@ -2400,7 +2396,11 @@ def actionsubmit(data, actionmode=0, force_submit=False, force_prompt_gen=False, data = re.sub(r'\n+', ' ', data) if(len(data)): data = f"\n{vars.chatname} : {data}\n" - + + # mode + if(vars.newlinemode == "s"): + data = data.replace('\n', "") + # If we're not continuing, store a copy of the raw input if(data != ""): vars.lastact = data @@ -3232,6 +3232,9 @@ def applyinputformatting(txt): # Applies chosen formatting options to text returned from AI #==================================================================# def applyoutputformatting(txt): + # Revert S mode on output to maintain compatibility + txt = txt.replace('', "\n") + # Use standard quotes and apostrophes txt = utils.fixquotes(txt)