Merge branch 'upstream' into concedo_experimental

# Conflicts:
#	README.md
#	examples/server/README.md
#	examples/speculative/speculative.cpp
#	flake.lock
#	ggml/src/CMakeLists.txt
#	scripts/sync-ggml.last
#	tests/test-backend-ops.cpp
This commit is contained in:
Concedo
2024-11-14 21:40:52 +08:00
41 changed files with 132106 additions and 130341 deletions
+59 -13
View File
@@ -12,7 +12,7 @@ Current version indicated by LITEVER below.
-->
<script>
const LITEVER = 186;
const LITEVER = 187;
const urlParams = new URLSearchParams(window.location.search);
var localflag = true;
const STORAGE_PREFIX = (localflag?"e_":"")+"kaihordewebui_";
@@ -32,6 +32,7 @@ Current version indicated by LITEVER below.
<!-- Favicon -->
<link rel="icon" id="fvico" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAEtQTFRFAAAA+XJ0l09PsVdXcTw842hqw2hmTi4vMCQlb2eUgWtl+tGpBAMDEw4NPCkoFw8PJBgXt5WBVkxW4Nvf7Lia3Z+MpJnAZ05HnJOTYIS/NAAAABl0Uk5TAv////v//vT9//3/Nna08qf+///////a/hkcROQAAAGUSURBVHiclZLRcoQgDEULBAKoIKjI/39pL4i7nbUPbcYZwJyES5Kvr3/YvIx1nn9zL4G4EwuTXX7xs4QFGEklOT6SBENERguhsWHFD2AVRhL8IEgawY8b5L4fYtg+TSl8+NMEu4G2P34Q67r6I+37dLyBfU/4PY/sInG2MR8vIHG01h9mHfq1hUUQtwYcLEcp+ltmwqutdy5HMwAfc8ExKtVSLEZZW13Jxb4Azq7UHFnFrtGItLliS1UDYOfctm3JhEtlEH5zzpZNDsC63AB1VysY3gqC3C2ytsNW6Q3IjCt91Qr9QK8MiFL4nUEpEyNLYmodxYo3RquVHWUmbbRu0QCbKWwNfil5zYeENrRRqtZrGEQYqdtW8FWHLl4bgZDLFLZdbS/UzP2AEGTufkt3xWSvwzJeh4GxHWD5qlgXOZ/n2ULuC/od4Pk8x9xhCekD0Bqd/DmXgbpEumRgrMPn1K6ecs4pJc/V0nE+x35KtfTJTJufpvPTD2DyNZ3e4wP3zDCHevg+yYvf09PfkHuK7/Vv9g2CjBTdqv3bFgAAAABJRU5ErkJggg==" />
<style id="custom_css"></style>
<style>
/*!
* Bootstrap v3.4.1 (https://getbootstrap.com/)
@@ -2498,7 +2499,7 @@ Current version indicated by LITEVER below.
const instructmodels1 = ["gpt4all","supercot","hermes","airoboros","chrono","wizard","mantis","vicuna","manticore","alpaca","myth","xwin","spicyboros","mlewd","mxlewd","mistral","maid","mixtral","estopia","fighter","fimbul","euryale","nemo","gemma","lunaris","stheno","magnum","cydonia"];
const instructmodels2 = ["erebus","nerys","nerybus","janeway","opt","llama"];
const defaultmodels = ["gpt4all","supercot","hermes","airoboros","chrono","wizard","mantis","vicuna","manticore","alpaca","myth","xwin","spicyboros","mlewd","mxlewd","llama","mistral","maid","mixtral","estopia","fighter","fimbul","euryale","nemo","gemma","lunaris","stheno","magnum","cydonia"];
const ignoredmodels = ["tinyllama"];
const ignoredmodels = ["tinyllama","debug-"];
const instructstartplaceholder = "\n{{[INPUT]}}\n";
const instructendplaceholder = "\n{{[OUTPUT]}}\n";
@@ -3771,7 +3772,7 @@ Current version indicated by LITEVER below.
ctrl.buf += chunk;
let evs = [];
let m;
while ((m = /^data: (.*)\n\n/m.exec(ctrl.buf)) !== null) {
while ((m = /^data: (.*)(\r?\n){2}/m.exec(ctrl.buf)) !== null) {
try{evs.push({data: JSON.parse(m[1])});} catch (e) {}
ctrl.buf = ctrl.buf.substring(m.index + m[0].length);
}
@@ -3899,7 +3900,7 @@ Current version indicated by LITEVER below.
ctrl.buf += chunk;
let evs = [];
let m;
while ((m = /^event: (.*)\ndata: (.*)\n\n/m.exec(ctrl.buf)) !== null) {
while ((m = /^event: (.*)\ndata: (.*)(\r?\n){2}/m.exec(ctrl.buf)) !== null) {
evs.push({event: m[1], data: JSON.parse(m[2])});
ctrl.buf = ctrl.buf.substring(m.index + m[0].length);
}
@@ -4951,6 +4952,23 @@ Current version indicated by LITEVER below.
populate_corpo_leftpanel();
update_toggle_lightmode(false); //load theme but dont save or toggle it
//load custom css
let currcss = localStorage.getItem(STORAGE_PREFIX + "savedcustomcss", "");
let resetcss = urlParams.get('resetcss');
if(currcss!="" && !resetcss)
{
currcss = sanitize_css(currcss);
console.log("Custom CSS applied.");
let styleElement = document.getElementById('custom_css');
styleElement.innerHTML = currcss;
}
else if(resetcss)
{
console.log("Custom CSS reset.")
localStorage.setItem(STORAGE_PREFIX + "savedcustomcss", "");
window.history.replaceState(null, null, window.location.pathname);
}
} catch (e) {
console.log("Discarded invalid local save: " + e);
loadok = false;
@@ -8920,11 +8938,19 @@ Current version indicated by LITEVER below.
}
else
{
let errmsg = data.error.message;
if(!errmsg)
let errmsg = "";
if(data && data.error && data.error.message)
{
errmsg = data.error.message;
}
else if(data && data.error)
{
errmsg = data.error;
}
else
{
errmsg = data;
}
msgbox(JSON.stringify(errmsg),"Error Encountered",false,false);
}
})
@@ -11378,6 +11404,27 @@ Current version indicated by LITEVER below.
},true,true);
}
function sanitize_css(input)
{
input = input.replace(/<\s*\/?\s*\w+\s*[^>]*>/gi, ""); //replace html tags
input = input.replace(/</g, ""); // Remove any remaining `<` characters
input = input.replace(/(?:javascript|data|vbscript|file):/gi, "");
return input;
}
function apply_custom_css()
{
let currcss = localStorage.getItem(STORAGE_PREFIX + "savedcustomcss", "");
inputBoxOkCancel("Here, you can apply third-party custom CSS styles shared by other users.<br><br><span class='color_red'>Caution: This will modify the existing document, so only use third-party CSS styles that you trust! Custom CSS is persistent, but can be reset in this menu.</span><br><br>You can return to default styles by clearing the box below. If you get stuck, add ?resetcss=1 to the URL to clear custom styles.","Apply Custom CSS Styles",currcss,"Paste CSS Styles Here",()=>{
let userinput = sanitize_css(getInputBoxValue().trim());
localStorage.setItem(STORAGE_PREFIX + "savedcustomcss", userinput);
let styleElement = document.getElementById('custom_css');
styleElement.innerHTML = userinput;
},
()=>{
//do nothing on cancel
},true,true);
}
function clear_poll_flags()
{
pending_response_id = "";
@@ -19461,9 +19508,7 @@ Current version indicated by LITEVER below.
</tr></table>
</div>
<div id="genimgopt" class="">
<table>
<tr><td>
<div>
<div class="settinglabel">
<div class="justifyleft settingsmall" title="Parse user input text in instruct mode, and trigger image generation if requested">Detect ImgGen Instructions </div>
<input title="Detect ImgGen Instructions" type="checkbox" id="img_gen_from_instruct" style="margin:0px 0 0;">
@@ -19476,9 +19521,6 @@ Current version indicated by LITEVER below.
<div class="justifyleft settingsmall" title="Includes images when saving to json file">Save Images </div>
<input title="Save Images in File" type="checkbox" id="save_images" style="margin:0px 0 0;">
</div>
</td>
</tr>
</table>
</div>
</div>
@@ -19704,7 +19746,11 @@ Current version indicated by LITEVER below.
</div>
<div class="settinglabel">
<div class="justifyleft settingsmall">User Mods <span class="helpicon">?<span class="helptext">Allows you to load third-party user created mods (caution).</span></span></div>
<button id="loadusermod" type="button" class="btn btn-primary" style="padding:2px 3px;margin-top:2px;font-size:11px;margin:0px 0px 0px auto;" onclick="apply_user_mod()">Apply User Mod</button>
<button type="button" class="btn btn-primary" style="padding:2px 3px;margin-top:2px;font-size:11px;margin:0px 0px 0px auto;" onclick="apply_user_mod()">Apply User Mod</button>
</div>
<div class="settinglabel">
<div class="justifyleft settingsmall">Custom CSS <span class="helpicon">?<span class="helptext">Allows you to load third-party CSS styles (caution).</span></span></div>
<button type="button" class="btn btn-primary" style="padding:2px 3px;margin-top:2px;font-size:11px;margin:0px 0px 0px auto;" onclick="apply_custom_css()">Apply Custom CSS</button>
</div>
</div>