@@ -12,7 +12,7 @@ Current version indicated by LITEVER below.
1212-->
1313
1414<script id="init-config">
15- const LITEVER = 294 ;
15+ const LITEVER = 296 ;
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_";
@@ -999,6 +999,9 @@ Current version indicated by LITEVER below.
999999 .nspopup.moderate {
10001000 margin-top: 170px;
10011001 }
1002+ .nspopup.high {
1003+ margin-top: 150px;
1004+ }
10021005 .nspopup.higher {
10031006 margin-top: 120px;
10041007 }
@@ -1242,7 +1245,7 @@ Current version indicated by LITEVER below.
12421245
12431246 /* Scenario menu */
12441247 .scenariopopup {
1245- width: 600px ;
1248+ width: 660px ;
12461249 background-color: var(--theme_color_bg);
12471250 margin-top: 60px;
12481251 }
@@ -1274,14 +1277,14 @@ Current version indicated by LITEVER below.
12741277 }
12751278 .scenariogrid
12761279 {
1277- height: 240px ;
1280+ height: 246px ;
12781281 overflow-y: auto;
12791282 margin-top: 4px;
12801283 padding: 8px;
12811284 display: grid;
12821285 gap: 8px;
12831286 grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
1284- grid-auto-rows: 55px ;
1287+ grid-auto-rows: 50px ;
12851288 }
12861289 .scenariodesc
12871290 {
@@ -1293,13 +1296,13 @@ Current version indicated by LITEVER below.
12931296 }
12941297 .scenarioitem
12951298 {
1296- font-size: 14px ;
1299+ font-size: 13px ;
12971300 color: white;
12981301 font-weight: 500;
12991302 font-family: 'Segoe UI', Tahoma;
13001303 background-repeat: no-repeat;
1301- background-position: top 4px left 4px , center;
1302- background-size: 24px , 100%;
1304+ background-position: top 3px left 3px , center;
1305+ background-size: 16px , 100%;
13031306 padding: 2px 2px;
13041307 text-wrap: wrap;
13051308 }
@@ -3483,6 +3486,8 @@ Current version indicated by LITEVER below.
34833486 const default_gemini_stream_suffix = ":streamGenerateContent?alt=sse&key=";
34843487 const default_cohere_base = "https://api.cohere.ai/v1/chat";
34853488
3489+ const openrouter_credits_endpoint = "/credits";
3490+
34863491 const a1111_models_endpoint = "/sdapi/v1/sd-models";
34873492 const a1111_options_endpoint = "/sdapi/v1/options";
34883493 const a1111_txt2img_endpoint = "/sdapi/v1/txt2img";
@@ -7920,6 +7925,10 @@ Current version indicated by LITEVER below.
79207925 {
79217926 return (custom_kobold_endpoint!="" && koboldcpp_version && koboldcpp_version!="" && compare_version_str(koboldcpp_version, "1.90") >= 0 && koboldcpp_has_guidance);
79227927 }
7928+ function is_using_kcpp_with_lcppui()
7929+ {
7930+ return (custom_kobold_endpoint!="" && koboldcpp_version && koboldcpp_version!="" && compare_version_str(koboldcpp_version, "1.102") >= 0);
7931+ }
79237932 function is_using_web_lite()
79247933 {
79257934 return (window.location.hostname.includes("koboldai.net") || window.location.hostname.includes("lostruins.github.io"));
@@ -10314,11 +10323,13 @@ Current version indicated by LITEVER below.
1031410323 document.getElementById("quickstartcontainer").classList.remove("hidden");
1031510324
1031610325 let scenarios = ``;
10326+ scenarios += `<button type="button" name="" class="scenarioitem purple btn btn-primary" onclick="hide_popups();document.getElementById('loadfileinput').click()">Load Save File or Character Card</button>`;
10327+ scenarios += `<button type="button" name="" class="scenarioitem purple btn btn-primary" onclick="character_creator()">New Character Creator</button>`;
10328+
1031710329 for(let i=0;i<scenario_sources.length;++i) {
1031810330 scenarios += `<button type="button" name="" class="scenarioitem purple btn btn-primary" onclick="import_scenario(scenario_sources[${i}])">${scenario_sources[i].name}</button>`
1031910331 }
1032010332
10321- scenarios += `<button type="button" name="" class="scenarioitem purple btn btn-primary" onclick="character_creator()">New Character Creator</button>`;
1032210333 for(let i=0;i<scenario_db.length;++i)
1032310334 {
1032410335 let curr = scenario_db[i];
@@ -10835,6 +10846,10 @@ Current version indicated by LITEVER below.
1083510846 {
1083610847 window.open('./sdui','_blank');
1083710848 }
10849+ function go_to_lcppui()
10850+ {
10851+ window.open('./lcpp','_blank');
10852+ }
1083810853
1083910854 var pendinggrammar = "";
1084010855 function selectGrammar()
@@ -11592,6 +11607,42 @@ Current version indicated by LITEVER below.
1159211607 }
1159311608 }
1159411609 }
11610+ function fetch_openrouter_balance()
11611+ {
11612+ let desired_oai_key = document.getElementById("custom_oai_key").value.trim();
11613+
11614+ let oaiheaders = {};
11615+ if(desired_oai_key!="" && desired_oai_key!=dummy_api_key){
11616+ oaiheaders["Authorization"] = "Bearer " + desired_oai_key;
11617+ };
11618+
11619+ let fetchurl = default_openrouter_base + openrouter_credits_endpoint;
11620+
11621+ fetch(fetchurl, {
11622+ method: 'GET',
11623+ headers: oaiheaders,
11624+ referrerPolicy: 'no-referrer',
11625+ })
11626+ .then((response) => response.json())
11627+ .then((data) => {
11628+ console.log(data);
11629+ if(data.data)
11630+ {
11631+ msgbox(`Total Credits: $${data.data.total_credits.toFixed(2)}\nCredits Used: $${data.data.total_usage.toFixed(2)}\nBalance: $${(data.data.total_credits-data.data.total_usage).toFixed(2)}`,"OpenRouter Balances")
11632+ }
11633+ else
11634+ {
11635+ msgbox("Error fetching credit balance: " + JSON.stringify(data),"Error Encountered");
11636+ }
11637+ })
11638+ .catch(error => {
11639+ console.log("Error: " + error);
11640+ msgbox("Error fetching credit balance: " + error,"Error Encountered",false,false,()=>{
11641+ hide_msgbox();
11642+ });
11643+ });
11644+ }
11645+
1159511646 function customapi_dropdown(force_autotoggle_chatcompl = false)
1159611647 {
1159711648 let epchoice = document.getElementById("customapidropdown").value;
@@ -14122,6 +14173,15 @@ Current version indicated by LITEVER below.
1412214173 {
1412314174 document.getElementById("btn_open_stableui").classList.add("hidden");
1412414175 }
14176+
14177+ if(is_using_kcpp_with_lcppui())
14178+ {
14179+ document.getElementById("btn_open_lcppui").classList.remove("hidden");
14180+ }
14181+ else
14182+ {
14183+ document.getElementById("btn_open_lcppui").classList.add("hidden");
14184+ }
1412514185 }
1412614186
1412714187 function update_websearch_button_visibility()
@@ -14838,6 +14898,13 @@ Current version indicated by LITEVER below.
1483814898 mainmenu_untab(true);
1483914899 document.getElementById("keep_ai_selected").checked = true;
1484014900 document.getElementById("newgamecontainer").classList.remove("hidden");
14901+ if(localflag)
14902+ {
14903+ document.getElementById("keep_ai_selected_row").classList.add("hidden");
14904+ }else
14905+ {
14906+ document.getElementById("keep_ai_selected_row").classList.remove("hidden");
14907+ }
1484114908 }
1484214909
1484314910 function confirm_newgame() {
@@ -27492,9 +27559,9 @@ Current version indicated by LITEVER below.
2749227559 <div style="overflow: auto;">
2749327560 <div id="saveloadentries" class="menutext saveloadgrid">
2749427561 <div style="display:flex">
27495- <button type="button" style="font-size:12px; margin:2px;width:33%" name="localsave" class="btn btn-primary" onclick="hide_popups();save_file_button()">💾<br>Download File </button>
27496- <button type="button" style="font-size:12px; margin:2px;width:33%" name="localload" class="btn btn-primary" onclick="hide_popups();load_file_button()">📁<br>Open File</button>
27497- <button type="button" style="font-size:12px; margin:2px;width:34%" name="shareurl" class="btn btn-primary" onclick="hide_popups();share_story_button()">🌐<br>Share</button>
27562+ <button type="button" style="font-size:12px; margin:2px; padding-left:2px; padding-right:2px; width:33%" name="localsave" class="btn btn-primary" onclick="hide_popups();save_file_button()">💾<br>Download SaveFile </button>
27563+ <button type="button" style="font-size:12px; margin:2px; padding-left:2px; padding-right:2px; width:33%" name="localload" class="btn btn-primary" onclick="hide_popups();load_file_button()">📁<br>Open File</button>
27564+ <button type="button" style="font-size:12px; margin:2px; padding-left:2px; padding-right:2px; width:34%" name="shareurl" class="btn btn-primary" onclick="hide_popups();share_story_button()">🌐<br>Share</button>
2749827565 </div>
2749927566 <div style="margin-top:3px; text-align: center; align-self: center; width: 100%">
2750027567 <span style="font-weight:bold;text-decoration: underline;">Slot Storage Option</span>
@@ -27620,7 +27687,7 @@ Current version indicated by LITEVER below.
2762027687 </span>
2762127688 <span id="openrouterdesc" class="hidden">
2762227689 Entering your <a class="color_blueurl" target="_blank" href="https://openrouter.ai/settings/keys">OpenRouter API key</a> will allow you to use KoboldAI Lite with their API.<br><br>
27623- KoboldAI Lite takes no responsibility for your usage of this feature. Your API key is used directly with the OpenRouter API and is not transmitted to us.<br>Only Temperature, Top-P and Repetition Penalty samplers are used.<br><br>
27690+ KoboldAI Lite takes no responsibility for your usage of this feature. Your API key is used directly with the OpenRouter API and is not transmitted to us.<br>Only Temperature, Top-P and Repetition Penalty samplers are used.<br><a class="color_blueurl" onclick="fetch_openrouter_balance()" href="#">Click here to see your credit balance.</a><br>< br>
2762427691 <span class="color_green" style="font-weight: bold;">Please input OpenRouter Key.</span><br><br>
2762527692 </span>
2762627693 <span id="mistralaidesc" class="hidden">
@@ -27987,7 +28054,7 @@ Current version indicated by LITEVER below.
2798728054 Unsaved data will be lost.<br><br>
2798828055 <div>
2798928056 <div style="vertical-align: middle;">
27990- <div title="If disabled, brings you back to the start page">
28057+ <div id="keep_ai_selected_row" title="If disabled, brings you back to the start page">
2799128058 <span>Keep AI Selected? </span>
2799228059 <input type="checkbox" id="keep_ai_selected" style=" vertical-align: top;" checked>
2799328060 </div>
@@ -28208,7 +28275,7 @@ Current version indicated by LITEVER below.
2820828275
2820928276 <div class="popupcontainer flex hidden" id="addmediacontainer">
2821028277 <div class="popupbg flex"></div>
28211- <div class="nspopup flexsizevsmall moderate ">
28278+ <div class="nspopup flexsizevsmall high ">
2821228279 <div class="popuptitlebar">
2821328280 <div class="popuptitletext">Add Audio or Image</div>
2821428281 </div>
@@ -28231,7 +28298,10 @@ Current version indicated by LITEVER below.
2823128298 <button type="button" class="btn btn-primary" onclick="hide_popups();display_settings();display_settings_tab(2);">Customize Media Settings</button>
2823228299 </div>
2823328300 <div class="menutext hidden" id="btn_open_stableui">
28234- <button type="button" class="btn btn-primary bg_purple" onclick="go_to_stableui()">Go To StableUI</button>
28301+ <button type="button" class="btn btn-primary bg_purple" onclick="go_to_stableui()">Launch StableUI</button>
28302+ </div>
28303+ <div class="menutext hidden" id="btn_open_lcppui">
28304+ <button type="button" class="btn btn-primary bg_purple" onclick="go_to_lcppui()">Launch llama.cpp UI</button>
2823528305 </div>
2823628306 <br>
2823728307 <input type="file" id="addimgfileinput" style="display:none" accept="image/*,audio/mpeg,audio/wav,audio/ogg,audio/aac,audio/flac,audio/opus,audio/mp4">
0 commit comments