update readme, fix web ui postprocess

This commit is contained in:
hiyouga
2023-07-22 14:29:22 +08:00
parent 21daf34f0c
commit 035c966d5c
6 changed files with 81 additions and 74 deletions

View File

@@ -90,6 +90,8 @@ class WebChatModel(ChatModel):
yield chatbot, new_history
def postprocess(self, response: str) -> str:
response = response.replace("<", "&lt;")
response = response.replace(">", "&gt;")
return response
blocks = response.split("```")
for i, block in enumerate(blocks):
if i % 2 == 0:
blocks[i] = block.replace("<", "&lt;").replace(">", "&gt;")
return "```".join(blocks)