mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2025-09-11 01:24:36 +00:00
updated lite
This commit is contained in:
parent
b50f94ae27
commit
1c39a97cb0
1 changed files with 22 additions and 8 deletions
30
klite.embd
30
klite.embd
|
@ -12,7 +12,7 @@ Current version indicated by LITEVER below.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<script id="init-config">
|
<script id="init-config">
|
||||||
const LITEVER = 274;
|
const LITEVER = 275;
|
||||||
const urlParams = new URLSearchParams(window.location.search);
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
var localflag = urlParams.get('local'); //this will be replaced automatically in embedded kcpp
|
var localflag = urlParams.get('local'); //this will be replaced automatically in embedded kcpp
|
||||||
const STORAGE_PREFIX = (localflag?"e_":"")+"kaihordewebui_";
|
const STORAGE_PREFIX = (localflag?"e_":"")+"kaihordewebui_";
|
||||||
|
@ -6000,6 +6000,7 @@ Current version indicated by LITEVER below.
|
||||||
copyToClipboard(innercode);
|
copyToClipboard(innercode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//extremely heavily modified version of https://github.com/casualwriter/casual-markdown
|
||||||
function simpleMarkdown(text, renderLatex) {
|
function simpleMarkdown(text, renderLatex) {
|
||||||
const escapeHTML = (str) => str.replace(/</g, "<").replace(/>/g, ">");
|
const escapeHTML = (str) => str.replace(/</g, "<").replace(/>/g, ">");
|
||||||
const highlightCode = (code) => {
|
const highlightCode = (code) => {
|
||||||
|
@ -6171,8 +6172,8 @@ Current version indicated by LITEVER below.
|
||||||
.replace(/\^\^(\w.*?)\^\^/gm, "<ins>$1</ins>")
|
.replace(/\^\^(\w.*?)\^\^/gm, "<ins>$1</ins>")
|
||||||
.replace(/\{\{(\w.*?)\}\}/gm, "<mark>$1</mark>")
|
.replace(/\{\{(\w.*?)\}\}/gm, "<mark>$1</mark>")
|
||||||
.replace(/^((?:\|[^|\r\n]*[^|\r\n\s]\s*)+\| {0,2}(?:\r?\n|\r|))+/gm,
|
.replace(/^((?:\|[^|\r\n]*[^|\r\n\s]\s*)+\| {0,2}(?:\r?\n|\r|))+/gm,
|
||||||
(matchedTable) => convertMarkdownTableToHtml(matchedTable))
|
(matchedTable) => convertMarkdownTableToHtml(matchedTable));
|
||||||
.replace(/ \n/g, "\n<br/>");
|
//.replace(/ \n/g, "\n<br/>"); //this is the reddit behavior where spacespacenewline generates extra newline
|
||||||
if(append_spcetg)
|
if(append_spcetg)
|
||||||
{
|
{
|
||||||
append_spcetg = false;
|
append_spcetg = false;
|
||||||
|
@ -14906,7 +14907,7 @@ Current version indicated by LITEVER below.
|
||||||
|
|
||||||
if(data.startsWith("data:audio"))
|
if(data.startsWith("data:audio"))
|
||||||
{
|
{
|
||||||
self_upload_audio(data,filename);
|
self_upload_audio(data,filename,false);
|
||||||
}
|
}
|
||||||
else if(data.startsWith("data:image"))
|
else if(data.startsWith("data:image"))
|
||||||
{
|
{
|
||||||
|
@ -14959,7 +14960,7 @@ Current version indicated by LITEVER below.
|
||||||
}, false, imgres,0.35,true);
|
}, false, imgres,0.35,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function self_upload_audio(origAudio,filename)
|
function self_upload_audio(origAudio,filename,modify_curr_turn=false)
|
||||||
{
|
{
|
||||||
let imgid = "selfuploadaudio"+(Math.floor(10000 + Math.random() * 90000)).toString();
|
let imgid = "selfuploadaudio"+(Math.floor(10000 + Math.random() * 90000)).toString();
|
||||||
let nimgtag = "[<|p|" + imgid + "|p|>]";
|
let nimgtag = "[<|p|" + imgid + "|p|>]";
|
||||||
|
@ -14972,8 +14973,21 @@ Current version indicated by LITEVER below.
|
||||||
{
|
{
|
||||||
nimgtag = wrap_newgen_chat_format(nimgtag);
|
nimgtag = wrap_newgen_chat_format(nimgtag);
|
||||||
}
|
}
|
||||||
|
gametext_arr.push(nimgtag);
|
||||||
}
|
}
|
||||||
gametext_arr.push(nimgtag);
|
else //can merge into last turn
|
||||||
|
{
|
||||||
|
let checklastempty = (gametext_arr.length>0 && gametext_arr[gametext_arr.length-1].replace(/\[<\|.+?\|>\]/g, "").trim()=="");
|
||||||
|
if(gametext_arr.length>0 && modify_curr_turn && !checklastempty)
|
||||||
|
{
|
||||||
|
gametext_arr[gametext_arr.length-1] += nimgtag;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gametext_arr.push(nimgtag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
image_db[imgid] = { done: false, queue: "Processing", result: "", prompt:"", poll_category:0 };
|
image_db[imgid] = { done: false, queue: "Processing", result: "", prompt:"", poll_category:0 };
|
||||||
image_db[imgid].aspect = 0;
|
image_db[imgid].aspect = 0;
|
||||||
image_db[imgid].imsource = 1; //0=generated,1=uploaded
|
image_db[imgid].imsource = 1; //0=generated,1=uploaded
|
||||||
|
@ -15179,7 +15193,7 @@ Current version indicated by LITEVER below.
|
||||||
var reader = new FileReader();
|
var reader = new FileReader();
|
||||||
reader.onloadend = function () {
|
reader.onloadend = function () {
|
||||||
var completeRecording = reader.result;
|
var completeRecording = reader.result;
|
||||||
self_upload_audio(completeRecording,"recording");
|
self_upload_audio(completeRecording,"recording",false);
|
||||||
};
|
};
|
||||||
reader.readAsDataURL(blob);
|
reader.readAsDataURL(blob);
|
||||||
stream.getTracks().forEach(function (track) {
|
stream.getTracks().forEach(function (track) {
|
||||||
|
@ -15461,7 +15475,7 @@ Current version indicated by LITEVER below.
|
||||||
var reader = new FileReader();
|
var reader = new FileReader();
|
||||||
reader.onload = function() {
|
reader.onload = function() {
|
||||||
var base64Audio = this.result;
|
var base64Audio = this.result;
|
||||||
self_upload_audio(base64Audio, "tts_audio");
|
self_upload_audio(base64Audio, "tts_audio", true);
|
||||||
};
|
};
|
||||||
reader.readAsDataURL(file);
|
reader.readAsDataURL(file);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue