mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2026-05-09 11:00:40 +00:00
updated lite
This commit is contained in:
parent
dca49de059
commit
8faf01016d
1 changed files with 159 additions and 15 deletions
174
klite.embd
174
klite.embd
|
|
@ -12,7 +12,7 @@ Current version indicated by LITEVER below.
|
|||
-->
|
||||
|
||||
<script id="init-config">
|
||||
const LITEVER = 260;
|
||||
const LITEVER = 261;
|
||||
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_";
|
||||
|
|
@ -3398,6 +3398,7 @@ Current version indicated by LITEVER below.
|
|||
raw_instruct_tags: false, //experimental flag
|
||||
show_endpoint_selector: false,
|
||||
no_warn_unsaved: false,
|
||||
no_compress_audio: false,
|
||||
|
||||
//section migrated from story itself
|
||||
extrastopseq: "",
|
||||
|
|
@ -9793,6 +9794,7 @@ Current version indicated by LITEVER below.
|
|||
document.getElementById("addmediacontainer").classList.contains("hidden") &&
|
||||
document.getElementById("pasteimgcontainer").classList.contains("hidden") &&
|
||||
document.getElementById("webcamcontainer").classList.contains("hidden") &&
|
||||
document.getElementById("miccontainer").classList.contains("hidden") &&
|
||||
document.getElementById("choosesharecontainer").classList.contains("hidden") &&
|
||||
document.getElementById("advancedloadfile").classList.contains("hidden") &&
|
||||
document.getElementById("welcomecontainer").classList.contains("hidden") &&
|
||||
|
|
@ -9832,6 +9834,7 @@ Current version indicated by LITEVER below.
|
|||
document.getElementById("addmediacontainer").classList.add("hidden");
|
||||
document.getElementById("pasteimgcontainer").classList.add("hidden");
|
||||
document.getElementById("webcamcontainer").classList.add("hidden");
|
||||
document.getElementById("miccontainer").classList.add("hidden");
|
||||
document.getElementById("choosesharecontainer").classList.add("hidden");
|
||||
document.getElementById("advancedloadfile").classList.add("hidden");
|
||||
document.getElementById("welcomecontainer").classList.add("hidden");
|
||||
|
|
@ -12606,6 +12609,7 @@ Current version indicated by LITEVER below.
|
|||
document.getElementById("raw_instruct_tags").checked = localsettings.raw_instruct_tags;
|
||||
document.getElementById("show_endpoint_selector").checked = localsettings.show_endpoint_selector;
|
||||
document.getElementById("no_warn_unsaved").checked = localsettings.no_warn_unsaved;
|
||||
document.getElementById("no_compress_audio").checked = localsettings.no_compress_audio;
|
||||
document.getElementById("render_streaming_markdown").checked = localsettings.render_streaming_markdown;
|
||||
document.getElementById("min_p").value = localsettings.min_p;
|
||||
document.getElementById("dynatemp_range").value = localsettings.dynatemp_range;
|
||||
|
|
@ -13135,6 +13139,7 @@ Current version indicated by LITEVER below.
|
|||
localsettings.raw_instruct_tags = (document.getElementById("raw_instruct_tags").checked ? true : false);
|
||||
localsettings.show_endpoint_selector = (document.getElementById("show_endpoint_selector").checked ? true : false);
|
||||
localsettings.no_warn_unsaved = (document.getElementById("no_warn_unsaved").checked ? true : false);
|
||||
localsettings.no_compress_audio = (document.getElementById("no_compress_audio").checked ? true : false);
|
||||
localsettings.render_streaming_markdown = (document.getElementById("render_streaming_markdown").checked ? true : false);
|
||||
if(document.getElementById("opmode").value==1)
|
||||
{
|
||||
|
|
@ -14743,11 +14748,18 @@ Current version indicated by LITEVER below.
|
|||
image_db[imgid].imsource = 1; //0=generated,1=uploaded
|
||||
image_db[imgid].imrefid = filename;
|
||||
image_db[imgid].len = 0;
|
||||
convertAudioToCompressedBase64(origAudio,(newAudio,duration)=>{
|
||||
if(localsettings.no_compress_audio)
|
||||
{
|
||||
image_db[imgid].done = true;
|
||||
image_db[imgid].result = newAudio;
|
||||
image_db[imgid].len = duration;
|
||||
});
|
||||
image_db[imgid].result = origAudio;
|
||||
} else {
|
||||
convertAudioToCompressedBase64(origAudio,(newAudio,duration)=>{
|
||||
image_db[imgid].done = true;
|
||||
image_db[imgid].result = newAudio;
|
||||
image_db[imgid].len = duration;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function clear_paste_window()
|
||||
|
|
@ -14886,6 +14898,80 @@ Current version indicated by LITEVER below.
|
|||
hide_popups();
|
||||
}
|
||||
|
||||
var captureMicRecording = false;
|
||||
var captureMicChunks = [];
|
||||
var captureMicRecorder = null;
|
||||
var captureMicAborted = false;
|
||||
function add_img_btn_mic()
|
||||
{
|
||||
document.getElementById("addmediacontainer").classList.add("hidden");
|
||||
document.getElementById("miccontainer").classList.remove("hidden");
|
||||
document.getElementById("micrecbtn").classList.remove("bg_red");
|
||||
document.getElementById("micrecbtn").innerText = "🎙️ Start Recording";
|
||||
captureMicRecording = false;
|
||||
captureMicAborted = false;
|
||||
captureMicChunks = [];
|
||||
}
|
||||
function capture_mic_abort()
|
||||
{
|
||||
document.getElementById("miccontainer").classList.add("hidden");
|
||||
if(captureMicRecorder)
|
||||
{
|
||||
captureMicAborted = true;
|
||||
captureMicChunks = [];
|
||||
captureMicRecorder.stop();
|
||||
}
|
||||
captureMicRecording = false;
|
||||
}
|
||||
function capture_mic_btn()
|
||||
{
|
||||
if (!captureMicRecording) {
|
||||
navigator.mediaDevices.getUserMedia({ audio: true }).then(function (stream) { // Request microphone access
|
||||
document.getElementById("micrecbtn").classList.add("bg_red");
|
||||
document.getElementById("micrecbtn").innerText = "🛑 Stop Recording";
|
||||
captureMicAborted = false;
|
||||
captureMicRecorder = new MediaRecorder(stream);
|
||||
captureMicChunks = [];
|
||||
|
||||
captureMicRecorder.ondataavailable = function (e) {
|
||||
if(!captureMicAborted)
|
||||
{
|
||||
captureMicChunks.push(e.data);
|
||||
}
|
||||
};
|
||||
|
||||
captureMicRecorder.onstop = function () {
|
||||
if(captureMicChunks.length>0)
|
||||
{
|
||||
var blob = new Blob(captureMicChunks, { type: 'audio/webm' });
|
||||
var reader = new FileReader();
|
||||
reader.onloadend = function () {
|
||||
var completeRecording = reader.result;
|
||||
self_upload_audio(completeRecording,"recording");
|
||||
};
|
||||
reader.readAsDataURL(blob);
|
||||
stream.getTracks().forEach(function (track) {
|
||||
track.stop();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
captureMicRecorder.start();
|
||||
captureMicRecording = true;
|
||||
}).catch(function (err) {
|
||||
console.error('Error accessing microphone:', err);
|
||||
});
|
||||
} else {
|
||||
if(captureMicRecorder)
|
||||
{
|
||||
captureMicRecorder.stop();
|
||||
}
|
||||
document.getElementById("micrecbtn").innerText = "Saving...";
|
||||
document.getElementById("miccontainer").classList.add("hidden");
|
||||
captureMicRecording = false;
|
||||
}
|
||||
}
|
||||
|
||||
function add_img_btn_upload()
|
||||
{
|
||||
let finput = document.getElementById('addimgfileinput');
|
||||
|
|
@ -16351,11 +16437,11 @@ Current version indicated by LITEVER below.
|
|||
}
|
||||
if(is_using_kcpp_with_llava() && insertAIVisionImages.length>0)
|
||||
{
|
||||
submit_payload.params.images = insertAIVisionImages;
|
||||
submit_payload.params.images = insertAIVisionImages.map(str => str.includes("base64,")?str.split("base64,")[1]:str);
|
||||
}
|
||||
if(is_using_kcpp_with_llava() && insertAIAudioSounds.length>0)
|
||||
{
|
||||
submit_payload.params.audio = insertAIAudioSounds;
|
||||
submit_payload.params.audio = insertAIAudioSounds.map(str => str.includes("base64,")?str.split("base64,")[1]:str);
|
||||
}
|
||||
|
||||
if(localsettings.sampler_seed>=1)
|
||||
|
|
@ -16733,7 +16819,7 @@ Current version indicated by LITEVER below.
|
|||
|
||||
if (document.getElementById("useoaichatcompl").checked) {
|
||||
let mainoaibody = submit_payload.prompt; //can be string or array
|
||||
if(insertAIVisionImages.length>0)
|
||||
if(insertAIVisionImages.length>0 || insertAIAudioSounds.length>0)
|
||||
{
|
||||
mainoaibody = [
|
||||
{
|
||||
|
|
@ -16746,7 +16832,26 @@ Current version indicated by LITEVER below.
|
|||
let oaiimg = {
|
||||
"type": "image_url",
|
||||
"image_url": {
|
||||
"url": ("data:image/jpeg;base64,"+insertAIVisionImages[i])
|
||||
"url": insertAIVisionImages[i]
|
||||
}
|
||||
};
|
||||
mainoaibody.push(oaiimg);
|
||||
}
|
||||
for(let i=0;i<insertAIAudioSounds.length;++i)
|
||||
{
|
||||
let curr = insertAIAudioSounds[i];
|
||||
let format = "wav";
|
||||
if(curr.includes("base64,"))
|
||||
{
|
||||
let parts = curr.split("base64,");
|
||||
curr = parts[1];
|
||||
format = (parts[0].includes("mp3")||parts[0].includes("mpeg"))?"mp3":"wav";
|
||||
}
|
||||
let oaiimg = {
|
||||
"type": "input_audio",
|
||||
"input_audio": {
|
||||
"data": curr,
|
||||
"format": format
|
||||
}
|
||||
};
|
||||
mainoaibody.push(oaiimg);
|
||||
|
|
@ -17053,12 +17158,30 @@ Current version indicated by LITEVER below.
|
|||
|
||||
let geminiparts = [];
|
||||
|
||||
if (insertAIVisionImages.length > 0) {
|
||||
if (insertAIVisionImages.length > 0 || insertAIAudioSounds.length > 0) {
|
||||
for (let i = 0; i < insertAIVisionImages.length; ++i) {
|
||||
let imgd = insertAIVisionImages[i];
|
||||
let oaiimg = {
|
||||
"inline_data": {
|
||||
"mime_type": "image/jpeg",
|
||||
"data": insertAIVisionImages[i]
|
||||
"data": (imgd.includes("base64,")?imgd.split("base64,")[1]:imgd)
|
||||
}
|
||||
};
|
||||
geminiparts.push(oaiimg);
|
||||
}
|
||||
for (let i = 0; i < insertAIAudioSounds.length; ++i) {
|
||||
let imgd = insertAIAudioSounds[i];
|
||||
let format = "audio/wav"
|
||||
if(imgd.includes(";base64,"))
|
||||
{
|
||||
let parts = imgd.split(";base64,");
|
||||
imgd = parts[1];
|
||||
format = parts[0].split(":")[1];
|
||||
}
|
||||
let oaiimg = {
|
||||
"inline_data": {
|
||||
"mime_type": format,
|
||||
"data": imgd
|
||||
}
|
||||
};
|
||||
geminiparts.push(oaiimg);
|
||||
|
|
@ -19772,12 +19895,12 @@ Current version indicated by LITEVER below.
|
|||
let placeholder = "";
|
||||
let parts = inner.split(',');
|
||||
if (parts.length === 2 && parts[0].startsWith('data:image')) {
|
||||
insertAIVisionImages.push(parts[1]);
|
||||
insertAIVisionImages.push(inner);
|
||||
placeholder = "\n(Attached Image)\n";
|
||||
}
|
||||
else if(parts.length === 2 && parts[0].startsWith('data:audio'))
|
||||
{
|
||||
insertAIAudioSounds.push(parts[1]);
|
||||
insertAIAudioSounds.push(inner);
|
||||
placeholder = "\n(Attached Audio)\n";
|
||||
}
|
||||
return placeholder;
|
||||
|
|
@ -22753,7 +22876,7 @@ Current version indicated by LITEVER below.
|
|||
`<style>
|
||||
.you-portrait-image${classSuffixStr} {margin: 10px 6px; background:url(${as.you_portrait}); background-clip: content-box; background-position: 50% 50%; background-size: 100% 100%; background-origin: content-box; background-repeat: no-repeat; border:none;}
|
||||
.AI-portrait-image${classSuffixStr} {margin: 10px 6px; background:url(${(as.AI_portrait!="default"?as.AI_portrait:niko_square)}); background-clip: content-box; background-position: 50% 50%; background-size: 100% 100%; background-origin: content-box; background-repeat: no-repeat; border:none;}
|
||||
code
|
||||
#chat_msg_body code, #aesthetic_text_preview code
|
||||
{
|
||||
color: ${as.code_block_foreground};
|
||||
background-color: ${as.code_block_background};
|
||||
|
|
@ -25135,6 +25258,11 @@ Current version indicated by LITEVER below.
|
|||
class="helptext">Do not show any warnings for closing or overwriting unsaved work (caution!)</span></span></div>
|
||||
<input title="Do Not Warn Unsaved" type="checkbox" id="no_warn_unsaved" style="margin:0px 0px 0px 0px;">
|
||||
</div>
|
||||
<div class="settinglabel">
|
||||
<div class="justifyleft settingsmall">DoNotCompressAudio <span class="helpicon">?<span
|
||||
class="helptext">Do not compress embedded audio files. Might crash on big files! (caution!)</span></span></div>
|
||||
<input title="Do Not Recompress Audio" type="checkbox" id="no_compress_audio" style="margin:0px 0px 0px 0px;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="settingitem wide">
|
||||
|
|
@ -25560,6 +25688,7 @@ Current version indicated by LITEVER below.
|
|||
<option value="gpt-4-turbo">gpt-4-turbo</option>
|
||||
<option value="gpt-4o">gpt-4o</option>
|
||||
<option value="gpt-4o-mini">gpt-4o-mini</option>
|
||||
<option value="gpt-4o-mini-audio-preview">gpt-4o-mini-audio-preview</option>
|
||||
<option value="gpt-4-32k">gpt-4-32k</option>
|
||||
<option value="gpt-4.1">gpt-4.1</option>
|
||||
<option value="gpt-4.1-mini">gpt-4.1-mini</option>
|
||||
|
|
@ -26083,7 +26212,7 @@ Current version indicated by LITEVER below.
|
|||
<button type="button" class="btn btn-primary bg_green" onclick="add_img_btn_upload()">Upload a File (Image / Audio)</button>
|
||||
</div>
|
||||
<div class="menutext">
|
||||
<button type="button" class="btn btn-primary bg_green" onclick="add_img_btn_webcam()">Capture From Camera</button>
|
||||
Capture From <button type="button" class="btn btn-primary bg_green" onclick="add_img_btn_webcam()">Camera</button> <button type="button" class="btn btn-primary bg_green" onclick="add_img_btn_mic()">Microphone</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>
|
||||
|
|
@ -26131,6 +26260,21 @@ Current version indicated by LITEVER below.
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="popupcontainer flex hidden" id="miccontainer">
|
||||
<div class="popupbg flex"></div>
|
||||
<div class="nspopup flexsizevsmall">
|
||||
<div class="popuptitlebar">
|
||||
<div class="popuptitletext">Capture Audio From Microphone</div>
|
||||
</div>
|
||||
<div style="display: flex; height: 100px; padding: 20px;">
|
||||
<button id="micrecbtn" type="button" class="btn btn-primary" style="width:100%" onclick="capture_mic_btn()"></button>
|
||||
</div>
|
||||
<div class="popupfooter">
|
||||
<button type="button" class="btn btn-primary" onclick="capture_mic_abort();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