fixed a sse stream issue

This commit is contained in:
Concedo
2026-03-03 21:30:28 +08:00
parent 7df210833e
commit 5d35193749
+3 -1
View File
@@ -70,7 +70,7 @@ dry_seq_break_max = 128
extra_images_max = 4 # for kontext/qwen img
# global vars
KcppVersion = "1.109"
KcppVersion = "1.109.1"
showdebug = True
kcpp_instance = None #global running instance
global_memory = {"tunnel_url": "", "restart_target":"", "input_to_exit":False, "load_complete":False, "restart_override_config_target":""}
@@ -3678,6 +3678,8 @@ class KcppServerRequestHandler(http.server.SimpleHTTPRequestHandler):
event_str = json.dumps({"token": tokenStr, "finish_reason":None})
await self.send_kai_sse_event(event_str)
tokenStr = "" # now the final finish reason can be sent alone
if delta and 'role' in delta:
delta = {'role':delta["role"],'content':''}
if api_format == 4: # if oai chat, set format to expected openai streaming response
if streamDone and ("logprobs" in genparams and genparams["logprobs"]): # this is a hack that sends an extra message containing ALL the logprobs
lastlogprobs = handle.last_logprobs()