mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2025-09-10 17:14:36 +00:00
hack to fix bad unicode fragments corrupting streamed output
This commit is contained in:
parent
1df850c95c
commit
43c55bb7e2
1 changed files with 2 additions and 1 deletions
|
@ -1435,7 +1435,8 @@ class ServerRequestHandler(http.server.SimpleHTTPRequestHandler):
|
|||
newbyte = ctypes.string_at(token)
|
||||
incomplete_token_buffer += bytearray(newbyte)
|
||||
tokenSeg = incomplete_token_buffer.decode("UTF-8","ignore")
|
||||
if tokenSeg!="":
|
||||
badFragment = (tokenSeg==" " and len(incomplete_token_buffer)>1) #partial incomplete unicode
|
||||
if tokenSeg!="" and not badFragment:
|
||||
incomplete_token_buffer.clear()
|
||||
tokenStr += tokenSeg
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue