mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-02-17 12:10:49 +01:00
Use a smarter regex for comments
If the beginning of the comment is at the beginning of a line AND the end of a comment is at the end of a line, an additional newline will now be ignored so that the AI doesn't see a blank line where the comment was. For example, consider the following message: ``` Hello <|This is a comment|> World ``` The AI will now see this: ``` Hello World ``` instead of this: ``` Hello World ```
This commit is contained in:
parent
a51f88aeb3
commit
624cfbd5a4
@ -123,7 +123,7 @@ class vars:
|
||||
regex_sl = re.compile(r'\n*(?<=.) *\n(.|\n)*') # Pattern for limiting the output to a single line
|
||||
acregex_ai = re.compile(r'\n* *>(.|\n)*') # Pattern for matching adventure actions from the AI so we can remove them
|
||||
acregex_ui = re.compile(r'^ *(>.*)$', re.MULTILINE) # Pattern for matching actions in the HTML-escaped story so we can apply colouring, etc (make sure to encase part to format in parentheses)
|
||||
comregex_ai = re.compile(r'<\|(?:.|\n)*?\|>') # Pattern for matching comments to remove them before sending them to the AI
|
||||
comregex_ai = re.compile(r'(?:\n<\|(?:.|\n)*?\|>(?=\n|$))|(?:(?<=\n|^)<\|(?:.|\n)*?\|>\n)|(?:<\|(?:.|\n)*?\|>)') # Pattern for matching comments to remove them before sending them to the AI
|
||||
comregex_ui = re.compile(r'(<\|(?:.|\n)*?\|>)') # Pattern for matching comments in the editor
|
||||
actionmode = 1
|
||||
adventure = False
|
||||
|
Loading…
x
Reference in New Issue
Block a user