mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2025-09-14 19:09:45 +00:00
updated lite
This commit is contained in:
parent
a9435163ab
commit
7a2de82c96
1 changed files with 71 additions and 23 deletions
94
klite.embd
94
klite.embd
|
@ -6449,6 +6449,7 @@ Current version: 124
|
|||
document.getElementById("groupselectcontainer").classList.contains("hidden") &&
|
||||
document.getElementById("imagestylecontainer").classList.contains("hidden") &&
|
||||
document.getElementById("addimgcontainer").classList.contains("hidden") &&
|
||||
document.getElementById("pasteimgcontainer").classList.contains("hidden") &&
|
||||
document.getElementById("choosesharecontainer").classList.contains("hidden") &&
|
||||
document.getElementById("advancedloadfile").classList.contains("hidden")
|
||||
);
|
||||
|
@ -6471,6 +6472,7 @@ Current version: 124
|
|||
document.getElementById("groupselectcontainer").classList.add("hidden");
|
||||
document.getElementById("imagestylecontainer").classList.add("hidden");
|
||||
document.getElementById("addimgcontainer").classList.add("hidden");
|
||||
document.getElementById("pasteimgcontainer").classList.add("hidden");
|
||||
document.getElementById("choosesharecontainer").classList.add("hidden");
|
||||
document.getElementById("advancedloadfile").classList.add("hidden");
|
||||
}
|
||||
|
@ -9106,6 +9108,57 @@ Current version: 124
|
|||
document.getElementById("addimgcontainer").classList.add("hidden");
|
||||
}
|
||||
|
||||
function self_upload_img(origImg)
|
||||
{
|
||||
let imgid = "selfuploadimg"+(Math.floor(10000 + Math.random() * 90000)).toString();
|
||||
let nimgtag = "[<|p|" + imgid + "|p|>]";
|
||||
gametext_arr.push(nimgtag);
|
||||
image_db[imgid] = { done: false, queue: "Generating", result: "", prompt:"", local:true };
|
||||
image_db[imgid].aspect = 0;
|
||||
image_db[imgid].imsource = 1; //0=generated,1=uploaded
|
||||
let imgres = localsettings.img_allowhd?HD_RES_PX:NO_HD_RES_PX;
|
||||
compressImage(origImg, (newDataUri, outAspect) => {
|
||||
image_db[imgid].done = true;
|
||||
image_db[imgid].result = newDataUri;
|
||||
if(outAspect<0.7)
|
||||
{
|
||||
image_db[imgid].aspect = 1; //portrait
|
||||
}
|
||||
else if(outAspect>1.4)
|
||||
{
|
||||
image_db[imgid].aspect = 2; //landscape
|
||||
}
|
||||
}, true, false, imgres,0.35,true);
|
||||
}
|
||||
|
||||
function img_paste_event(event)
|
||||
{
|
||||
var items = (event.clipboardData || event.originalEvent.clipboardData).items;
|
||||
let founditem = false;
|
||||
for (index in items) {
|
||||
var item = items[index];
|
||||
if (!founditem && item.kind === 'file' && item.type.includes("image"))
|
||||
{
|
||||
var blob = item.getAsFile();
|
||||
var reader = new FileReader();
|
||||
reader.onload = function(event){
|
||||
let origImg = event.target.result;
|
||||
self_upload_img(origImg);
|
||||
};
|
||||
reader.readAsDataURL(blob);
|
||||
founditem = true;
|
||||
document.getElementById("pasteimgcontainer").classList.add("hidden");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function add_img_btn_paste()
|
||||
{
|
||||
document.getElementById("addimgcontainer").classList.add("hidden");
|
||||
document.getElementById("pasteimgcontainer").classList.remove("hidden");
|
||||
}
|
||||
|
||||
function add_img_btn_upload()
|
||||
{
|
||||
let finput = document.getElementById('addimgfileinput');
|
||||
|
@ -9115,28 +9168,8 @@ Current version: 124
|
|||
const file = event.target.files[0];
|
||||
const reader = new FileReader();
|
||||
reader.onload = function(img) {
|
||||
|
||||
let imgid = "selfuploadimg"+(Math.floor(10000 + Math.random() * 90000)).toString();
|
||||
let nimgtag = "[<|p|" + imgid + "|p|>]";
|
||||
gametext_arr.push(nimgtag);
|
||||
image_db[imgid] = { done: false, queue: "Generating", result: "", prompt:"", local:true };
|
||||
image_db[imgid].aspect = 0;
|
||||
image_db[imgid].imsource = 1; //0=generated,1=uploaded
|
||||
let origImg = img.target.result;
|
||||
let imgres = localsettings.img_allowhd?HD_RES_PX:NO_HD_RES_PX;
|
||||
compressImage(origImg, (newDataUri, outAspect) => {
|
||||
image_db[imgid].done = true;
|
||||
image_db[imgid].result = newDataUri;
|
||||
if(outAspect<0.7)
|
||||
{
|
||||
image_db[imgid].aspect = 1; //portrait
|
||||
}
|
||||
else if(outAspect>1.4)
|
||||
{
|
||||
image_db[imgid].aspect = 2; //landscape
|
||||
}
|
||||
}, true, false, imgres,0.35,true);
|
||||
|
||||
self_upload_img(origImg);
|
||||
}
|
||||
reader.readAsDataURL(file);
|
||||
}
|
||||
|
@ -14868,11 +14901,12 @@ Current version: 124
|
|||
<div class="aidgpopuplistheader anotelabel">
|
||||
<button type="button" class="btn btn-primary bg_green" onclick="add_img_btn_upload()">Upload Image File</button>
|
||||
</div>
|
||||
<div class="aidgpopuplistheader anotelabel">
|
||||
<button type="button" class="btn btn-primary bg_green" onclick="add_img_btn_paste()">Paste from Clipboard</button>
|
||||
</div>
|
||||
<div class="aidgpopuplistheader anotelabel">
|
||||
<button type="button" class="btn btn-primary" onclick="hide_popups();display_settings();selectImgStyle();">Customize Settings</button>
|
||||
</div>
|
||||
|
||||
|
||||
<br>
|
||||
<input type="file" id="addimgfileinput" style="display:none" accept="image/*">
|
||||
<div class="popupfooter">
|
||||
|
@ -14881,6 +14915,20 @@ Current version: 124
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="popupcontainer flex hidden" id="pasteimgcontainer">
|
||||
<div class="popupbg flex"></div>
|
||||
<div class="nspopup fixsize">
|
||||
<div class="popuptitlebar">
|
||||
<div class="popuptitletext">Paste Image From Clipboard</div>
|
||||
</div>
|
||||
<input type="text" style="width:100%; height:100px; text-align: center;" readonly="true" onpaste="return img_paste_event(event)" value="" placeholder="[Paste Image Here]">
|
||||
<br>
|
||||
<div class="popupfooter">
|
||||
<button type="button" class="btn btn-primary" onclick="hide_popups()">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="popupcontainer flex hidden" id="choosesharecontainer">
|
||||
<div class="popupbg flex"></div>
|
||||
<div class="nspopup fixsize">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue