updated lite

This commit is contained in:
Concedo 2025-06-18 21:06:24 +08:00
parent e35c6b8f9b
commit 268b6f76df

View file

@ -3368,7 +3368,6 @@ Current version indicated by LITEVER below.
render_streaming_markdown: true,
raw_instruct_tags: false, //experimental flag
show_endpoint_selector: false,
never_rewind_ctx: false,
//section migrated from story itself
extrastopseq: "",
@ -12468,7 +12467,6 @@ Current version indicated by LITEVER below.
document.getElementById("instruct_endtag_end").value = localsettings.instruct_endtag_end;
document.getElementById("raw_instruct_tags").checked = localsettings.raw_instruct_tags;
document.getElementById("show_endpoint_selector").checked = localsettings.show_endpoint_selector;
document.getElementById("never_rewind_ctx").checked = localsettings.never_rewind_ctx;
document.getElementById("render_streaming_markdown").checked = localsettings.render_streaming_markdown;
document.getElementById("min_p").value = localsettings.min_p;
document.getElementById("dynatemp_range").value = localsettings.dynatemp_range;
@ -12997,7 +12995,6 @@ Current version indicated by LITEVER below.
localsettings.persist_session = (document.getElementById("persist_session").checked ? true : false);
localsettings.raw_instruct_tags = (document.getElementById("raw_instruct_tags").checked ? true : false);
localsettings.show_endpoint_selector = (document.getElementById("show_endpoint_selector").checked ? true : false);
localsettings.never_rewind_ctx = (document.getElementById("never_rewind_ctx").checked ? true : false);
localsettings.render_streaming_markdown = (document.getElementById("render_streaming_markdown").checked ? true : false);
if(document.getElementById("opmode").value==1)
{
@ -13951,7 +13948,7 @@ Current version indicated by LITEVER below.
input = input.replace(/</g, "");
input = input.replace(/(?:javascript|vbscript|file):/gi, "");
//remove all data elements that aren't jpg, png, gif, webp;base64
input = input.replace(/data:(?!image\/(jpeg|png|gif|webp);base64,)[^)'";\s]*/gi, "");
input = input.replace(/data:(?!image\/(jpeg|jpg|png|gif|webp);base64,)[^;\s]*(?:;[^,\s]*)*(?:,[^)\s'"]*)?/gi, "");
return input;
}
function apply_custom_css()
@ -15384,7 +15381,7 @@ Current version indicated by LITEVER below.
//if there is no memory, then we can be a lot of lenient with the character counts since the backend will truncate excess anyway
chars_per_token = 4.8;
}
if (is_using_kcpp_with_added_memory() && !localsettings.never_rewind_ctx) //easily handle overflow
if (is_using_kcpp_with_added_memory()) //easily handle overflow
{
chars_per_token = 6;
}
@ -16061,7 +16058,7 @@ Current version indicated by LITEVER below.
{
truncated_memory = replace_placeholders(truncated_memory,false,false,true);
truncated_anote = replace_placeholders(truncated_anote,false,false,false);
if(!is_using_kcpp_with_added_memory() || localsettings.never_rewind_ctx)
if(!is_using_kcpp_with_added_memory())
{
let augmented_len = truncated_memory.length + truncated_context.length + truncated_anote.length;
let excess_len = augmented_len - max_allowed_characters; //if > 0, then we exceeded context window
@ -16088,7 +16085,7 @@ Current version indicated by LITEVER below.
}
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);
if(!is_using_kcpp_with_added_memory() || localsettings.never_rewind_ctx)
if(!is_using_kcpp_with_added_memory())
{
truncated_context = truncated_memory + truncated_context;
}
@ -16096,7 +16093,7 @@ Current version indicated by LITEVER below.
truncated_context = replace_placeholders(truncated_context,false,false,true);
if(is_using_kcpp_with_added_memory() && !localsettings.never_rewind_ctx)
if(is_using_kcpp_with_added_memory())
{
last_token_budget = (truncated_memory.length + truncated_context.length) + "/" + max_allowed_characters;
}
@ -16126,7 +16123,7 @@ Current version indicated by LITEVER below.
"models": selected_models.map((m) => { return m.name }),
};
if(is_using_kcpp_with_added_memory() && !localsettings.never_rewind_ctx)
if(is_using_kcpp_with_added_memory())
{
submit_payload.params.memory = truncated_memory;
submit_payload.params.trim_stop = true;
@ -21123,7 +21120,7 @@ Current version indicated by LITEVER below.
const kcppEmbeddingDropdownOption = Array.from(providerdropdown.options).find(opt => opt.value === "2");
if(is_using_kcpp_with_embeddings())
{
kcppEmbeddingDropdownOption.disabled = false;
kcppEmbeddingDropdownOption.classList.remove("hidden");
}
else
{
@ -21131,7 +21128,7 @@ Current version indicated by LITEVER below.
{
document.getElementById("documentdb_provider").value = 1;
}
kcppEmbeddingDropdownOption.disabled = true;
kcppEmbeddingDropdownOption.classList.add("hidden");
}
toggle_documentdb_provider();
}
@ -22708,7 +22705,7 @@ Current version indicated by LITEVER below.
const embedding = yield generateNewEmbedding(documentContent);
if (embedding && embedding.data && embedding.data.length > 0 && embedding.data[0].embedding) {
const newembedding = {
document: documentName ? documentName : "None",
document: documentName ? documentName : "",
hash: hash,
embedding: embedding.data[0].embedding,
snippet: documentContent,
@ -23170,6 +23167,7 @@ Current version indicated by LITEVER below.
const containerRect = gametext.getBoundingClientRect();
if (rect.top < containerRect.top || rect.bottom > containerRect.bottom) {
if (range.startContainer && range.startContainer.nodeType === Node.TEXT_NODE) {
gametext.scrollTop = 0; //simple fix for safari scrolling
const span = document.createElement("span");
span.style.display = "inline";
span.style.background = "transparent";
@ -23550,7 +23548,7 @@ Current version indicated by LITEVER below.
<option value="0">Disabled</option>
<option value="1">Local TextDB</option>
<option value="2">KoboldCpp Embeddings</option>
<option value="3">OpenAI Embeddings</option>
<option value="3">OpenAI API Embeddings</option>
</select>
<div id="documentdb_oai_buttons" style="display: flex;">
<button type="button" class="btn btn-primary" style="margin:0px; padding:0px; padding-left:2px;padding-right:2px;font-size:11px;margin-right:2px;" onclick="set_oai_embd_url()">Set URL</button>
@ -24746,11 +24744,6 @@ Current version indicated by LITEVER below.
class="helptext">Allows you to change the connected custom endpoint at runtime even in local mode.</span></span></div>
<input title="Show Local Endpoint Selector" type="checkbox" id="show_endpoint_selector" style="margin:0px 0px 0px 0px;">
</div>
<div class="settinglabel">
<div class="justifyleft settingsmall">NeverRewindCtxWindow <span class="helpicon">?<span
class="helptext">Prevents ever rewinding to context that has already been shifted out of the context window. </span></span></div>
<input title="Never Rewind Context Window" type="checkbox" id="never_rewind_ctx" style="margin:0px 0px 0px 0px;">
</div>
</div>
<div class="settingitem wide">