Skip to content

Commit 10124d8

Browse files
author
prima
committed
Merge remote-tracking branch 'origin/concedo_experimental' into remoteManagement
2 parents 9e42c89 + 8b5ebfc commit 10124d8

File tree

2 files changed

+77
-12
lines changed

2 files changed

+77
-12
lines changed

kcpp_adapters/AutoGuess.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,17 @@
3232
"assistant_start": "<|im_assistant|>assistant<|im_middle|>",
3333
"assistant_end": "<|im_end|>"
3434
}
35+
}, {
36+
"search": ["<|im_user|>", "<|im_system|>system<|im_middle|>", "<|im_end|>"],
37+
"name": "ChatML (Kimi Alternate)",
38+
"adapter": {
39+
"system_start": "<|im_system|>system<|im_middle|>",
40+
"system_end": "<|im_end|>",
41+
"user_start": "<|im_user|>user<|im_middle|>",
42+
"user_end": "<|im_end|>",
43+
"assistant_start": "<|im_assistant|>assistant<|im_middle|>",
44+
"assistant_end": "<|im_end|>"
45+
}
3546
}, {
3647
"search": ["System role not supported", "<start_of_turn>"],
3748
"name": "Google Gemma 2",

klite.embd

Lines changed: 66 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7707,6 +7707,10 @@ Current version indicated by LITEVER below.
77077707
if (userinput != null && userinput!="") {
77087708
localsettings.saved_oai_tts_key = userinput.trim();
77097709
}
7710+
else
7711+
{
7712+
localsettings.saved_oai_tts_key = "";
7713+
}
77107714
},false,false,true);
77117715
}
77127716
function set_oai_tts_url()
@@ -16318,11 +16322,16 @@ Current version indicated by LITEVER below.
1631816322
}
1631916323
userinput = userinput.trim();
1632016324
if (userinput != null && userinput!="" && ssval > 0) {
16321-
tts_speak(userinput,downloadtts,embedtts);
16325+
tts_speak(userinput,downloadtts,embedtts,false);
1632216326
}
1632316327
},true);
1632416328
}
1632516329

16330+
function test_tts()
16331+
{
16332+
tts_speak("Hello there, this is a test.",false,false,true);
16333+
}
16334+
1632616335
function toggle_tts_mode()
1632716336
{
1632816337
document.getElementById("xtts_container").classList.add("hidden");
@@ -16485,7 +16494,7 @@ Current version indicated by LITEVER below.
1648516494
}
1648616495

