able to handle kcpp protected model name endpoints

This commit is contained in:
Concedo
2024-09-04 16:26:28 +08:00
parent 5d34de0c08
commit d777995991
2 changed files with 35 additions and 11 deletions
+17 -5
View File
@@ -12,7 +12,7 @@ Current version indicated by LITEVER below.
-->
<script>
const LITEVER = 172;
const LITEVER = 173;
const urlParams = new URLSearchParams(window.location.search);
var localflag = true;
const STORAGE_PREFIX = (localflag?"e_":"")+"kaihordewebui_";
@@ -3406,6 +3406,10 @@ Current version indicated by LITEVER below.
{
header['Authorization'] = 'Bearer ' + custom_kobold_key;
}
else if(document.getElementById("customkoboldkey").value!="")
{
header['Authorization'] = 'Bearer ' + document.getElementById("customkoboldkey").value;
}
return header;
}
@@ -8111,7 +8115,7 @@ Current version indicated by LITEVER below.
function togglepalmmodel()
{
let mdlname = document.getElementById("custom_palm_model").value;
if(mdlname=="gemini-1.5-pro-latest" || mdlname=="gemini-1.5-flash-latest" || mdlname=="gemini-1.5-pro-exp-0801")
if(mdlname=="gemini-1.5-pro-latest" || mdlname=="gemini-1.5-flash-latest" || mdlname=="gemini-1.5-pro-exp-0801" || mdlname=="gemini-1.5-pro-exp-0827")
{
document.getElementById("gemini_system_instruction").classList.remove("hidden");
if(localsettings.saved_palm_jailbreak=="")
@@ -8379,11 +8383,11 @@ Current version indicated by LITEVER below.
}
var allow_update_kobold_model_display_timestamp = performance.now() + 60000;
function update_custom_kobold_endpoint_model_display()
function update_custom_kobold_endpoint_model_display(forceupdate=false)
{
if(custom_kobold_endpoint!="" && selected_workers.length==0 && selected_models.length==1)
{
if(performance.now() >= allow_update_kobold_model_display_timestamp)
if(forceupdate || performance.now() >= allow_update_kobold_model_display_timestamp)
{
allow_update_kobold_model_display_timestamp = performance.now() + 60000;
console.log("Updating selected model name...");
@@ -8400,6 +8404,10 @@ Current version indicated by LITEVER below.
selected_models = [{ "performance": 100.0, "queued": 0.0, "eta": 0, "name": mdlname, "count": 1 }];
selected_workers = [];
console.log("Updating selected model name done.");
if(forceupdate)
{
render_gametext(false);
}
}
})
.catch(error => {
@@ -8641,6 +8649,7 @@ Current version indicated by LITEVER below.
userinput = userinput.trim();
if (userinput != null && userinput!="") {
custom_kobold_key = document.getElementById("customkoboldkey").value = localmodekey = localsettings.saved_kai_key = userinput.trim();
update_custom_kobold_endpoint_model_display(true);
}
},false,false,true);
}
@@ -17067,7 +17076,7 @@ Current version indicated by LITEVER below.
replacedText = replacedText.replace(italics_regex, wrapperSpan(styleRole, 'action')); // Apply the actions style to *actions*.
replacedText = replacedText.replace(/“(.*?)”/g, wrapperSpan(styleRole, 'speech')); // Apply the speech style to "speech".
replacedText = replacedText.replace(/&quot;(.*?)&quot;/g, wrapperSpan(styleRole, 'speech')); // Apply the speech style to "speech".
if(localsettings.opmode==4)
if(localsettings.instruct_has_markdown)
{
replacedText = simpleMarkdown(replacedText);
}
@@ -17642,6 +17651,7 @@ Current version indicated by LITEVER below.
<option value="gemini-1.5-pro-latest">gemini-1.5-pro-latest</option>
<option value="gemini-1.5-flash-latest">gemini-1.5-flash-latest</option>
<option value="gemini-1.5-pro-exp-0801">gemini-1.5-pro-exp-0801</option>
<option value="gemini-1.5-pro-exp-0827">gemini-1.5-pro-exp-0827</option>
<option value="text-bison-001">text-bison-001</option>
</select>
<span class="color_green" style="font-weight: bold;">Please input Gemini or PaLM API Key.</span><br><br>
@@ -17656,6 +17666,8 @@ Current version indicated by LITEVER below.
<option value="command" selected="selected">command</option>
<option value="command-r">command-r</option>
<option value="command-r-plus">command-r-plus</option>
<option value="command-r-08-2024">command-r-08-2024</option>
<option value="command-r-plus-08-2024">command-r-plus-08-2024</option>
</select>
<span class="color_green" style="font-weight: bold;">Please input Cohere API Key.</span><br><br>
<input class="form-control" type="password" id="custom_cohere_key" placeholder="Cohere API Key (Required)" value="" onfocus="focus_api_keys()" onblur="blur_api_keys()"><br>
+18 -6
View File
File diff suppressed because one or more lines are too long