fix horde worker host and client agent
This commit is contained in:
parent
48c27a9ce1
commit
66e4b5141e
1 changed files with 6 additions and 3 deletions
|
@ -1358,11 +1358,14 @@ def show_old_gui():
|
|||
def run_horde_worker(args, api_key, worker_name):
|
||||
import urllib.request
|
||||
global friendlymodelname, maxhordectx, maxhordelen, exitcounter, modelbusy
|
||||
epurl = f"http://localhost:{args.port}"
|
||||
if args.host!="":
|
||||
epurl = f"http://{args.host}:{args.port}"
|
||||
|
||||
def make_url_request(url, data, method='POST'):
|
||||
try:
|
||||
request = None
|
||||
headers = {"apikey": api_key,'User-Agent':'KoboldCpp Embedded Worker v1'}
|
||||
headers = {"apikey": api_key,'User-Agent':'KoboldCpp Embedded Worker v1','Client-Agent':'KoboldCppEmbedWorker:1'}
|
||||
if method=='POST':
|
||||
json_payload = json.dumps(data).encode('utf-8')
|
||||
request = urllib.request.Request(url, data=json_payload, headers=headers, method=method)
|
||||
|
@ -1394,7 +1397,7 @@ def run_horde_worker(args, api_key, worker_name):
|
|||
cluster = "https://horde.koboldai.net"
|
||||
while exitcounter < 10:
|
||||
time.sleep(2)
|
||||
readygo = make_url_request(f'http://localhost:{args.port}/api/v1/info/version', None,'GET')
|
||||
readygo = make_url_request(f'{epurl}/api/v1/info/version', None,'GET')
|
||||
if readygo:
|
||||
print("Embedded Horde Worker is started.")
|
||||
break
|
||||
|
@ -1439,7 +1442,7 @@ def run_horde_worker(args, api_key, worker_name):
|
|||
#do gen
|
||||
while exitcounter < 10:
|
||||
if not modelbusy.locked():
|
||||
current_generation = make_url_request(f'http://localhost:{args.port}/api/v1/generate', current_payload)
|
||||
current_generation = make_url_request(f'{epurl}/api/v1/generate', current_payload)
|
||||
if current_generation:
|
||||
break
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue