mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2025-09-16 03:49:42 +00:00
update lite and readme
This commit is contained in:
parent
cb93aa5243
commit
7ef31e541c
2 changed files with 98 additions and 55 deletions
|
@ -64,7 +64,7 @@ when you can't use the precompiled binary directly, we provide an automated buil
|
||||||
- Note: Many OSX users have found that the using Accelerate is actually faster than OpenBLAS. To try, you may wish to run with `--noblas` and compare speeds.
|
- Note: Many OSX users have found that the using Accelerate is actually faster than OpenBLAS. To try, you may wish to run with `--noblas` and compare speeds.
|
||||||
|
|
||||||
### Arch Linux Packages
|
### Arch Linux Packages
|
||||||
There are some community made AUR packages (Maintained by @AlpinDale) available: [CUBLAS](https://aur.archlinux.org/packages/koboldcpp-cuda), and [HIPBLAS](https://aur.archlinux.org/packages/koboldcpp-hipblas). They are intended for users with NVIDIA GPUs, and users with a supported AMD GPU. Note that these packages may be outdated, and it's probably better to use official KoboldCpp binaries.
|
There are some community made AUR packages available: [CUBLAS](https://aur.archlinux.org/packages/koboldcpp-cuda), and [HIPBLAS](https://aur.archlinux.org/packages/koboldcpp-hipblas). They are intended for users with NVIDIA GPUs, and users with a supported AMD GPU. Note that these packages may be outdated, and it's probably better to use official KoboldCpp binaries.
|
||||||
|
|
||||||
## Compiling on Windows
|
## Compiling on Windows
|
||||||
- You're encouraged to use the .exe released, but if you want to compile your binaries from source at Windows, the easiest way is:
|
- You're encouraged to use the .exe released, but if you want to compile your binaries from source at Windows, the easiest way is:
|
||||||
|
|
151
klite.embd
151
klite.embd
|
@ -3747,10 +3747,12 @@ Current version: 143
|
||||||
var logitbiasdict = {};
|
var logitbiasdict = {};
|
||||||
var regexreplace_data = [];
|
var regexreplace_data = [];
|
||||||
var placeholder_tags_data = [];
|
var placeholder_tags_data = [];
|
||||||
var voice_typing_enabled = false; //did user toggle on voice typing
|
var voice_typing_mode = 0; //0=off, 1=on, 2=ptt
|
||||||
var koboldcpp_has_whisper = false; //does backend support voice typing
|
var koboldcpp_has_whisper = false; //does backend support voice typing
|
||||||
var voice_is_recording = false; //currently recording voice?
|
var voice_is_recording = false; //currently recording voice?
|
||||||
var voice_is_processing = false; //currently processing voice?
|
var voice_is_processing = false; //currently processing voice?
|
||||||
|
let voiceprerecorder = null, voicerecorder = null, voice_is_speaking = false, voice_speaking_counter = 0;
|
||||||
|
let preaudiobuffers = [], preaudioblobs = []; //will store 2 preblobs at a time
|
||||||
const num_regex_rows = 4;
|
const num_regex_rows = 4;
|
||||||
|
|
||||||
var localsettings = {
|
var localsettings = {
|
||||||
|
@ -8996,8 +8998,8 @@ Current version: 143
|
||||||
localsettings.sampler_seed = cleannum(localsettings.sampler_seed, -1, 999999);
|
localsettings.sampler_seed = cleannum(localsettings.sampler_seed, -1, 999999);
|
||||||
toggle_invert_colors();
|
toggle_invert_colors();
|
||||||
|
|
||||||
voice_typing_enabled = (document.getElementById("voice_typing_mode").checked?true:false);
|
voice_typing_mode = document.getElementById("voice_typing_mode").value;
|
||||||
if(voice_typing_enabled && is_using_kcpp_with_whisper())
|
if(voice_typing_mode>0 && is_using_kcpp_with_whisper())
|
||||||
{
|
{
|
||||||
init_voice_typing();
|
init_voice_typing();
|
||||||
}
|
}
|
||||||
|
@ -10161,6 +10163,66 @@ Current version: 143
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ptt_start()
|
||||||
|
{
|
||||||
|
if(voice_typing_mode>0)
|
||||||
|
{
|
||||||
|
voice_is_speaking = true;
|
||||||
|
++voice_speaking_counter;
|
||||||
|
if(ready_to_record())
|
||||||
|
{
|
||||||
|
if (voicerecorder.state === "inactive") {
|
||||||
|
if (voiceprerecorder.state !== "inactive") {
|
||||||
|
voiceprerecorder.stop();
|
||||||
|
}
|
||||||
|
voicerecorder.start();
|
||||||
|
}
|
||||||
|
voice_is_recording = true;
|
||||||
|
update_submit_button(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function ptt_end()
|
||||||
|
{
|
||||||
|
if(voice_typing_mode>0)
|
||||||
|
{
|
||||||
|
voice_is_speaking = false;
|
||||||
|
let check_speak_counter = voice_speaking_counter;
|
||||||
|
setTimeout(() => {
|
||||||
|
if (voice_is_recording && !voice_is_speaking && voice_speaking_counter == check_speak_counter) {
|
||||||
|
//generate prerecorder blobs (prebuffer 1sec)
|
||||||
|
preaudioblobs = [];
|
||||||
|
if(voice_typing_mode==1)
|
||||||
|
{
|
||||||
|
for(let i=0;i<preaudiobuffers.length;++i)
|
||||||
|
{
|
||||||
|
preaudioblobs.push(new Blob([preaudiobuffers[i]], { type: 'audio/webm' }));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (voicerecorder.state !== "inactive") {
|
||||||
|
voicerecorder.stop();
|
||||||
|
}
|
||||||
|
voice_is_recording = false;
|
||||||
|
update_submit_button(false);
|
||||||
|
}
|
||||||
|
}, 500); //prevent premature stopping
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function submit_generation_button(aesthetic_ui)
|
||||||
|
{
|
||||||
|
if(voice_typing_mode==0) //only when voice is off
|
||||||
|
{
|
||||||
|
if(aesthetic_ui)
|
||||||
|
{
|
||||||
|
submit_generation();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
chat_submit_generation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function submit_generation() {
|
function submit_generation() {
|
||||||
|
|
||||||
let newgen = document.getElementById("input_text").value;
|
let newgen = document.getElementById("input_text").value;
|
||||||
|
@ -12511,7 +12573,7 @@ Current version: 143
|
||||||
if ('speechSynthesis' in window) {
|
if ('speechSynthesis' in window) {
|
||||||
currentlySpeaking = window.speechSynthesis.speaking;
|
currentlySpeaking = window.speechSynthesis.speaking;
|
||||||
}
|
}
|
||||||
return (voice_typing_enabled && is_using_kcpp_with_whisper()
|
return (voice_typing_mode>0 && is_using_kcpp_with_whisper()
|
||||||
&& !document.getElementById("btnsend").disabled
|
&& !document.getElementById("btnsend").disabled
|
||||||
&& !voice_is_processing && !voice_is_recording && isVoiceInputConfigured
|
&& !voice_is_processing && !voice_is_recording && isVoiceInputConfigured
|
||||||
&& !currentlySpeaking && !xtts_is_playing && !is_popup_open());
|
&& !currentlySpeaking && !xtts_is_playing && !is_popup_open());
|
||||||
|
@ -12523,7 +12585,7 @@ Current version: 143
|
||||||
if(navigator.mediaDevices==null)
|
if(navigator.mediaDevices==null)
|
||||||
{
|
{
|
||||||
msgbox("Cannot initialize microphone. If you're using a non-localhost URL, it needs to be served over HTTPS!","Error Starting Microphone");
|
msgbox("Cannot initialize microphone. If you're using a non-localhost URL, it needs to be served over HTTPS!","Error Starting Microphone");
|
||||||
voice_typing_enabled = document.getElementById("voice_typing_mode").checked = false;
|
voice_typing_mode = document.getElementById("voice_typing_mode").checked = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (isVoiceInputConfigured) {
|
if (isVoiceInputConfigured) {
|
||||||
|
@ -12609,7 +12671,6 @@ Current version: 143
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
let prerecorder, preaudiobuffers = [], preaudioblobs = []; //will store 2 preblobs at a time
|
|
||||||
let onRecordingReady = function (e) {
|
let onRecordingReady = function (e) {
|
||||||
let completeRecording = new Blob([e.data], { type: 'audio/webm' });
|
let completeRecording = new Blob([e.data], { type: 'audio/webm' });
|
||||||
let audiodatareader = new window.FileReader();
|
let audiodatareader = new window.FileReader();
|
||||||
|
@ -12617,7 +12678,7 @@ Current version: 143
|
||||||
if(preaudioblobs.length<2)
|
if(preaudioblobs.length<2)
|
||||||
{
|
{
|
||||||
audioBlobToDecodedAudioBuffer(completeRecording,(buffer)=>{
|
audioBlobToDecodedAudioBuffer(completeRecording,(buffer)=>{
|
||||||
let wavblob = audioBufferToWavBlob(finalbuf);
|
let wavblob = audioBufferToWavBlob(buffer);
|
||||||
audiodatareader.readAsDataURL(wavblob);
|
audiodatareader.readAsDataURL(wavblob);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -12640,13 +12701,12 @@ Current version: 143
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
let recorder, is_speaking = false, speaking_counter = 0;
|
|
||||||
// get audio stream from user's mic
|
// get audio stream from user's mic
|
||||||
navigator.mediaDevices.getUserMedia({
|
navigator.mediaDevices.getUserMedia({
|
||||||
audio: true
|
audio: true
|
||||||
}).then(function (stream) {
|
}).then(function (stream) {
|
||||||
prerecorder = new MediaRecorder(stream);
|
voiceprerecorder = new MediaRecorder(stream);
|
||||||
prerecorder.addEventListener('dataavailable', (ev)=>{
|
voiceprerecorder.addEventListener('dataavailable', (ev)=>{
|
||||||
preaudiobuffers.push(ev.data);
|
preaudiobuffers.push(ev.data);
|
||||||
if(preaudiobuffers.length>2)
|
if(preaudiobuffers.length>2)
|
||||||
{
|
{
|
||||||
|
@ -12654,55 +12714,33 @@ Current version: 143
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
setInterval(()=>{
|
setInterval(()=>{
|
||||||
if (prerecorder.state !== "inactive") {
|
if (voiceprerecorder.state !== "inactive") {
|
||||||
prerecorder.stop();
|
voiceprerecorder.stop();
|
||||||
}
|
}
|
||||||
if(ready_to_record()){
|
if(ready_to_record() && voice_typing_mode==1){ //only voice detect needs it
|
||||||
prerecorder.start();
|
voiceprerecorder.start();
|
||||||
}
|
}
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
recorder = new MediaRecorder(stream);
|
voicerecorder = new MediaRecorder(stream);
|
||||||
recorder.addEventListener('dataavailable', onRecordingReady);
|
voicerecorder.addEventListener('dataavailable', onRecordingReady);
|
||||||
window.AudioContext = window.AudioContext || window.webkitAudioContext;
|
window.AudioContext = window.AudioContext || window.webkitAudioContext;
|
||||||
let audioContext = new AudioContext({ sampleRate: 16000 });
|
let audioContext = new AudioContext({ sampleRate: 16000 });
|
||||||
let source = audioContext.createMediaStreamSource(stream);
|
let source = audioContext.createMediaStreamSource(stream);
|
||||||
let options = {
|
let options = {
|
||||||
source: source,
|
source: source,
|
||||||
voice_stop: function () {
|
voice_stop: function () {
|
||||||
is_speaking = false;
|
if(voice_typing_mode==1)
|
||||||
let check_speak_counter = speaking_counter;
|
{
|
||||||
console.log("speech stopped");
|
console.log("speech stopped");
|
||||||
setTimeout(() => {
|
ptt_end();
|
||||||
if (voice_is_recording && !is_speaking && speaking_counter == check_speak_counter) {
|
}
|
||||||
//generate prerecorder blobs (prebuffer 1sec)
|
|
||||||
preaudioblobs = [];
|
|
||||||
for(let i=0;i<preaudiobuffers.length;++i)
|
|
||||||
{
|
|
||||||
preaudioblobs.push(new Blob([preaudiobuffers[i]], { type: 'audio/webm' }));
|
|
||||||
}
|
|
||||||
if (recorder.state !== "inactive") {
|
|
||||||
recorder.stop();
|
|
||||||
}
|
|
||||||
voice_is_recording = false;
|
|
||||||
update_submit_button(false);
|
|
||||||
}
|
|
||||||
}, 500); //prevent premature stopping
|
|
||||||
},
|
},
|
||||||
voice_start: function () {
|
voice_start: function () {
|
||||||
is_speaking = true;
|
if(voice_typing_mode==1)
|
||||||
++speaking_counter;
|
|
||||||
console.log("speech started");
|
|
||||||
if(ready_to_record())
|
|
||||||
{
|
{
|
||||||
if (recorder.state === "inactive") {
|
console.log("speech started");
|
||||||
if (prerecorder.state !== "inactive") {
|
ptt_start();
|
||||||
prerecorder.stop();
|
|
||||||
}
|
|
||||||
recorder.start();
|
|
||||||
}
|
|
||||||
voice_is_recording = true;
|
|
||||||
update_submit_button(false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -12716,7 +12754,8 @@ Current version: 143
|
||||||
update_submit_button(false);
|
update_submit_button(false);
|
||||||
|
|
||||||
let payload = {
|
let payload = {
|
||||||
"audio_data": dataurl
|
"audio_data": dataurl,
|
||||||
|
"prompt": ""
|
||||||
};
|
};
|
||||||
fetch(apply_proxy_url(custom_kobold_endpoint + koboldcpp_transcribe_endpoint), {
|
fetch(apply_proxy_url(custom_kobold_endpoint + koboldcpp_transcribe_endpoint), {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
@ -13249,7 +13288,7 @@ Current version: 143
|
||||||
document.getElementById("chat_msg_send_btn").classList.remove("showmic");
|
document.getElementById("chat_msg_send_btn").classList.remove("showmic");
|
||||||
document.getElementById("chat_msg_send_btn").classList.remove("showmiclive");
|
document.getElementById("chat_msg_send_btn").classList.remove("showmiclive");
|
||||||
document.getElementById("chat_msg_send_btn").classList.remove("showmicoff");
|
document.getElementById("chat_msg_send_btn").classList.remove("showmicoff");
|
||||||
if(voice_typing_enabled && is_using_kcpp_with_whisper())
|
if(voice_typing_mode>0 && is_using_kcpp_with_whisper())
|
||||||
{
|
{
|
||||||
if (voice_is_processing) {
|
if (voice_is_processing) {
|
||||||
document.getElementById("chat_msg_send_btn").classList.add("showmicoff");
|
document.getElementById("chat_msg_send_btn").classList.add("showmicoff");
|
||||||
|
@ -13259,7 +13298,7 @@ Current version: 143
|
||||||
document.getElementById("btnsend").innerHTML = "<div class='showmiclivebig'></div><span style='font-size:12px'>Record</span>";
|
document.getElementById("btnsend").innerHTML = "<div class='showmiclivebig'></div><span style='font-size:12px'>Record</span>";
|
||||||
} else if (ready_to_record()) {
|
} else if (ready_to_record()) {
|
||||||
document.getElementById("chat_msg_send_btn").classList.add("showmic");
|
document.getElementById("chat_msg_send_btn").classList.add("showmic");
|
||||||
document.getElementById("btnsend").innerHTML = "<div class='showmicbig'></div><span style='font-size:12px'>Standby</span>";
|
document.getElementById("btnsend").innerHTML = "<div class='showmicbig'></div><span style='font-size:12px'>"+(voice_typing_mode==1?"Standby":"PTT")+"</span>";
|
||||||
} else {
|
} else {
|
||||||
document.getElementById("chat_msg_send_btn").classList.add("showmicoff");
|
document.getElementById("chat_msg_send_btn").classList.add("showmicoff");
|
||||||
document.getElementById("btnsend").innerHTML = "<div class='showmicoffbig'></div><span style='font-size:12px'>Busy</span>";
|
document.getElementById("btnsend").innerHTML = "<div class='showmicoffbig'></div><span style='font-size:12px'>Busy</span>";
|
||||||
|
@ -15227,7 +15266,7 @@ Current version: 143
|
||||||
</div>
|
</div>
|
||||||
<div id="inputrowright" style="padding-right: 2px;">
|
<div id="inputrowright" style="padding-right: 2px;">
|
||||||
<button type="button" class="btn btn-secondary wait" id="btnsend" disabled
|
<button type="button" class="btn btn-secondary wait" id="btnsend" disabled
|
||||||
onclick="submit_generation()">Loading</button>
|
onclick="submit_generation_button(false)" onmousedown="ptt_start()" onmouseup="ptt_end()">Loading</button>
|
||||||
<a href="#" id="abortgen" class="hidden bg_black" style="text-align: center;color: #ffaaaa;" onclick="abort_generation()"><b style="display: block;">[ABORT]</b></a>
|
<a href="#" id="abortgen" class="hidden bg_black" style="text-align: center;color: #ffaaaa;" onclick="abort_generation()"><b style="display: block;">[ABORT]</b></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -15261,7 +15300,7 @@ Current version: 143
|
||||||
<div class="cht_inp_bg_inner" id="cht_inp_lengthtester" style="white-space: nowrap; visibility: hidden; height: 0px; position:absolute; width: auto;"></div>
|
<div class="cht_inp_bg_inner" id="cht_inp_lengthtester" style="white-space: nowrap; visibility: hidden; height: 0px; position:absolute; width: auto;"></div>
|
||||||
<textarea class="cht_inp_bg_inner" id="cht_inp" type="text" name="chtchtinp" role="presentation" autocomplete="noppynop" spellcheck="true" rows="1" wrap="on" placeholder="Type a message" value="" oninput="update_submit_button();chat_resize_input();" onkeypress="return chat_handle_typing(event)"/></textarea>
|
<textarea class="cht_inp_bg_inner" id="cht_inp" type="text" name="chtchtinp" role="presentation" autocomplete="noppynop" spellcheck="true" rows="1" wrap="on" placeholder="Type a message" value="" oninput="update_submit_button();chat_resize_input();" onkeypress="return chat_handle_typing(event)"/></textarea>
|
||||||
</div>
|
</div>
|
||||||
<button onclick="chat_submit_generation()" id="chat_msg_send_btn" class="chat_msg_send_btn" type="button"></button>
|
<button onclick="submit_generation_button(true)" onmousedown="ptt_start()" onmouseup="ptt_end()" id="chat_msg_send_btn" class="chat_msg_send_btn" type="button"></button>
|
||||||
<button onclick="abort_generation()" id="chat_msg_send_btn_abort" class="hidden chat_msg_send_btn_abort" type="button"></button>
|
<button onclick="abort_generation()" id="chat_msg_send_btn_abort" class="hidden chat_msg_send_btn_abort" type="button"></button>
|
||||||
<button type="button" class="chat_msg_cust_btn" id="btn_chat_cust" onclick="chat_toggle_actionmenu()"></button>
|
<button type="button" class="chat_msg_cust_btn" id="btn_chat_cust" onclick="chat_toggle_actionmenu()"></button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -16103,9 +16142,13 @@ Current version: 143
|
||||||
<input type="checkbox" id="notify_on" style="margin:0px 0 0;">
|
<input type="checkbox" id="notify_on" style="margin:0px 0 0;">
|
||||||
</div>
|
</div>
|
||||||
<div class="settinglabel">
|
<div class="settinglabel">
|
||||||
<div class="justifyleft settingsmall" title="">Voice Typing Mode <span class="helpicon">?<span
|
<div class="justifyleft settingsmall" title="">Speech Control <span class="helpicon">?<span
|
||||||
class="helptext">Requires KoboldCpp with Whisper model loaded. Enables Speech-To-Text voice input. Automatically submits text after input.</span></span></div>
|
class="helptext">Requires KoboldCpp with Whisper model loaded. Enables Speech-To-Text voice input. Automatically listens for speech in 'On' mode (Voice Detection), or use Push-To-Talk (PTT).</span></span></div>
|
||||||
<input type="checkbox" id="voice_typing_mode" style="margin:0px 0px 0px auto;">
|
<select style="padding:1px; height:auto; width: 60px; appearance: none; font-size: 6pt; margin:0px 0px 0px auto;" class="form-control" id="voice_typing_mode">
|
||||||
|
<option value="0">Off</option>
|
||||||
|
<option value="1">Detect Voice</option>
|
||||||
|
<option value="2">Push-To-Talk</option>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<button id="resetallsettings" type="button" class="btn btn-primary bg_red" style="padding:2px 3px;margin-top:2px;font-size:11px;" onclick="reset_all_settings()">Reset ALL Settings</button>
|
<button id="resetallsettings" type="button" class="btn btn-primary bg_red" style="padding:2px 3px;margin-top:2px;font-size:11px;" onclick="reset_all_settings()">Reset ALL Settings</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue