diff --git a/klite.embd b/klite.embd index 50fead6b4..8c213a85a 100644 --- a/klite.embd +++ b/klite.embd @@ -4190,7 +4190,7 @@ Current version indicated by LITEVER below. function get_instruct_starttag(doTrim=true) { let instag = localsettings.instruct_starttag; - if(instag=="{{[INPUT]}}" && !(custom_kobold_endpoint != "" && is_using_kcpp_with_autotags()) && localsettings.placeholder_tags) + if(instag=="{{[INPUT]}}" && !(custom_kobold_endpoint != "" && is_using_kcpp_with_autotags())) { instag = "\n### Instruction:\n"; //backend not compatible with auto } @@ -4203,7 +4203,7 @@ Current version indicated by LITEVER below. function get_instruct_endtag(doTrim=true) { let instag = localsettings.instruct_endtag; - if(instag=="{{[OUTPUT]}}" && !(custom_kobold_endpoint != "" && is_using_kcpp_with_autotags()) && localsettings.placeholder_tags) + if(instag=="{{[OUTPUT]}}" && !(custom_kobold_endpoint != "" && is_using_kcpp_with_autotags())) { instag = "\n### Response:\n"; //backend not compatible with auto } @@ -4216,7 +4216,7 @@ Current version indicated by LITEVER below. function get_instruct_systag(doTrim=true) { let instag = localsettings.instruct_systag; - if(instag=="{{[SYSTEM]}}" && !(custom_kobold_endpoint != "" && is_using_kcpp_with_autotags()) && localsettings.placeholder_tags) + if(instag=="{{[SYSTEM]}}" && !(custom_kobold_endpoint != "" && is_using_kcpp_with_autotags())) { instag = ""; //backend not compatible with auto } @@ -16540,47 +16540,44 @@ Current version indicated by LITEVER below. { let st = get_instruct_starttag(true); let et = get_instruct_endtag(true); + let stripping_arr = []; + if(st!="") + { + stripping_arr.push(st); + } + if(et!="") + { + stripping_arr.push(et); + } if(st=="{{[INPUT]}}" || et=="{{[OUTPUT]}}") { - st = "### Instruction:"; - et = "### Response:"; + stripping_arr.push("### Instruction:"); + stripping_arr.push("### Response:"); } - let stet_et = ""; if(localsettings.separate_end_tags && get_instruct_endtag_end(true)) { - stet_et = get_instruct_endtag_end(true); + let stet_et = get_instruct_endtag_end(true); + if(stet_et!="") + { + stripping_arr.push(stet_et); + } } //sometimes the OAI type endpoints get confused and repeat the instruct tag, so trim it - let earlymatch = gentxt.indexOf(et); - if(earlymatch==0) + for(let i=0;i