From 980f171e18768559bece2c793f7b64d992ad7c8e Mon Sep 17 00:00:00 2001 From: somebody Date: Sat, 17 Dec 2022 17:31:12 -0600 Subject: [PATCH] Disambiguate for cache invalidation --- aiserver.py | 6 +----- static/koboldai.js | 9 +++++++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/aiserver.py b/aiserver.py index 30e63b2a..762a7427 100644 --- a/aiserver.py +++ b/aiserver.py @@ -10138,11 +10138,7 @@ def maybe_review_story() -> None: uid = int(uid) allowed_wi_uids.append(uid) - # prompt = f"\n\n{speaker_name}'s thoughts on what just happened in this story: \"" - prompt = f"\n***\n{speaker_name}'s thoughts on what just happened in this story: \"" - # prompt = f"\n***\n{speaker_name}'s thoughts on the story's latest event: \"" - - print(prompt) + prompt = f"\n\n{speaker_name}'s thoughts on what just happened in this story: \"" context = koboldai_vars.calc_ai_text( prompt, diff --git a/static/koboldai.js b/static/koboldai.js index 457ed55c..be6fe1eb 100644 --- a/static/koboldai.js +++ b/static/koboldai.js @@ -72,6 +72,7 @@ var drag_id = null; var story_commentary_characters = {}; var generating_summary = false; const on_colab = $el("#on_colab").textContent == "true"; +let story_id = -1; // Each entry into this array should be an object that looks like: // {class: "class", key: "key", func: callback} @@ -794,6 +795,8 @@ function var_changed(data) { } hide_show_prompt(); } + + if (data.classname === "story" && data.name === "story_id") story_id = data.value; if ((data.classname == 'story') && (data.name == 'privacy_mode')) { privacy_mode(data.value); @@ -1977,7 +1980,8 @@ function world_info_entry(data) { wiImg.classList.add("hidden"); }); - if (data.uid > -1) wiImg.src = `/get_wi_image/${data.uid}`; + // Story id is used to invalidate cache from other stories + if (data.uid > -1) wiImg.src = `/get_wi_image/${data.uid}?${story_id}`; wiImgContainer.addEventListener("click", function() { wiImgInput.click(); @@ -6792,7 +6796,8 @@ function imgGenRetry() { const storyReviewImg = $el("#story-review-img"); async function showStoryReview(data) { - storyReviewImg.src = `/get_wi_image/${data.uid}`; + // Story id is used to invalidate cache from other stories + storyReviewImg.src = `/get_wi_image/${data.uid}?${story_id}`; $el("#story-review-author").innerText = data.who; $el("#story-review-content").innerText = data.review;