Merge pull request #27 from UWUplus/escape

HTML escape user prompt.
This commit is contained in:
KoboldAI Dev 2021-06-02 15:40:17 -04:00 committed by GitHub
commit 6a9587b61d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -1091,7 +1091,7 @@ def applyoutputformatting(txt):
# Sends the current story content to the Game Screen
#==================================================================#
def refresh_story():
text_parts = ['<chunk n="0" id="n0">', vars.prompt, '</chunk>']
text_parts = ['<chunk n="0" id="n0">', html.escape(vars.prompt), '</chunk>']
for idx, item in enumerate(vars.actions, start=1):
text_parts.extend(('<chunk n="', str(idx), '" id="n', str(idx), '">', html.escape(item), '</chunk>'))
emit('from_server', {'cmd': 'updatescreen', 'data': formatforhtml(''.join(text_parts))})