Fix streaming japanese/chinese characters

Credits to matasonic for the idea
This commit is contained in:
oobabooga 2023-06-02 02:09:52 -03:00
parent 5216117a63
commit d183c7d29e

View file

@ -32,6 +32,9 @@ async def _handle_connection(websocket, path):
for a in generator:
to_send = a[skip_index:]
if to_send is None or chr(0xfffd) in to_send: # partial unicode character, don't send it yet.
continue
await websocket.send(json.dumps({
'event': 'text_stream',
'message_num': message_num,