update readme, fix web ui postprocess

Former-commit-id: ba51ab3379100108f7b52a3c2444ccdd99e8a6ef
This commit is contained in:
hiyouga
2023-07-22 14:29:22 +08:00
parent dc2e801077
commit a707f5b502
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)