From 6b429eb032b61c23149c5b2b1e1a17af05347a0b Mon Sep 17 00:00:00 2001 From: ebolam Date: Wed, 24 Aug 2022 14:10:31 -0400 Subject: [PATCH] Speed up --- koboldai_settings.py | 6 +++--- static/koboldai.js | 7 +++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/koboldai_settings.py b/koboldai_settings.py index 36076316..e74ee503 100644 --- a/koboldai_settings.py +++ b/koboldai_settings.py @@ -133,7 +133,7 @@ class koboldai_vars(object): #Add constant world info entries to memory for wi in self.worldinfo_v2: if wi['constant']: - if used_tokens+wi['token_length'] <= token_budget: + if used_tokens+0 if 'token_length' not in wi else wi['token_length'] <= token_budget: used_tokens+=wi['token_length'] used_world_info.append(wi['uid']) self.worldinfo_v2.set_world_info_used(wi['uid']) @@ -159,7 +159,7 @@ class koboldai_vars(object): match=True break if match: - if used_tokens+wi['token_length'] <= token_budget: + if used_tokens+0 if 'token_length' not in wi else wi['token_length'] <= token_budget: used_tokens+=wi['token_length'] used_world_info.append(wi['uid']) text += wi['content'] @@ -236,7 +236,7 @@ class koboldai_vars(object): match=True break if match: - if used_tokens+wi['token_length'] <= token_budget: + if used_tokens+0 if 'token_length' not in wi else wi['token_length'] <= token_budget: used_tokens+=wi['token_length'] used_world_info.append(wi['uid']) text += wi['content'] diff --git a/static/koboldai.js b/static/koboldai.js index f12b409d..6de742d1 100644 --- a/static/koboldai.js +++ b/static/koboldai.js @@ -51,6 +51,7 @@ map2.set(3, 'Tail Free Sampling') map2.set(4, 'Typical Sampling') map2.set(5, 'Temperature') var use_word_highlighting = true; +var calc_token_usage_timeout; //-----------------------------------Server to UI Functions----------------------------------------------- function connect() { console.log("connected"); @@ -1466,7 +1467,8 @@ function world_info_entry(data) { update_token_lengths(); - calc_token_usage(); + clearTimeout(calc_token_usage_timeout); + calc_token_usage_timeout = setTimeout(calc_token_usage, 200); return world_info_card; } @@ -2451,7 +2453,8 @@ function assign_world_info_to_action(action_item, uid) { } function update_token_lengths() { - calc_token_usage(); + clearTimeout(calc_token_usage_timeout); + calc_token_usage_timeout = setTimeout(calc_token_usage, 200); return max_token_length = parseInt(document.getElementById("model_max_length_cur").value); included_world_info = [];