add idle field and up ver

This commit is contained in:
Concedo 2023-08-09 12:42:59 +08:00
parent 4b8a354895
commit 19cf2a8663

View file

@ -303,7 +303,7 @@ maxhordectx = 1024
maxhordelen = 256
modelbusy = threading.Lock()
defaultport = 5001
KcppVersion = "1.39.2"
KcppVersion = "1.40"
showdebug = True
showsamplerwarning = True
showmaxctxwarning = True
@ -495,7 +495,7 @@ class ServerRequestHandler(http.server.SimpleHTTPRequestHandler):
laste = handle.get_last_eval_time()
lastc = handle.get_last_token_count()
stopreason = handle.get_last_stop_reason()
response_body = (json.dumps({"last_process":lastp,"last_eval":laste,"last_token_count":lastc, "stop_reason":stopreason}).encode())
response_body = (json.dumps({"last_process":lastp,"last_eval":laste,"last_token_count":lastc, "stop_reason":stopreason, "idle":(0 if modelbusy.locked() else 1)}).encode())
if response_body is None:
self.send_response(404)