mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-06-05 21:59:24 +02:00
Increase newlinemode compatibility
Ran into issues with other modes like chatmode and adventure, moved it further down the pipeline and converting </s> back to \n before processing additional formatting. Still has an issue with the html formatting not working, but at least the AI works now.
This commit is contained in:
13
aiserver.py
13
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
|
# Ignore new submissions if the AI is currently busy
|
||||||
if(vars.aibusy):
|
if(vars.aibusy):
|
||||||
return
|
return
|
||||||
|
|
||||||
# </s> mode
|
|
||||||
if(vars.newlinemode == "s"):
|
|
||||||
data = data.replace('\n', "</s>")
|
|
||||||
|
|
||||||
while(True):
|
while(True):
|
||||||
set_aibusy(1)
|
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)
|
data = re.sub(r'\n+', ' ', data)
|
||||||
if(len(data)):
|
if(len(data)):
|
||||||
data = f"\n{vars.chatname} : {data}\n"
|
data = f"\n{vars.chatname} : {data}\n"
|
||||||
|
|
||||||
|
# </s> mode
|
||||||
|
if(vars.newlinemode == "s"):
|
||||||
|
data = data.replace('\n', "</s>")
|
||||||
|
|
||||||
# If we're not continuing, store a copy of the raw input
|
# If we're not continuing, store a copy of the raw input
|
||||||
if(data != ""):
|
if(data != ""):
|
||||||
vars.lastact = data
|
vars.lastact = data
|
||||||
@ -3232,6 +3232,9 @@ def applyinputformatting(txt):
|
|||||||
# Applies chosen formatting options to text returned from AI
|
# Applies chosen formatting options to text returned from AI
|
||||||
#==================================================================#
|
#==================================================================#
|
||||||
def applyoutputformatting(txt):
|
def applyoutputformatting(txt):
|
||||||
|
# Revert S mode on output to maintain compatibility
|
||||||
|
txt = txt.replace('</s>', "\n")
|
||||||
|
|
||||||
# Use standard quotes and apostrophes
|
# Use standard quotes and apostrophes
|
||||||
txt = utils.fixquotes(txt)
|
txt = utils.fixquotes(txt)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user