updated lite, extra error logging

This commit is contained in:
Concedo 2024-07-21 17:55:47 +08:00
parent 4d9ccddc2c
commit 0ecf13fc13
3 changed files with 111 additions and 15 deletions

View file

@ -1130,6 +1130,10 @@ ModelLoadResult gpttype_load_model(const load_model_inputs inputs, FileFormat in
useSmartContext = inputs.use_smartcontext;
useContextShift = inputs.use_contextshift;
debugmode = inputs.debugmode;
if(debugmode>0)
{
kcppstderr = true;
}
auto clamped_max_context_length = inputs.max_context_length;

View file

@ -271,17 +271,31 @@ Current version indicated by LITEVER below.
}
}
#inputrow.show_mode {
grid-template-columns: 50px auto 74px;
}
#inputrow {
margin-top: 10px;
padding: 0px;
width: 100%;
display: grid;
grid-template-columns: 0% auto 72px;
display: flex;
}
#inputrow > :nth-child(1) {
flex: 0 0 0%; /* Effectively hides the first column */
}
#inputrow > :nth-child(2) {
flex: 1; /* Flexible, takes up remaining space */
}
#inputrow > :nth-child(3) {
flex: 0 0 72px; /* Fixed width for the third column */
}
#inputrow.show_mode > :nth-child(1) {
flex: 0 0 50px; /* Fixed width for the first column */
}
#inputrow.show_mode > :nth-child(2) {
flex: 1; /* Flexible, takes up remaining space */
}
#inputrow.show_mode > :nth-child(3) {
flex: 0 0 74px; /* Fixed width for the third column */
}
.input_action
{
content:var(--img_sword);
@ -4084,6 +4098,8 @@ Current version indicated by LITEVER below.
notify_on: false,
narrate_both_sides: false,
narrate_only_dialog: false,
voice_end_delay: 300,
tts_speed: 1.0,
image_styles: "",
image_negprompt: "",
grammar:"",
@ -6166,21 +6182,57 @@ Current version indicated by LITEVER below.
}
function load_tavern_obj(obj)
{
let load_tav_obj_confirm = function(usechatmode)
let selectedgreeting = "";
let load_tav_obj_confirm_p1 = function(usechatmode) // need second input for alt greeting
{
console.log("Loading tavern obj");
if(obj.spec=="chara_card_v2" && obj.data!=null)
{
obj = obj.data;
}
selectedgreeting = obj.first_mes?obj.first_mes:"";
if(selectedgreeting == "" && obj.alternate_greetings && obj.alternate_greetings.length==1)
{
selectedgreeting = obj.alternate_greetings[0]?obj.alternate_greetings[0]:"";
}
else if(localsettings.import_tavern_prompt && obj.alternate_greetings && obj.alternate_greetings.length>0)
{
let bufGreetings = [];
if(obj.first_mes)
{
bufGreetings.push(obj.first_mes);
}
bufGreetings = bufGreetings.concat(obj.alternate_greetings);
bufGreetings = bufGreetings.slice(0,16);
let bufMsg = "<p><b><u>Select Greeting Message</u></b></p>"
for (it in bufGreetings) {
bufMsg += it + ") " + bufGreetings[it].substr(0, 64) + "...<br>"
}
inputBox(bufMsg,"Choose Greeting Message","","Number 0 to " + (bufGreetings.length-1), ()=>{
let userinput = getInputBoxValue();
userinput = parseInt(userinput);
userinput = cleannum(userinput,0,bufGreetings.length-1);
selectedgreeting = bufGreetings[userinput];
load_tav_obj_confirm_p2(usechatmode);
}, true);
} else {
load_tav_obj_confirm_p2(usechatmode);
}
};
let load_tav_obj_confirm_p2 = function(usechatmode)
{
console.log("Loading tavern obj");
let chatopponent = obj.name?obj.name:defaultchatopponent;
let myname = ((localsettings.chatname && localsettings.chatname!="")?localsettings.chatname:"User");
let memory = obj.description?("Persona: "+obj.description):"";
memory += obj.personality?("\nPersonality: "+obj.personality):"";
let scenario = obj.scenario?obj.scenario:"";
let examplemsg = obj.mes_example?obj.mes_example:"";
let greeting = obj.first_mes?obj.first_mes:"";
let sysprompt = obj.system_prompt?obj.system_prompt:"";
let greeting = selectedgreeting;
//post process
if(scenario!="")
@ -6242,14 +6294,14 @@ Current version indicated by LITEVER below.
if(localsettings.import_tavern_prompt)
{
msgboxYesNo("Import Character Card in Instruct Mode?\n\nYes = Instruct Mode Used\nNo = Chat Mode Used\n\nIf unsure, select 'No'.","Import Tavern Card", ()=>{
load_tav_obj_confirm(false);
load_tav_obj_confirm_p1(false);
},()=>{
load_tav_obj_confirm(true);
load_tav_obj_confirm_p1(true);
});
}
else
{
load_tav_obj_confirm(true);
load_tav_obj_confirm_p1(true);
}
}
function load_ooba_obj(obj)
@ -9300,6 +9352,8 @@ Current version indicated by LITEVER below.
document.getElementById("no_escape_html").checked = no_escape_html;
document.getElementById("narrate_both_sides").checked = localsettings.narrate_both_sides;
document.getElementById("narrate_only_dialog").checked = localsettings.narrate_only_dialog;
document.getElementById("tts_speed").value = localsettings.tts_speed;
document.getElementById("voice_end_delay").value = localsettings.voice_end_delay;
toggle_opmode();
//sd models display
@ -9583,6 +9637,8 @@ Current version indicated by LITEVER below.
no_escape_html = (document.getElementById("no_escape_html").checked?true:false);
localsettings.narrate_both_sides = (document.getElementById("narrate_both_sides").checked?true:false);
localsettings.narrate_only_dialog = (document.getElementById("narrate_only_dialog").checked?true:false);
localsettings.tts_speed = document.getElementById("tts_speed").value;
localsettings.voice_end_delay = document.getElementById("voice_end_delay").value;
localsettings.auto_ctxlen = (document.getElementById("auto_ctxlen").checked ? true : false);
localsettings.auto_genamt = (document.getElementById("auto_genamt").checked ? true : false);
@ -9631,6 +9687,18 @@ Current version indicated by LITEVER below.
}
}
if (isNaN(localsettings.tts_speed)) {
localsettings.tts_speed = defaultsettings.tts_speed;
} else {
localsettings.tts_speed = cleannum(localsettings.tts_speed, 0.1, 4);
}
if (isNaN(localsettings.voice_end_delay)) {
localsettings.voice_end_delay = defaultsettings.voice_end_delay;
} else {
localsettings.voice_end_delay = cleannum(localsettings.voice_end_delay, 50, 5000);
}
//validate samplers, if fail, reset to default
validate_samplers(true);
localsettings.last_selected_preset = document.getElementById("samplerpresets").value;
@ -10728,9 +10796,11 @@ Current version indicated by LITEVER below.
return;
}
let ssval = localsettings.speech_synth;
let ssrate = localsettings.tts_speed;
if(speech_synth_override!=null)
{
ssval = speech_synth_override;
ssrate = document.getElementById("tts_speed").value;
}
if(localsettings.narrate_only_dialog)
{
@ -10847,6 +10917,7 @@ Current version indicated by LITEVER below.
if ('speechSynthesis' in window) {
let utterance = new window.SpeechSynthesisUtterance(text);
utterance.voice = window.speechSynthesis.getVoices()[ssval - 1];
utterance.rate = ssrate;
window.speechSynthesis.speak(utterance);
utterance.onend = function(event) {
update_submit_button(false);
@ -10879,7 +10950,7 @@ Current version indicated by LITEVER below.
}
function ptt_end()
{
var voice_end_delay = document.getElementById("voice_end_delay").value;
var voice_end_delay = localsettings.voice_end_delay;
if(voice_typing_mode>0)
{
voice_is_speaking = false;
@ -17623,6 +17694,10 @@ Current version indicated by LITEVER below.
<div class="justifyleft settingsmall" title="Show notification when generation is complete">Notify on Done </div>
<input title="Notify On Done" type="checkbox" id="notify_on" style="margin:0px 0px 0px auto;">
</div>
<div class="inlinelabel" style="font-size: 11px;">
<div class="justifyleft">Browser TTS Speed: </div>
<input title="Browser Narration Speed" type="text" inputmode="decimal" value="1" id="tts_speed" style="width:40px">
</div>
<div class="settinglabel" style="border-top: 1px solid #12324f; margin-top: 4px;">
@ -18397,7 +18472,7 @@ Current version indicated by LITEVER below.
<div class="popupcontainer flex hidden" id="inputboxcontainer">
<div class="popupbg flex"></div>
<div class="nspopup flexsize">
<div class="nspopup flexsize moderate">
<div class="popuptitlebar">
<div class="popuptitletext" id="inputboxcontainertitle"></div>
</div>

View file

@ -132,7 +132,24 @@ static void llama_log_callback_default(ggml_log_level level, const char * text,
#define LLAMA_LOG_INFO(...) llama_log_internal(GGML_LOG_LEVEL_INFO , __VA_ARGS__)
#define LLAMA_LOG_WARN(...) llama_log_internal(GGML_LOG_LEVEL_WARN , __VA_ARGS__)
#define LLAMA_LOG_ERROR(...) llama_log_internal(GGML_LOG_LEVEL_ERROR, __VA_ARGS__)
#define LLAMA_LOG_ERROR(...) kcpp_log_internal(GGML_LOG_LEVEL_ERROR, __VA_ARGS__)
static bool kcppstderr = false;
static void kcpp_log_internal(ggml_log_level level, const char * format, ...) {
if (kcppstderr) {
printf("\n");
va_list args;
va_start(args, format);
vprintf(format, args);
va_end(args);
fflush(stdout);
}
va_list args2;
va_start(args2, format);
llama_log_internal(level, format, args2);
va_end(args2);
}
//
// helpers