fix alpaca leak too broad

This commit is contained in:
Concedo 2025-05-24 18:26:04 +08:00
parent 0dca953d78
commit bd7a40f326

View file

@ -12,7 +12,7 @@ Current version indicated by LITEVER below.
-->
<script>
const LITEVER = 244;
const LITEVER = 245;
const urlParams = new URLSearchParams(window.location.search);
var localflag = urlParams.get('local'); //this will be replaced automatically in embedded kcpp
const STORAGE_PREFIX = (localflag?"e_":"")+"kaihordewebui_";
@ -16905,9 +16905,9 @@ Current version indicated by LITEVER below.
gentxt = trim_extra_stop_seqs(gentxt,false);
//fix alpaca leakage
if(localsettings.fix_alpaca_leak && (localsettings.opmode == 2 || localsettings.opmode == 3 || localsettings.opmode == 4) && (get_instruct_starttag(true)=="{{[INPUT]}}" || get_instruct_starttag(true).toLowerCase().includes("### instruction")))
if(localsettings.fix_alpaca_leak && (localsettings.opmode == 2 || localsettings.opmode == 3 || localsettings.opmode == 4) && (get_instruct_starttag(true).toLowerCase().includes("### instruction")))
{
let matches = gentxt.match(/\n### (instruction|response)\n|\n### ([^\s]+?):\n/gi);
let matches = gentxt.match(/\n### (instruction|response)\n|\n### (instruction|response):\n/gi);
for(let m in matches)
{
let foundStop = gentxt.indexOf(matches[m]);