From e89c59fe92800af01daa1279e5a502fcd9ec4315 Mon Sep 17 00:00:00 2001 From: ebolam Date: Fri, 16 Sep 2022 19:50:57 -0400 Subject: [PATCH] Changed deleteme to div --- aiserver.py | 8 ++++++++ static/koboldai.js | 10 ++++++++-- templates/index_new.html | 4 ++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/aiserver.py b/aiserver.py index 900cb63e..4b1b73ce 100644 --- a/aiserver.py +++ b/aiserver.py @@ -470,6 +470,14 @@ def emit(*args, **kwargs): except AttributeError: return socketio.emit(*args, **kwargs) +#replacement for tpool.execute to maintain request contexts +def replacement_tpool_execute(function, *args, **kwargs): + + +def replacement_tpool_execute_2(function, queue, *args, **kwargs): + return_data = function(*args, **kwargs) + queue.put(return_data) + # marshmallow/apispec setup from apispec import APISpec from apispec.ext.marshmallow import MarshmallowPlugin diff --git a/static/koboldai.js b/static/koboldai.js index 3fd86e11..4e075d7c 100644 --- a/static/koboldai.js +++ b/static/koboldai.js @@ -116,7 +116,7 @@ function reset_story() { while (story_area.lastChild.id != 'story_prompt') { story_area.removeChild(story_area.lastChild); } - dummy_span = document.createElement("span"); + dummy_span = document.createElement("div"); dummy_span.id = "Delete Me"; dummy_span.classList.add("noselect"); text = ""; @@ -2116,6 +2116,9 @@ function select_game_text(event) { if (document.selection) { if (document.selection.createRange().parentElement().id == 'story_prompt') { new_selected_game_chunk = document.selection.createRange().parentElement(); + } else if (document.selection.createRange().parentElement().id == 'gamescreen') { + new_selected_game_chunk = null; + console.log("Do nothing"); } else { new_selected_game_chunk = document.selection.createRange().parentElement().parentElement(); } @@ -2123,6 +2126,9 @@ function select_game_text(event) { if(window.getSelection().anchorNode.parentNode) { if (window.getSelection().anchorNode.parentNode.id == 'story_prompt') { new_selected_game_chunk = window.getSelection().anchorNode.parentNode; + } else if (window.getSelection().anchorNode.parentNode.id == "gamescreen") { + new_selected_game_chunk = null; + console.log("Do nothing"); } else { new_selected_game_chunk = window.getSelection().anchorNode.parentNode.parentNode; } @@ -2137,7 +2143,7 @@ function select_game_text(event) { //Check to see if new selection is a game chunk or something else - if (((new_selected_game_chunk.id == "story_prompt") || (new_selected_game_chunk.id.slice(0,20) == "Selected Text Chunk ")) && (document.activeElement.isContentEditable)) { + if ((new_selected_game_chunk == null) || (((new_selected_game_chunk.id == "story_prompt") || (new_selected_game_chunk.id.slice(0,20) == "Selected Text Chunk ")) && (document.activeElement.isContentEditable))) { if (new_selected_game_chunk != selected_game_chunk) { for (item of document.getElementsByClassName("editing")) { item.classList.remove("editing"); diff --git a/templates/index_new.html b/templates/index_new.html index 65f697ac..4509f069 100644 --- a/templates/index_new.html +++ b/templates/index_new.html @@ -49,7 +49,7 @@

Disconnected

- +
                                                  @@ -59,7 +59,7 @@                                                   - +