mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2026-09-02 02:51:17 +02:00
hack to fix bad unicode fragments corrupting streamed output
This commit is contained in:
+2
-1
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user