1648716496
var ttsIsBeingGenerated = false
16488-
function tts_speak(text, do_download=false, do_embed_tts=false)
16497+
function tts_speak(text, do_download=false, do_embed_tts=false, is_test=false)
1648916498
{
1649016499
if(!text || text=="" || text.trim()=="")
1649116500
{
@@ -16495,7 +16504,20 @@ Current version indicated by LITEVER below.
1649516504
let ssval = localsettings.tts_mode;
1649616505
let ssrate = localsettings.tts_speed;
1649716506
let vcjson = localsettings.kcpp_tts_json;
16498-
if(localsettings.narrate_only_dialog)
16507+
let narrateonlydialog = localsettings.narrate_only_dialog;
16508+
let pickedwebvoice = localsettings.wb_tts_choice;
16509+
16510+
if(is_test)
16511+
{
16512+
//testing from settings page
16513+
ssval = document.getElementById("ttsselect").value;
16514+
ssrate = document.getElementById("tts_speed").value;
16515+
vcjson = kcpp_tts_json;
16516+
narrateonlydialog = false;
16517+
pickedwebvoice = document.getElementById("wb_tts_choice").value;
16518+
}
16519+
16520+
if(narrateonlydialog)
1649916521
{
1650016522
// Remove text within asterisks and the asterisks, then trim
1650116523
text = text.replace(italics_regex,"").trim();
@@ -16863,14 +16885,13 @@ Current version indicated by LITEVER below.
1686316885
else if(ssval==WEBBROWSER_TTS_ID)
1686416886
{
1686516887
let voicelist = window.speechSynthesis.getVoices();
16866-
let pickedvoice = localsettings.wb_tts_choice;
16867-
if(pickedvoice > voicelist.length)
16888+
if(pickedwebvoice > voicelist.length)
1686816889
{
16869-
pickedvoice = 0;
16890+
pickedwebvoice = 0;
1687016891
}
1687116892
if ('speechSynthesis' in window) {
1687216893
let utterance = new window.SpeechSynthesisUtterance(text);
16873-
utterance.voice = voicelist[pickedvoice];
16894+
utterance.voice = voicelist[pickedwebvoice];
1687416895
utterance.rate = ssrate;
1687516896
window.speechSynthesis.speak(utterance);
1687616897
utterance.onend = function(event) {
@@ -17109,7 +17130,7 @@ Current version indicated by LITEVER below.
1710917130
{
1711017131
if(localsettings.narrate_targets==2)
1711117132
{
17112-
tts_speak(newgen,false,localsettings.embed_narrations);
17133+
tts_speak(newgen,false,localsettings.embed_narrations,false);
1711317134
}
1711417135
}
1711517136

@@ -18209,7 +18230,39 @@ Current version indicated by LITEVER below.
1820918230
}
1821018231
else //auto role
1821118232
{
18212-
let mhistory = repack_instruct_history(mainoaibody);
18233+
let mhistory = null;
18234+
if (typeof mainoaibody === 'string' || mainoaibody instanceof String)
18235+
{
18236+
mhistory = repack_instruct_history(mainoaibody);
18237+
}
18238+
else
18239+
{
18240+
//it's an object/array, so repack the text turn
18241+
let t1 = mainoaibody[0].text;
18242+
mhistory = repack_instruct_history(t1);
18243+
18244+
//many backends REFUSE to allow the assistant to go first. If the first turn belongs to assistant, we turn it into user
18245+
if(mhistory.length>0 && !mhistory[0].myturn)
18246+
{
18247+
mhistory[0].myturn = true;
18248+
}
18249+
//if both first and second turns are from user, merge them into one turn
18250+
if(mhistory.length>1 && mhistory[0].myturn && mhistory[1].myturn)
18251+
{
18252+
mhistory[0].msg += "\n"+mhistory[1].msg;
18253+
mhistory.splice(1, 1);
18254+
}
18255+
18256+
if(mhistory.length>0 && mainoaibody.length>1 && mainoaibody[1].type && mainoaibody[1].type!="text")
18257+
{
18258+
mhistory[0].msg = [{type: 'text', text: mhistory[0].msg}];
18259+
for(let i=1;i<mainoaibody.length;++i)
18260+
{
18261+
mhistory[0].msg.push(mainoaibody[i]);
18262+
}
18263+
}
18264+
}
18265+
1821318266
for(let i=0;i<mhistory.length;++i)
1821418267
{
1821518268
oai_payload.messages.push({ "role": (mhistory[i].myturn?"user":"assistant"), "content": mhistory[i].msg });
@@ -19966,7 +20019,7 @@ Current version indicated by LITEVER below.
1996620019

1996720020
if(localsettings.narrate_targets != 0)
1996820021
{
19969-
tts_speak(gentxtspeak,false,localsettings.embed_narrations);
20022+
tts_speak(gentxtspeak,false,localsettings.embed_narrations,false);
1997020023
}
1997120024
}
1997220025

@@ -21543,7 +21596,7 @@ Current version indicated by LITEVER below.
2154321596
let box2 = document.getElementById("chat_msg_body");
2154421597
let box3 = document.getElementById("corpostylemain");
2154521598
function isScrolledToBottom(element) {
21546-
return element.scrollHeight - element.scrollTop <= element.clientHeight + 250;
21599+
return element.scrollHeight - element.scrollTop - element.clientHeight <= 60;
2154721600
}
2154821601
if(alwaysscroll || isScrolledToBottom(box1))
2154921602
{
@@ -26772,7 +26825,7 @@ Current version indicated by LITEVER below.
2677226825
<div class="settingitem">
2677326826
<div class="settinglabel">
2677426827
<div class="justifyleft settingsmall" style="width: 100%;">Text To Speech <span class="helpicon">?<span class="helptext">Enable Text-To-Speech to have your story automatically read to you.</span></span></div>
26775-
<select title="Text To Speech" class="form-control" id="ttsselect" style="font-size: var(--theme_font_size_medium);height:20px;padding:0;margin:0px 0 0;width:calc(100%);" onchange="toggle_tts_mode()">
26828+
<select title="Text To Speech" class="form-control" id="ttsselect" style="font-size: var(--theme_font_size_medium);height:20px;padding:0;margin:0px 0 0;width:calc(100% - 35px);" onchange="toggle_tts_mode()">
2677626829
<option value="0">Disabled</option>
2677726830
<option value="1">Browser Inbuilt TTS</option>
2677826831
<option value="2">KoboldCpp TTS API</option>
@@ -26781,6 +26834,7 @@ Current version indicated by LITEVER below.
2678126834
<option value="5">OpenAI-Compat. API Server</option>
2678226835
<option value="6">PollinationsAI TTS API</option>
2678326836
</select>
26837+
<button id="manual_tts" type="button" class="bg_green btn btn-primary" style="height:20px; width:30px; padding:2px 3px;font-size:11px; margin-left: 2px;" onclick="test_tts()">Test</button>
2678426838
<div id="xtts_container" class="settinglabel hidden">
2678526839
<div>
2678626840
<table width="100%"><tr>

0 commit comments

Comments
 (0)