mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2025-09-17 04:19:40 +00:00
updated lite (+1 squashed commits)
Squashed commits: [907f10f2f] updated lite
This commit is contained in:
parent
6c5c8be48d
commit
771bd7197b
1 changed files with 97 additions and 5 deletions
102
klite.embd
102
klite.embd
|
@ -12,7 +12,7 @@ Current version indicated by LITEVER below.
|
|||
-->
|
||||
|
||||
<script>
|
||||
const LITEVER = 250;
|
||||
const LITEVER = 252;
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
var localflag = urlParams.get('local'); //this will be replaced automatically in embedded kcpp
|
||||
const STORAGE_PREFIX = (localflag?"e_":"")+"kaihordewebui_";
|
||||
|
@ -3806,7 +3806,8 @@ Current version indicated by LITEVER below.
|
|||
}
|
||||
function format_streaming_text(input)
|
||||
{
|
||||
if(localsettings.opmode==4 && localsettings.render_streaming_markdown && localsettings.instruct_has_markdown)
|
||||
let inEditMode = (document.getElementById("allowediting").checked ? true : false);
|
||||
if(localsettings.opmode==4 && localsettings.render_streaming_markdown && localsettings.instruct_has_markdown && !inEditMode)
|
||||
{
|
||||
input = simpleMarkdown(input, localsettings.instruct_has_latex);
|
||||
}
|
||||
|
@ -8852,9 +8853,26 @@ Current version indicated by LITEVER below.
|
|||
.then(rb => {
|
||||
if (rb.ok) {
|
||||
return rb.blob();
|
||||
} else {
|
||||
throw new Error('Cannot fetch tavern image');
|
||||
}
|
||||
if (rb.status == 404) //sometimes cards get renamed. try to get real URL and fetch once more
|
||||
{
|
||||
return fetch(`https://api.chub.ai/api/characters/${userInput}`)
|
||||
.then(rx => rx.json())
|
||||
.then(rb2=>{
|
||||
let realimgurl = rb2.node.max_res_url;
|
||||
return fetch(realimgurl).then(rb3 => {
|
||||
if (rb3.ok) {
|
||||
return rb3.blob();
|
||||
}
|
||||
throw new Error('Cannot fetch tavern image');
|
||||
}).catch(error3 => {
|
||||
throw new Error('Cannot fetch tavern image');
|
||||
});
|
||||
}).catch(error2 => {
|
||||
throw new Error('Cannot fetch tavern image');
|
||||
});
|
||||
}
|
||||
throw new Error('Cannot fetch tavern image');
|
||||
})
|
||||
.then(blob => {
|
||||
preview_temp_scenario();
|
||||
|
@ -9106,7 +9124,7 @@ Current version indicated by LITEVER below.
|
|||
}
|
||||
|
||||
document.getElementById("scenariogrid").innerHTML = scenarios;
|
||||
document.getElementById("scenariodesc").innerText = "No Scenario Selected. Scroll for more options.";
|
||||
document.getElementById("scenariodesc").innerHTML = `No Scenario Selected. Scroll down for more options.<br><br><a href="#" class="color_blueurl mainnav" onclick="hide_popups();document.getElementById('loadfileinput').click()">Alternatively, click [HERE] to load card from PNG file.</a>`;
|
||||
togglescenarioautopick();
|
||||
}
|
||||
|
||||
|
@ -9495,6 +9513,7 @@ Current version indicated by LITEVER below.
|
|||
document.getElementById("groupselectcontainer").classList.contains("hidden") &&
|
||||
document.getElementById("addimgcontainer").classList.contains("hidden") &&
|
||||
document.getElementById("pasteimgcontainer").classList.contains("hidden") &&
|
||||
document.getElementById("webcamcontainer").classList.contains("hidden") &&
|
||||
document.getElementById("choosesharecontainer").classList.contains("hidden") &&
|
||||
document.getElementById("advancedloadfile").classList.contains("hidden") &&
|
||||
document.getElementById("welcomecontainer").classList.contains("hidden") &&
|
||||
|
@ -9533,10 +9552,12 @@ Current version indicated by LITEVER below.
|
|||
document.getElementById("groupselectcontainer").classList.add("hidden");
|
||||
document.getElementById("addimgcontainer").classList.add("hidden");
|
||||
document.getElementById("pasteimgcontainer").classList.add("hidden");
|
||||
document.getElementById("webcamcontainer").classList.add("hidden");
|
||||
document.getElementById("choosesharecontainer").classList.add("hidden");
|
||||
document.getElementById("advancedloadfile").classList.add("hidden");
|
||||
document.getElementById("welcomecontainer").classList.add("hidden");
|
||||
document.getElementById("admincontainer").classList.add("hidden");
|
||||
stop_webcam();
|
||||
mainmenu_untab(false);
|
||||
}
|
||||
|
||||
|
@ -14345,6 +14366,52 @@ Current version indicated by LITEVER below.
|
|||
}
|
||||
}
|
||||
|
||||
var webcamStream = null;
|
||||
function add_img_btn_webcam()
|
||||
{
|
||||
document.getElementById("addimgcontainer").classList.add("hidden");
|
||||
document.getElementById("webcamcontainer").classList.remove("hidden");
|
||||
const video = document.getElementById('webcamvideo');
|
||||
if(webcamStream)
|
||||
{
|
||||
stop_webcam();
|
||||
}
|
||||
navigator.mediaDevices.getUserMedia({ video: true })
|
||||
.then(stream => {
|
||||
webcamStream = stream;
|
||||
video.srcObject = stream;
|
||||
})
|
||||
.catch(err => {
|
||||
console.error('Error accessing webcam:', err);
|
||||
});
|
||||
}
|
||||
function stop_webcam()
|
||||
{
|
||||
if (webcamStream) {
|
||||
const video = document.getElementById('webcamvideo');
|
||||
webcamStream.getTracks().forEach(track => track.stop());
|
||||
video.srcObject = null; // Clear video source
|
||||
console.log("Webcam stopped.");
|
||||
}
|
||||
webcamStream = null;
|
||||
}
|
||||
function capture_webcam_btn()
|
||||
{
|
||||
const video = document.getElementById('webcamvideo');
|
||||
const canvas = document.getElementById('webcamcanvas');
|
||||
const context = canvas.getContext('2d');
|
||||
const videoWidth = video.videoWidth;
|
||||
const videoHeight = video.videoHeight;
|
||||
// Draw the cropped square to 512x512 canvas
|
||||
const sideLength = Math.min(videoWidth, videoHeight);
|
||||
const sx = (videoWidth - sideLength) / 2;
|
||||
const sy = (videoHeight - sideLength) / 2;
|
||||
context.drawImage(video, sx, sy, sideLength, sideLength, 0, 0, 512, 512);
|
||||
const dataURL = canvas.toDataURL('image/png');
|
||||
self_upload_img(dataURL); // Call your upload function
|
||||
hide_popups();
|
||||
}
|
||||
|
||||
function add_img_btn_upload()
|
||||
{
|
||||
let finput = document.getElementById('addimgfileinput');
|
||||
|
@ -20130,6 +20197,11 @@ Current version indicated by LITEVER below.
|
|||
corpo_editing_turn = -1;
|
||||
render_gametext(needsave,false);
|
||||
}
|
||||
function corpo_edit_chunk_resend(idx)
|
||||
{
|
||||
corpo_edit_chunk_save();
|
||||
corpo_retry_chunk(idx+1);
|
||||
}
|
||||
|
||||
var cosmetic_corpo_ai_nick = "KoboldAI";
|
||||
function corpo_click_avatar()
|
||||
|
@ -20254,12 +20326,14 @@ Current version indicated by LITEVER below.
|
|||
}
|
||||
}
|
||||
|
||||
let resendbtn = ((curr.myturn && i<chatunits.length-1)?`<button type="button" class="btn btn-primary" style="margin:2px;float:right;" onclick="corpo_edit_chunk_resend(${i})">Resend</button>`:``);
|
||||
let bodypart = (corpo_editing_turn == i ?
|
||||
`<div class="corpo_edit_outer">
|
||||
<div class="corpo_edit_inner" id="corpo_edit_inp_lengthtester" style="white-space: nowrap; visibility: hidden; height: 0px; position:absolute; width: auto;"></div>
|
||||
<textarea class="corpo_edit_inner" id="corpo_edit_inp" type="text" name="crpeditinp" role="presentation" autocomplete="noppynop" spellcheck="true" rows="1" wrap="on" placeholder="Edit Message" value="" oninput="corpoedit_resize_input();"/>${stash_image_placeholders(curr.msg, false)}</textarea>
|
||||
</div>
|
||||
<button type="button" class="btn btn-primary" style="margin:2px;float:right;" onclick="corpo_edit_chunk_start(-1)">Cancel</button>
|
||||
${resendbtn}
|
||||
<button type="button" class="btn btn-primary" style="margin:2px;float:right;" onclick="corpo_edit_chunk_save()">Save</button>
|
||||
<button type="button" class="btn btn-primary bg_red" style="margin:2px;float:left;" onclick="corpo_edit_chunk_delete()">Delete</button>`:
|
||||
`<div class="corpostyleitemcontent">${processed_msg}</div>`);
|
||||
|
@ -25064,6 +25138,9 @@ Current version indicated by LITEVER below.
|
|||
<div class="menutext">
|
||||
<button type="button" class="btn btn-primary bg_green" onclick="add_img_btn_upload()">Upload Image File</button>
|
||||
</div>
|
||||
<div class="menutext">
|
||||
<button type="button" class="btn btn-primary bg_green" onclick="add_img_btn_webcam()">Capture From Camera</button>
|
||||
</div>
|
||||
<div class="menutext">
|
||||
<button type="button" class="btn btn-primary bg_green" onclick="add_img_btn_paste()">Drag Drop / Paste from Clipboard</button>
|
||||
</div>
|
||||
|
@ -25095,6 +25172,21 @@ Current version indicated by LITEVER below.
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="popupcontainer flex hidden" id="webcamcontainer">
|
||||
<div class="popupbg flex"></div>
|
||||
<div class="nspopup flexsizevsmall">
|
||||
<div class="popuptitlebar">
|
||||
<div class="popuptitletext">Capture Image From Camera</div>
|
||||
</div>
|
||||
<video id="webcamvideo" width="100%" height="300" autoplay></video>
|
||||
<canvas id="webcamcanvas" width="512" height="512" style="display:none;"></canvas>
|
||||
<div class="popupfooter">
|
||||
<button id="webcambutton" type="button" class="btn btn-primary" onclick="capture_webcam_btn()">Capture</button>
|
||||
<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 flexsizevsmall">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue