@@ -12,7 +12,7 @@ Current version indicated by LITEVER below.
1212-->
1313
1414<script>
15- const LITEVER = 243 ;
15+ const LITEVER = 244 ;
1616 const urlParams = new URLSearchParams(window.location.search);
1717 var localflag = urlParams.get('local'); //this will be replaced automatically in embedded kcpp
1818 const STORAGE_PREFIX = (localflag?"e_":"")+"kaihordewebui_";
@@ -3337,6 +3337,7 @@ Current version indicated by LITEVER below.
33373337 entersubmit: true, //enter sends the prompt
33383338 darkmode: true,
33393339 raw_instruct_tags: false, //experimental flag
3340+ show_endpoint_selector: false,
33403341
33413342 //section migrated from story itself
33423343 extrastopseq: "",
@@ -4344,7 +4345,10 @@ Current version indicated by LITEVER below.
43444345 if (maxIndex === lastA) return get_instructstartplaceholder_end();
43454346 if (maxIndex === lastB) return get_instructendplaceholder_end();
43464347 return instructsysplaceholder_end;
4347-
4348+ }
4349+ function get_current_timestamp()
4350+ {
4351+ return "["+(new Date().toLocaleTimeString([], {year: 'numeric', month: 'numeric', day: 'numeric', hour: '2-digit', minute: '2-digit'}))+"]";
43484352 }
43494353
43504354 function remove_all_instruct_tags(text)
@@ -5625,7 +5629,7 @@ Current version indicated by LITEVER below.
56255629 {
56265630 continue;
56275631 }
5628- if(synchro_pending_stream.includes(cur))
5632+ if(synchro_pending_stream.includes(cur) && synchro_pending_stream.trim().indexOf(cur) > 1) //don't trigger early stopping if the match is very early
56295633 {
56305634 cached_stop_seq = [];
56315635 let need_clean_output = (synchro_pending_stream!="" && localsettings.opmode==1 && gametext_arr.length>0 && document.getElementById("useoaichatcompl").checked);
@@ -6091,6 +6095,7 @@ Current version indicated by LITEVER below.
60916095 //purge url params
60926096 window.history.replaceState(null, null, window.location.pathname);
60936097 } else if (foundScenario && foundScenario != "") {
6098+ avoidwelcome = true;
60946099 display_scenarios();
60956100 document.getElementById("scenariosearch").value = escape_html(foundScenario);
60966101 scenario_search();
@@ -6102,6 +6107,7 @@ Current version indicated by LITEVER below.
61026107 //purge url params
61036108 window.history.replaceState(null, null, window.location.pathname);
61046109 } else if (foundScenarioSource) {
6110+ avoidwelcome = true;
61056111 console.log(foundScenarioSource, urlParams.get(foundScenarioSource.urlParam));
61066112 display_scenarios();
61076113 import_scenario(foundScenarioSource, urlParams.get(foundScenarioSource.urlParam));
@@ -6110,6 +6116,7 @@ Current version indicated by LITEVER below.
61106116 }
61116117 else if (foundQuery && foundQuery != "")
61126118 {
6119+ avoidwelcome = true;
61136120 window.history.replaceState(null, null, window.location.pathname);
61146121 if (localsettings.persist_session && !safe_to_overwrite()) {
61156122 msgboxYesNo("You already have an existing persistent story. Do you want to overwrite it?","Overwrite Story Warning",()=>{
@@ -6127,6 +6134,10 @@ Current version indicated by LITEVER below.
61276134 prepare_submit_generation();
61286135 }
61296136 }
6137+ if(avoidwelcome)
6138+ {
6139+ close_welcome_panel(false);
6140+ }
61306141 }
61316142
61326143
@@ -11800,6 +11811,7 @@ Current version indicated by LITEVER below.
1180011811 document.getElementById("instruct_systag_end").value = localsettings.instruct_systag_end;
1180111812 document.getElementById("instruct_endtag_end").value = localsettings.instruct_endtag_end;
1180211813 document.getElementById("raw_instruct_tags").checked = localsettings.raw_instruct_tags;
11814+ document.getElementById("show_endpoint_selector").checked = localsettings.show_endpoint_selector;
1180311815 document.getElementById("min_p").value = localsettings.min_p;
1180411816 document.getElementById("dynatemp_range").value = localsettings.dynatemp_range;
1180511817 document.getElementById("dynatemp_exponent").value = localsettings.dynatemp_exponent;
@@ -12324,6 +12336,7 @@ Current version indicated by LITEVER below.
1232412336 localsettings.eos_ban_mode = document.getElementById("eos_ban_mode").value;
1232512337 localsettings.persist_session = (document.getElementById("persist_session").checked ? true : false);
1232612338 localsettings.raw_instruct_tags = (document.getElementById("raw_instruct_tags").checked ? true : false);
12339+ localsettings.show_endpoint_selector = (document.getElementById("show_endpoint_selector").checked ? true : false);
1232712340 if(document.getElementById("opmode").value==1)
1232812341 {
1232912342 localsettings.gui_type_story = document.getElementById("gui_type").value;
@@ -13275,6 +13288,7 @@ Current version indicated by LITEVER below.
1327513288 function restart_new_game(save = true, keep_memory = false) {
1327613289 xtts_is_playing = false;
1327713290 idle_timer = 0;
13291+ idle_triggered_counter = 0;
1327813292 gametext_arr = [];
1327913293 redo_arr = [];
1328013294 last_request_str = "No Requests Available";
@@ -14580,7 +14594,7 @@ Current version indicated by LITEVER below.
1458014594 }
1458114595 if(localsettings.inject_timestamps)
1458214596 {
14583- newgen = "["+(new Date().toLocaleTimeString([], {year: 'numeric', month: 'numeric', day: 'numeric', hour: '2-digit', minute: '2-digit'}))+"] " + newgen;
14597+ newgen = get_current_timestamp() + " " + newgen;
1458414598 }
1458514599
1458614600 //append instruction for instruct mode
@@ -14620,7 +14634,7 @@ Current version indicated by LITEVER below.
1462014634 let injecttime = "";
1462114635 if(localsettings.inject_timestamps)
1462214636 {
14623- injecttime = " ["+(new Date().toLocaleTimeString([], {year: 'numeric', month: 'numeric', day: 'numeric', hour: '2-digit', minute: '2-digit'}))+"]" ;
14637+ injecttime = " " + get_current_timestamp() ;
1462414638 }
1462514639 newgen = "\n" + get_my_multiplayer_chatname() + ":"+ injecttime +" "+ newgen + "";
1462614640 return newgen;
@@ -14899,7 +14913,7 @@ Current version indicated by LITEVER below.
1489914913 pending_context_preinjection = "\n"+co + ":";
1490014914 if(localsettings.inject_timestamps)
1490114915 {
14902- pending_context_preinjection += " ["+(new Date().toLocaleTimeString([], {year: 'numeric', month: 'numeric', day: 'numeric', hour: '2-digit', minute: '2-digit'}))+"]" ;
14916+ pending_context_preinjection += " " + get_current_timestamp() ;
1490314917 }
1490414918 }
1490514919 else
@@ -14939,7 +14953,7 @@ Current version indicated by LITEVER below.
1493914953 let endmatcher = get_instructendplaceholder();
1494014954 if (truncated_context.toLowerCase().trim().endsWith(endmatcher.toLowerCase().trim())) {
1494114955 if (localsettings.inject_timestamps) {
14942- pending_context_preinjection += "[" + (new Date().toLocaleTimeString([], { year: 'numeric', month: 'numeric', day: 'numeric', hour: '2-digit', minute: '2-digit' })) + "]" ;
14956+ pending_context_preinjection += get_current_timestamp() ;
1494314957 }
1494414958 if (localsettings.inject_chatnames_instruct && localsettings.chatopponent!="") {
1494514959 if (localsettings.inject_timestamps) {
@@ -15572,7 +15586,7 @@ Current version indicated by LITEVER below.
1557215586 let prompt = submit_payload.prompt;
1557315587 submit_payload = submit_payload.params;
1557415588 submit_payload.prompt = prompt;
15575- let showlog = (document.getElementById("remoteconsolelog").checked ? true : false) ;
15589+ let showlog = false;
1557615590 submit_payload.quiet = !showlog;
1557715591
1557815592 //for vesion 1.2.2 and later, send stopper tokens for chat and instruct
@@ -16313,8 +16327,11 @@ Current version indicated by LITEVER below.
1631316327 case "DPM++ 2M":
1631416328 usedsampler = "k_dpmpp_2m";
1631516329 break;
16330+ case "DDIM":
16331+ usedsampler = "DDIM";
16332+ break;
1631616333 default:
16317- usedsampler = "k_euler_a ";
16334+ usedsampler = "k_euler ";
1631816335 break;
1631916336 }
1632016337
@@ -17529,7 +17546,7 @@ Current version indicated by LITEVER below.
1752917546
1753017547 if(localsettings.inject_timestamps)
1753117548 {
17532- pending_context_preinjection += "["+(new Date().toLocaleTimeString([], {year: 'numeric', month: 'numeric', day: 'numeric', hour: '2-digit', minute: '2-digit'}))+"]" ;
17549+ pending_context_preinjection += get_current_timestamp() ;
1753317550 }
1753417551 }
1753517552 }
@@ -18891,7 +18908,7 @@ Current version indicated by LITEVER below.
1889118908 }
1889218909
1889318910 //console.log("FT:" + fulltxt);
18894- if(fulltxt== "" && gametext_arr.length == 0 && synchro_pending_stream=="" && pending_response_id!="")
18911+ if(fulltxt == "" && gametext_arr.length == 0 && synchro_pending_stream=="" && pending_response_id!="")
1889518912 {
1889618913 fulltxt = "Generating...";
1889718914 }
@@ -18924,7 +18941,15 @@ Current version indicated by LITEVER below.
1892418941 }else{
1892518942 document.getElementById("topbtn_customendpt").classList.remove("hidden");
1892618943 }
18927- document.getElementById("topbtn_ai").classList.add("hidden");
18944+ if(localsettings.show_endpoint_selector)
18945+ {
18946+ document.getElementById("topbtn_ai").classList.remove("hidden");
18947+ }
18948+ else
18949+ {
18950+ document.getElementById("topbtn_ai").classList.add("hidden");
18951+ }
18952+
1892818953 document.getElementById("topbtn_newgame").classList.remove("hidden");
1892918954 document.getElementById("topbtn_save_load").classList.remove("hidden");
1893018955 document.getElementById("topbtn_scenarios").classList.add("hidden");
@@ -18933,7 +18958,7 @@ Current version indicated by LITEVER below.
1893318958 document.getElementById("topbtn_reconnect").classList.add("hidden");
1893418959 document.getElementById("topbtn_customendpt").classList.add("hidden");
1893518960
18936- if(localflag)
18961+ if(localflag && !localsettings.show_endpoint_selector )
1893718962 {
1893818963 document.getElementById("topbtn_ai").classList.add("hidden");
1893918964 }else{
@@ -19028,7 +19053,13 @@ Current version indicated by LITEVER below.
1902819053 }
1902919054 else if (!inEditMode && isAestheticUiStyle)
1903019055 {
19031- let textToRender = (gametext_arr.length == 0 ? document.getElementById("gametext").innerHTML : concat_gametext(false, "", "", "", true));
19056+ let textToRender = "";
19057+ let prepToGen = (gametext_arr.length == 0 && synchro_pending_stream == "" && pending_response_id != "");
19058+ if (gametext_arr.length == 0 && (prepToGen || pending_response_id == "")) {
19059+ textToRender = document.getElementById("gametext").innerHTML;
19060+ } else {
19061+ textToRender = concat_gametext(false, "", "", "", true);
19062+ }
1903219063 textToRender = apply_display_only_regex(textToRender);
1903319064 textToRender = replace_placeholders(textToRender,true);
1903419065
@@ -20871,7 +20902,7 @@ Current version indicated by LITEVER below.
2087120902
2087220903 if(localsettings.inject_timestamps)
2087320904 {
20874- userinput = "["+(new Date().toLocaleTimeString([], {year: 'numeric', month: 'numeric', day: 'numeric', hour: '2-digit', minute: '2-digit'}))+"] " + userinput;
20905+ userinput = get_current_timestamp() + " " + userinput;
2087520906 }
2087620907
2087720908 //append instruction for instruct mode
@@ -22909,6 +22940,7 @@ Current version indicated by LITEVER below.
2290922940 <option value="Heun">Heun</option>
2291022941 <option value="DPM2">DPM2</option>
2291122942 <option value="LCM">LCM</option>
22943+ <option value="DDIM">DDIM</option>
2291222944 <option value="DPM++ 2M">DPM++ 2M</option>
2291322945 </select>
2291422946 </div>
@@ -23248,6 +23280,11 @@ Current version indicated by LITEVER below.
2324823280 class="helptext">Does not insert instruct placeholders, only uses raw tags</span></span></div>
2324923281 <input title="Raw Instruct Tags" type="checkbox" id="raw_instruct_tags" style="margin:0px 0px 0px 0px;">
2325023282 </div>
23283+ <div class="settinglabel">
23284+ <div class="justifyleft settingsmall">ShowEndpointSelector <span class="helpicon">?<span
23285+ class="helptext">Allows you to change the connected custom endpoint at runtime even in local mode.</span></span></div>
23286+ <input title="Show Local Endpoint Selector" type="checkbox" id="show_endpoint_selector" style="margin:0px 0px 0px 0px;">
23287+ </div>
2325123288 </div>
2325223289
2325323290 <div class="settingitem wide">
@@ -23651,8 +23688,6 @@ Current version indicated by LITEVER below.
2365123688 <input class="form-control" title="Enter KoboldCpp Custom Endpoint" id="customkoboldendpoint" placeholder="https://sample-remote-address.trycloudflare.com" value="">
2365223689 <input class="form-control" title="Enter KoboldCpp API Key" type="password" id="customkoboldkey" placeholder="KoboldAI API Key (Optional)" value="" onfocus="focus_api_keys()" onblur="blur_api_keys()"><br>
2365323690 <div class="borderbox flex flex-push-right">
23654- <input type="checkbox" id="remoteconsolelog">
23655- <div class="box-label" title="Will display outputs to the remote endpoint's console logs, useful for debugging.">Show Console Logging</div>
2365623691 </div>
2365723692 </div>
2365823693 <div id="oaicustom" class="menutext hidden">
0 commit comments