use loopback ip instead of localhost

This commit is contained in:
Concedo 2024-08-03 00:41:32 +08:00
parent 6bf78967f9
commit 9a0976761e
2 changed files with 26 additions and 25 deletions

View file

@ -12,7 +12,7 @@ Current version indicated by LITEVER below.
-->
<script>
const LITEVER = 160;
const LITEVER = 161;
const urlParams = new URLSearchParams(window.location.search);
const localflag = true;
const STORAGE_PREFIX = (localflag?"e_":"")+"kaihordewebui_";
@ -509,9 +509,9 @@ Current version indicated by LITEVER below.
}
}
.nspopup.flexsizevsmall {
width: 330px;
width: 380px;
}
@media (max-width: 340px) {
@media (max-width: 400px) {
.nspopup.flexsizevsmall {
width: 100%;
}
@ -4180,7 +4180,7 @@ Current version indicated by LITEVER below.
var last_token_budget = ""; //to display token limits
var last_known_filename = "saved_story.json";
var localmodeport = 5001;
var localmodehost = "localhost";
var localmodehost = "127.0.0.1";
var localprotocol = "http://";
var sublocalpathname = "";
var reattempt_local_port80 = false;
@ -4300,7 +4300,7 @@ Current version indicated by LITEVER below.
entersubmit: true, //enter sends the prompt
darkmode: true,
max_context_length: (localflag?2048:1600),
max_context_length: (localflag?4096:1800),
max_length: 200,
auto_ctxlen: true,
auto_genamt: true,
@ -4353,7 +4353,7 @@ Current version indicated by LITEVER below.
rep_pen_slope: defaultsettings.rep_pen_slope,
sampler_order: defaultsettings.sampler_order
},
{"preset":"Simple Logical","description":"A very predictable preset with low randomness.","temp":0.25,"dynatemp_range":0.0,"dynatemp_exponent":1.0,"smoothing_factor":0.0,"genamt":200,"top_k":100,"top_p":0.6,"min_p":0.0,"presence_penalty":0.0,"top_a":0,"typical":1,"tfs":1,"rep_pen":1.01,"rep_pen_range":320,"rep_pen_slope":0.7,"sampler_order":[6,0,1,3,4,2,5]},{"preset":"Simple Balanced","description":"A good balanced preset with medium randomness.","temp":0.7,"dynatemp_range":0.0,"dynatemp_exponent":1.0,"smoothing_factor":0.0,"genamt":200,"top_k":100,"top_p":0.92,"min_p":0.0,"presence_penalty":0.0,"top_a":0,"typical":1,"tfs":1,"rep_pen":1.07,"rep_pen_range":320,"rep_pen_slope":0.7,"sampler_order":[6,0,1,3,4,2,5]},{"preset":"Simple Creative","description":"A wild and unpredictable preset with higher randomness.","temp":1.0,"dynatemp_range":0.0,"dynatemp_exponent":1.0,"smoothing_factor":0.0,"genamt":200,"top_k":100,"top_p":0.98,"min_p":0.0,"presence_penalty":0.0,"top_a":0,"typical":1,"tfs":1,"rep_pen":1.15,"rep_pen_range":320,"rep_pen_slope":0.7,"sampler_order":[6,0,1,3,4,2,5]},{"preset":"Basic Min-P","description":"A good default for Min-P, only works on backends with min-p.","temp":1.25,"dynatemp_range":0.0,"dynatemp_exponent":1.0,"smoothing_factor":0.0,"genamt":200,"top_k":0,"top_p":1,"min_p":0.1,"presence_penalty":0.0,"top_a":0,"typical":1,"tfs":1,"rep_pen":1.03,"rep_pen_range":320,"rep_pen_slope":0.7,"sampler_order":[6,5,0,1,3,4,2]},{"preset":"Basic DynaTemp","description":"A good default for DynaTemp, only works on backends with it.","temp":1.25,"dynatemp_range":0.75,"dynatemp_exponent":1.0,"smoothing_factor":0.0,"genamt":200,"top_k":0,"top_p":1,"min_p":0.05,"presence_penalty":0.0,"top_a":0,"typical":1,"tfs":1,"rep_pen":1.03,"rep_pen_range":320,"rep_pen_slope":0.7,"sampler_order":[6,5,0,1,3,4,2]},{"preset":"Basic SmoothSample","description":"A good default for Smooth Sampling, only works on backends with it.","temp":1.0,"dynatemp_range":0.0,"dynatemp_exponent":1.0,"smoothing_factor":0.25,"genamt":200,"top_k":0,"top_p":1,"min_p":0.05,"presence_penalty":0.0,"top_a":0,"typical":1,"tfs":1,"rep_pen":1.03,"rep_pen_range":320,"rep_pen_slope":0.7,"sampler_order":[6,5,0,1,3,4,2]},{"preset":"Basic SillyTavern","description":"Similar to default preset used in SillyTavern.","temp":0.7,"dynatemp_range":0.0,"dynatemp_exponent":1.0,"smoothing_factor":0.0,"genamt":200,"top_k":40,"top_p":0.6,"min_p":0,"presence_penalty":0.0,"top_a":0,"typical":1,"tfs":1.0,"rep_pen":1.18,"rep_pen_range":1024,"rep_pen_slope":0.8,"sampler_order":[6,0,1,3,4,2,5]},{"preset":"CoherentCreativity (Legacy)","description":"Legacy preset. A good balance between coherence, creativity, and quality of prose.","genamt":200,"rep_pen":1.2,"rep_pen_range":2048,"rep_pen_slope":0,"sampler_order":[6,5,0,2,3,1,4],"temp":0.5,"dynatemp_range":0.0,"dynatemp_exponent":1.0,"smoothing_factor":0.0,"tfs":0.99,"top_a":0,"top_k":0,"top_p":1,"min_p":0.0,"presence_penalty":0.0,"typical":1},{"preset":"Godlike (Legacy)","description":"Legacy preset. Makes AI give a descriptive and sensual output.","temp":0.7,"dynatemp_range":0.0,"dynatemp_exponent":1.0,"smoothing_factor":0.0,"genamt":200,"top_k":0,"top_p":0.5,"min_p":0.0,"presence_penalty":0.0,"top_a":0.75,"typical":0.19,"tfs":0.97,"rep_pen":1.1,"rep_pen_range":1024,"rep_pen_slope":0.7,"sampler_order":[6,5,4,3,2,1,0]},{"preset":"LiminalDrift (Legacy)","description":"Legacy preset. Sometimes surreal situations arise based on information already present in the story.","temp":0.66,"dynatemp_range":0.0,"dynatemp_exponent":1.0,"smoothing_factor":0.0,"genamt":200,"top_k":0,"top_p":1,"min_p":0.0,"presence_penalty":0.0,"top_a":0.96,"typical":0.6,"tfs":1,"rep_pen":1.1,"rep_pen_range":1024,"rep_pen_slope":0.7,"sampler_order":[6,4,5,1,0,2,3]}
{"preset":"Simple Logical","description":"A very predictable preset with low randomness.","temp":0.25,"dynatemp_range":0.0,"dynatemp_exponent":1.0,"smoothing_factor":0.0,"genamt":200,"top_k":100,"top_p":0.6,"min_p":0.0,"presence_penalty":0.0,"top_a":0,"typical":1,"tfs":1,"rep_pen":1.01,"rep_pen_range":320,"rep_pen_slope":0.7,"sampler_order":[6,0,1,3,4,2,5]},{"preset":"Simple Balanced","description":"A good balanced preset with medium randomness.","temp":0.7,"dynatemp_range":0.0,"dynatemp_exponent":1.0,"smoothing_factor":0.0,"genamt":200,"top_k":100,"top_p":0.92,"min_p":0.0,"presence_penalty":0.0,"top_a":0,"typical":1,"tfs":1,"rep_pen":1.07,"rep_pen_range":320,"rep_pen_slope":0.7,"sampler_order":[6,0,1,3,4,2,5]},{"preset":"Simple Creative","description":"A wild and unpredictable preset with higher randomness.","temp":1.0,"dynatemp_range":0.0,"dynatemp_exponent":1.0,"smoothing_factor":0.0,"genamt":200,"top_k":100,"top_p":0.98,"min_p":0.0,"presence_penalty":0.0,"top_a":0,"typical":1,"tfs":1,"rep_pen":1.15,"rep_pen_range":320,"rep_pen_slope":0.7,"sampler_order":[6,0,1,3,4,2,5]},{"preset":"Basic Min-P","description":"A good default for Min-P, only works on backends with min-p.","temp":1.25,"dynatemp_range":0.0,"dynatemp_exponent":1.0,"smoothing_factor":0.0,"genamt":200,"top_k":0,"top_p":1,"min_p":0.1,"presence_penalty":0.0,"top_a":0,"typical":1,"tfs":1,"rep_pen":1.03,"rep_pen_range":320,"rep_pen_slope":0.7,"sampler_order":[6,5,0,1,3,4,2]},{"preset":"Basic DynaTemp","description":"A good default for DynaTemp, only works on backends with it.","temp":1.25,"dynatemp_range":0.75,"dynatemp_exponent":1.0,"smoothing_factor":0.0,"genamt":200,"top_k":0,"top_p":1,"min_p":0.05,"presence_penalty":0.0,"top_a":0,"typical":1,"tfs":1,"rep_pen":1.03,"rep_pen_range":320,"rep_pen_slope":0.7,"sampler_order":[6,5,0,1,3,4,2]},{"preset":"Basic SmoothSample","description":"A good default for Smooth Sampling, only works on backends with it.","temp":1.0,"dynatemp_range":0.0,"dynatemp_exponent":1.0,"smoothing_factor":0.25,"genamt":200,"top_k":0,"top_p":1,"min_p":0.05,"presence_penalty":0.0,"top_a":0,"typical":1,"tfs":1,"rep_pen":1.03,"rep_pen_range":320,"rep_pen_slope":0.7,"sampler_order":[6,5,0,1,3,4,2]},{"preset":"Basic SillyTavern","description":"Similar to default preset used in SillyTavern.","temp":0.7,"dynatemp_range":0.0,"dynatemp_exponent":1.0,"smoothing_factor":0.0,"genamt":200,"top_k":40,"top_p":0.6,"min_p":0,"presence_penalty":0.0,"top_a":0,"typical":1,"tfs":1.0,"rep_pen":1.18,"rep_pen_range":1024,"rep_pen_slope":0.8,"sampler_order":[6,0,1,3,4,2,5]},{"preset":"CoherentCreativity (Legacy)","description":"Legacy preset. A good balance between coherence, creativity, and quality of prose.","genamt":200,"rep_pen":1.2,"rep_pen_range":320,"rep_pen_slope":0,"sampler_order":[6,5,0,2,3,1,4],"temp":0.5,"dynatemp_range":0.0,"dynatemp_exponent":1.0,"smoothing_factor":0.0,"tfs":0.99,"top_a":0,"top_k":0,"top_p":1,"min_p":0.0,"presence_penalty":0.0,"typical":1},{"preset":"Godlike (Legacy)","description":"Legacy preset. Makes AI give a descriptive and sensual output.","temp":0.7,"dynatemp_range":0.0,"dynatemp_exponent":1.0,"smoothing_factor":0.0,"genamt":200,"top_k":0,"top_p":0.5,"min_p":0.0,"presence_penalty":0.0,"top_a":0.75,"typical":0.19,"tfs":0.97,"rep_pen":1.1,"rep_pen_range":1024,"rep_pen_slope":0.7,"sampler_order":[6,5,4,3,2,1,0]},{"preset":"LiminalDrift (Legacy)","description":"Legacy preset. Sometimes surreal situations arise based on information already present in the story.","temp":0.66,"dynatemp_range":0.0,"dynatemp_exponent":1.0,"smoothing_factor":0.0,"genamt":200,"top_k":0,"top_p":1,"min_p":0.0,"presence_penalty":0.0,"top_a":0.96,"typical":0.6,"tfs":1,"rep_pen":1.1,"rep_pen_range":1024,"rep_pen_slope":0.7,"sampler_order":[6,4,5,1,0,2,3]}
];
const instructpresets = [
@ -8500,7 +8500,7 @@ Current version indicated by LITEVER below.
document.getElementById("max_context_length_slide").max = ep_maxctx;
document.getElementById("max_context_length_slide_label").innerText = ep_maxctx;
}
if(localflag && localsettings.max_context_length==2048 && ep_maxctx>2048)
if(localflag && localsettings.max_context_length==4096 && ep_maxctx>4096)
{
localsettings.max_context_length = ep_maxctx;
}
@ -17407,7 +17407,7 @@ Current version indicated by LITEVER below.
<div class="popupcontainer flex hidden" id="newgamecontainer">
<div class="popupbg flex"></div>
<div class="nspopup fixsize">
<div class="nspopup flexsizevsmall">
<div class="popuptitlebar">
<div class="popuptitletext">Really Start A New Story?</div>
</div>
@ -17436,7 +17436,7 @@ Current version indicated by LITEVER below.
<div class="popupcontainer flex hidden" id="advancedloadfile">
<div class="popupbg flex"></div>
<div class="nspopup fixsize">
<div class="nspopup flexsizevsmall">
<div class="popuptitlebar">
<div class="popuptitletext">Advanced Load File</div>
</div>
@ -17672,11 +17672,11 @@ Current version indicated by LITEVER below.
<input title="Context Size" inputmode="numeric" class="justifyright flex-push-right settingsmall widerinput" id="max_context_length" oninput="
document.getElementById('max_context_length_slide').value = this.value;">
</div>
<div><input title="Context Size Slider" type="range" class="form-range airange" min="512" max="2048" step="8" id="max_context_length_slide" oninput="
<div><input title="Context Size Slider" type="range" class="form-range airange" min="512" max="4096" step="8" id="max_context_length_slide" oninput="
document.getElementById('max_context_length').value = this.value;"></div>
<div class="settingminmax">
<div class="justifyleft">512</div>
<div class="justifyright" id="max_context_length_slide_label">2048</div>
<div class="justifyright" id="max_context_length_slide_label">4096</div>
</div>
<div id="auto_ctxlen_panel" class="settinglabel">
<div class="justifyleft settingsmall" title="Automatically lowers settings if incompatible with existing workers">Auto-Adjust Limits </div>
@ -18303,6 +18303,7 @@ Current version indicated by LITEVER below.
class="helptext">Controls how far back in the text to search for World Info Keys</span></span></div>
<select title="World Info Search Depth" style="height:16px;padding:0px;margin:0px 4px 0; width:90px;font-size:10px;" class="form-control" id="wi_searchdepth">
<option value="0">Full Context</option>
<option value="8192">Last 8192</option>
<option value="4096">Last 4096</option>
<option value="2048">Last 2048</option>
<option value="1024">Last 1024</option>
@ -18448,7 +18449,7 @@ Current version indicated by LITEVER below.
<div class="popupcontainer flex hidden" id="sharecontainer">
<div class="popupbg flex"></div>
<div class="nspopup fixsize higher">
<div class="nspopup flexsizevsmall higher">
<div class="popuptitlebar">
<div class="popuptitletext" id="sharecontainertitle">Share Story</div>
</div>
@ -18465,7 +18466,7 @@ Current version indicated by LITEVER below.
<div class="popupcontainer flex hidden" id="dynatempcontainer">
<div class="popupbg flex"></div>
<div class="nspopup fixsize">
<div class="nspopup flexsizevsmall">
<div class="popuptitlebar">
<div class="popuptitletext">Dynamic Temperature Wizard</div>
</div>
@ -18504,7 +18505,7 @@ Current version indicated by LITEVER below.
<div class="popupcontainer flex hidden" id="addimgcontainer">
<div class="popupbg flex"></div>
<div class="nspopup fixsize">
<div class="nspopup flexsizevsmall">
<div class="popuptitlebar">
<div class="popuptitletext">Add New Image</div>
</div>
@ -18536,7 +18537,7 @@ Current version indicated by LITEVER below.
<div class="popupcontainer flex hidden" id="pasteimgcontainer">
<div class="popupbg flex"></div>
<div class="nspopup fixsize">
<div class="nspopup flexsizevsmall">
<div class="popuptitlebar">
<div class="popuptitletext">Paste Image From Clipboard</div>
</div>
@ -18550,7 +18551,7 @@ Current version indicated by LITEVER below.
<div class="popupcontainer flex hidden" id="choosesharecontainer">
<div class="popupbg flex"></div>
<div class="nspopup fixsize">
<div class="nspopup flexsizevsmall">
<div class="popuptitlebar">
<div class="popuptitletext">Share Story Import / Export</div>
</div>
@ -18575,7 +18576,7 @@ Current version indicated by LITEVER below.
<div class="popupcontainer flex hidden" id="groupselectcontainer">
<div class="popupbg flex"></div>
<div class="nspopup fixsize">
<div class="nspopup flexsizevsmall">
<div class="popuptitlebar">
<div class="popuptitletext">Chat Selectors</div>
</div>
@ -18770,7 +18771,7 @@ Current version indicated by LITEVER below.
<div class="popupcontainer flex hidden" id="yesnocontainer">
<div class="popupbg flex"></div>
<div class="nspopup fixsize">
<div class="nspopup flexsizevsmall">
<div class="popuptitlebar">
<div class="popuptitletext" id="yesnocontainertitle"></div>
</div>

