abort has multiuser support via genkey too
This commit is contained in:
parent
84eeecb889
commit
2a36c85558
2 changed files with 15 additions and 2 deletions
|
@ -6704,6 +6704,9 @@ Current version: 77
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
},
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
"genkey": lastcheckgenkey
|
||||||
|
}),
|
||||||
})
|
})
|
||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
.then((data) => {})
|
.then((data) => {})
|
||||||
|
@ -7171,6 +7174,8 @@ Current version: 77
|
||||||
{
|
{
|
||||||
lastcheckgenkey = "KCPP"+(Math.floor(1000 + Math.random() * 9000)).toString();
|
lastcheckgenkey = "KCPP"+(Math.floor(1000 + Math.random() * 9000)).toString();
|
||||||
submit_payload.params.genkey = lastcheckgenkey;
|
submit_payload.params.genkey = lastcheckgenkey;
|
||||||
|
}else{
|
||||||
|
lastcheckgenkey = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
//v2 api specific fields
|
//v2 api specific fields
|
||||||
|
|
12
koboldcpp.py
12
koboldcpp.py
|
@ -661,7 +661,15 @@ class ServerRequestHandler(http.server.SimpleHTTPRequestHandler):
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.path.endswith('/api/extra/abort'):
|
if self.path.endswith('/api/extra/abort'):
|
||||||
if requestsinqueue==0:
|
multiuserkey = ""
|
||||||
|
try:
|
||||||
|
tempbody = json.loads(body)
|
||||||
|
multiuserkey = tempbody.get('genkey', "")
|
||||||
|
except ValueError as e:
|
||||||
|
multiuserkey = ""
|
||||||
|
pass
|
||||||
|
|
||||||
|
if (multiuserkey!="" and multiuserkey==currentusergenkey) or requestsinqueue==0:
|
||||||
ag = handle.abort_generate()
|
ag = handle.abort_generate()
|
||||||
time.sleep(0.3) #short delay before replying
|
time.sleep(0.3) #short delay before replying
|
||||||
self.send_response(200)
|
self.send_response(200)
|
||||||
|
@ -669,7 +677,7 @@ class ServerRequestHandler(http.server.SimpleHTTPRequestHandler):
|
||||||
self.wfile.write(json.dumps({"success": ("true" if ag else "false")}).encode())
|
self.wfile.write(json.dumps({"success": ("true" if ag else "false")}).encode())
|
||||||
print("\nGeneration Aborted")
|
print("\nGeneration Aborted")
|
||||||
else:
|
else:
|
||||||
self.wfile.write(json.dumps({"success": "false"}).encode())
|
self.wfile.write(json.dumps({"success": "false"}).encode())
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.path.endswith('/api/extra/generate/check'):
|
if self.path.endswith('/api/extra/generate/check'):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue