mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2026-09-17 16:25:01 +02:00
updated lite
This commit is contained in:
+22
-10
@@ -12,7 +12,7 @@ Current version indicated by LITEVER below.
|
||||
-->
|
||||
|
||||
<script>
|
||||
const LITEVER = 255;
|
||||
const LITEVER = 256;
|
||||
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_";
|
||||
@@ -16082,18 +16082,30 @@ Current version indicated by LITEVER below.
|
||||
//insert authors note 80 tokens before the ending (320 characters).
|
||||
let anote_dist = anote_strength;
|
||||
let anote_insert_idx = truncated_context.length - anote_dist;
|
||||
anote_insert_idx = clamp(anote_insert_idx, 0, truncated_context.length);
|
||||
//try to align anote with a word boundary
|
||||
for(let i=0;i<15;++i)
|
||||
{
|
||||
if(anote_insert_idx>=0 && anote_insert_idx<truncated_context.length
|
||||
&& truncated_context[anote_insert_idx]!=" " && truncated_context[anote_insert_idx]!="."
|
||||
&& truncated_context[anote_insert_idx]!="!" && truncated_context[anote_insert_idx]!="?"
|
||||
&& truncated_context[anote_insert_idx]!="," && truncated_context[anote_insert_idx]!="\n")
|
||||
{
|
||||
++anote_insert_idx;
|
||||
}else{
|
||||
const maxLookahead = 30;
|
||||
let best_insert_idx = anote_insert_idx;
|
||||
let insert_preference = 0;
|
||||
for (let i = 0; i < maxLookahead && anote_insert_idx + i < truncated_context.length; ++i) {
|
||||
const char = truncated_context[anote_insert_idx + i];
|
||||
if (char == "\n") {
|
||||
best_insert_idx = anote_insert_idx + i + 1;
|
||||
insert_preference = 3;
|
||||
break;
|
||||
}
|
||||
if (insert_preference<=1 && (char == "," || char == "!" || char == "." || char == "?")) {
|
||||
best_insert_idx = anote_insert_idx + i + 1;
|
||||
insert_preference = 2;
|
||||
}
|
||||
if (insert_preference==0 && (char == " ")) {
|
||||
best_insert_idx = anote_insert_idx + i + 1;
|
||||
insert_preference = 1;
|
||||
}
|
||||
}
|
||||
if(insert_preference>0)
|
||||
{
|
||||
anote_insert_idx = best_insert_idx;
|
||||
}
|
||||
anote_insert_idx = clamp(anote_insert_idx, 0, truncated_context.length);
|
||||
truncated_context = truncated_context.slice(0, anote_insert_idx) + truncated_anote + truncated_context.slice(anote_insert_idx);
|
||||
|
||||
Reference in New Issue
Block a user