View file

@ -1571,7 +1571,7 @@ class ServerRequestHandler(http.server.SimpleHTTPRequestHandler):
else:
if max_length>512:
max_length = 512
epurl = f"http://localhost:{args.port}"
epurl = f"http://127.0.0.1:{args.port}"
if args.host!="":
epurl = f"http://{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}
@ -2021,7 +2021,7 @@ def is_port_in_use(portNum):
try:
import socket
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
return s.connect_ex(('localhost', portNum)) == 0
return s.connect_ex(('127.0.0.1', portNum)) == 0
except Exception as ex:
return True
@ -3266,7 +3266,7 @@ 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}"
epurl = f"http://127.0.0.1:{args.port}"
if args.host!="":
epurl = f"http://{args.host}:{args.port}"
@ -3475,13 +3475,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 127.0.0.1:{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 http://127.0.0.1:{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 http://127.0.0.1:{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
@ -4080,7 +4080,7 @@ def main(launch_args,start_server=True):
epurl = ""
httpsaffix = ("https" if sslvalid else "http")
if args.host=="":
epurl = f"{httpsaffix}://localhost:{args.port}"
epurl = f"{httpsaffix}://127.0.0.1:{args.port}"
else:
epurl = f"{httpsaffix}://{args.host}:{args.port}"
if not args.remotetunnel: