mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2025-09-10 09:04:36 +00:00
fixed some incorrect protocol prefix for localhost
This commit is contained in:
parent
5f360f659c
commit
0f9968ef64
1 changed files with 13 additions and 10 deletions
23
koboldcpp.py
23
koboldcpp.py
|
@ -1612,7 +1612,7 @@ class ServerRequestHandler(http.server.SimpleHTTPRequestHandler):
|
|||
return True
|
||||
|
||||
def noscript_webui(self):
|
||||
global modelbusy
|
||||
global modelbusy, sslvalid
|
||||
import html
|
||||
import urllib.parse as urlparse
|
||||
parsed_url = urlparse.urlparse(self.path)
|
||||
|
@ -1636,9 +1636,10 @@ class ServerRequestHandler(http.server.SimpleHTTPRequestHandler):
|
|||
else:
|
||||
if max_length>512:
|
||||
max_length = 512
|
||||
epurl = f"http://localhost:{args.port}"
|
||||
httpsaffix = ("https" if sslvalid else "http")
|
||||
epurl = f"{httpsaffix}://localhost:{args.port}"
|
||||
if args.host!="":
|
||||
epurl = f"http://{args.host}:{args.port}"
|
||||
epurl = f"{httpsaffix}://{args.host}:{args.port}"
|
||||
gen_payload = {"prompt": prompt,"max_length": max_length,"temperature": temperature,"prompt": prompt,"top_k": top_k,"top_p": top_p,"rep_pen": rep_pen,"ban_eos_token":ban_eos_token}
|
||||
respjson = make_url_request(f'{epurl}/api/v1/generate', gen_payload)
|
||||
reply = html.escape(respjson["results"][0]["text"])
|
||||
|
@ -3376,10 +3377,11 @@ def make_url_request(url, data, method='POST', headers={}):
|
|||
def run_horde_worker(args, api_key, worker_name):
|
||||
from datetime import datetime
|
||||
import random
|
||||
global friendlymodelname, maxhordectx, maxhordelen, exitcounter, punishcounter, modelbusy, session_starttime
|
||||
epurl = f"http://localhost:{args.port}"
|
||||
global friendlymodelname, maxhordectx, maxhordelen, exitcounter, punishcounter, modelbusy, session_starttime, sslvalid
|
||||
httpsaffix = ("https" if sslvalid else "http")
|
||||
epurl = f"{httpsaffix}://localhost:{args.port}"
|
||||
if args.host!="":
|
||||
epurl = f"http://{args.host}:{args.port}"
|
||||
epurl = f"{httpsaffix}://{args.host}:{args.port}"
|
||||
|
||||
def submit_completed_generation(url, jobid, sessionstart, submit_dict):
|
||||
global exitcounter, punishcounter, session_kudos_earned, session_jobs, rewardcounter
|
||||
|
@ -3578,7 +3580,8 @@ def setuptunnel(has_sd):
|
|||
# It should work out of the box on both linux and windows
|
||||
try:
|
||||
import subprocess, re
|
||||
|
||||
global sslvalid
|
||||
httpsaffix = ("https" if sslvalid else "http")
|
||||
def run_tunnel():
|
||||
tunnelproc = None
|
||||
tunneloutput = ""
|
||||
|
@ -3586,13 +3589,13 @@ def setuptunnel(has_sd):
|
|||
time.sleep(0.2)
|
||||
if os.name == 'nt':
|
||||
print("Starting Cloudflare Tunnel for Windows, please wait...", flush=True)
|
||||
tunnelproc = subprocess.Popen(f"cloudflared.exe tunnel --url localhost:{args.port}", text=True, encoding='utf-8', shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE)
|
||||
tunnelproc = subprocess.Popen(f"cloudflared.exe tunnel --url {httpsaffix}://localhost:{args.port}", text=True, encoding='utf-8', shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE)
|
||||
elif sys.platform=="darwin":
|
||||
print("Starting Cloudflare Tunnel for MacOS, please wait...", flush=True)
|
||||
tunnelproc = subprocess.Popen(f"./cloudflared tunnel --url http://localhost:{args.port}", text=True, encoding='utf-8', shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE)
|
||||
tunnelproc = subprocess.Popen(f"./cloudflared tunnel --url {httpsaffix}://localhost:{args.port}", text=True, encoding='utf-8', shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE)
|
||||
else:
|
||||
print("Starting Cloudflare Tunnel for Linux, please wait...", flush=True)
|
||||
tunnelproc = subprocess.Popen(f"./cloudflared-linux-amd64 tunnel --url http://localhost:{args.port}", text=True, encoding='utf-8', shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE)
|
||||
tunnelproc = subprocess.Popen(f"./cloudflared-linux-amd64 tunnel --url {httpsaffix}://localhost:{args.port}", text=True, encoding='utf-8', shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE)
|
||||
time.sleep(10)
|
||||
def tunnel_reader():
|
||||
nonlocal tunnelproc,tunneloutput,tunnelrawlog
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue