From 56d150abc91f49e10b23e1fd4ba90fdd27288052 Mon Sep 17 00:00:00 2001 From: ebolam Date: Thu, 14 Jul 2022 19:45:11 -0400 Subject: [PATCH] Scroll Test --- static/koboldai.js | 15 +++++++++------ templates/index_new.html | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/static/koboldai.js b/static/koboldai.js index 8e0bef57..46154e1d 100644 --- a/static/koboldai.js +++ b/static/koboldai.js @@ -38,8 +38,8 @@ function disconnect() { function reset_story() { console.log("Resetting story"); var story_area = document.getElementById('Selected Text'); - while (story_area.firstChild) { - story_area.removeChild(story_area.firstChild); + while (story_area.lastChild.id != 'story_prompt') { + story_area.removeChild(story_area.lastChild); } var option_area = document.getElementById("Select Options"); while (option_area.firstChild) { @@ -992,10 +992,13 @@ function update_token_lengths() { } max_chunk = -1; for (item of document.getElementById("Selected Text").childNodes) { - if (item.id != "story_prompt") { - chunk_num = parseInt(item.id.replace("Selected Text Chunk ", "")); - if (chunk_num > max_chunk) { - max_chunk = chunk_num; + console.log(item); + if (item.id != undefined) { + if (item.id != "story_prompt") { + chunk_num = parseInt(item.id.replace("Selected Text Chunk ", "")); + if (chunk_num > max_chunk) { + max_chunk = chunk_num; + } } } } diff --git a/templates/index_new.html b/templates/index_new.html index 27630f78..aae69c18 100644 --- a/templates/index_new.html +++ b/templates/index_new.html @@ -32,7 +32,7 @@ -
+