Fix for token length

This commit is contained in:
ebolam
2022-07-03 16:57:41 -04:00
parent 1141e39fbd
commit 3f28be16d4
2 changed files with 19 additions and 5 deletions

View File

@@ -903,11 +903,25 @@ function upload_file(file_box) {
//--------------------------------------------General UI Functions------------------------------------
function update_token_lengths() {
max_token_length = parseInt(document.getElementById("model_max_length_cur").value);
token_length = 0;
token_length += parseInt(document.getElementById("memory").getAttribute("story_memory_length"));
token_length += parseInt(document.getElementById("authors_nodes").getAttribute("story_authornote_length"));
always_prompt = document.getElementById("story_useprompt").value == "true";
if ((document.getElementById("memory").getAttribute("story_memory_length") == null) || (document.getElementById("memory").getAttribute("story_memory_length") == "")) {
memory_length = 0;
} else {
memory_length = parseInt(document.getElementById("memory").getAttribute("story_memory_length"));
}
if ((document.getElementById("authors_notes").getAttribute("story_authornote_length") == null) || (document.getElementById("authors_notes").getAttribute("story_authornote_length") == "")) {
authors_notes = 0;
} else {
authors_notes = parseInt(document.getElementById("authors_notes").getAttribute("story_authornote_length"));
}
if ((document.getElementById("story_prompt").getAttribute("story_prompt_length") == null) || (document.getElementById("story_prompt").getAttribute("story_prompt_length") == "")) {
prompt_length = 0;
} else {
prompt_length = parseInt(document.getElementById("story_prompt").getAttribute("story_prompt_length"));
}
token_length = memory_length + authors_notes;
always_prompt = document.getElementById("story_useprompt").value == "true";
if (always_prompt) {
token_length += prompt_length
document.getElementById("story_prompt").classList.add("within_max_length");

View File

@@ -14,7 +14,7 @@ Status:<hr/>
<hr/>
<div id="author_notes">
Author's Notes:<br/>
<textarea rows=5 id="authors_nodes" class="var_sync_story_authornote var_sync_alt_story_authornote_length fullwidth" onblur='socket.emit("var_change", {"ID": "story_authornote", "value": this.value});'></textarea><br/>
<textarea rows=5 id="authors_notes" class="var_sync_story_authornote var_sync_alt_story_authornote_length fullwidth" onblur='socket.emit("var_change", {"ID": "story_authornote", "value": this.value});'></textarea><br/>
Template:<br/>
<input type=text class="var_sync_story_authornotetemplate fullwidth" onblur='socket.emit("var_change", {"ID": "story_authornotetemplate", "value": this.value});'><br/>
andepth<br/>