From d8e99b12f184f9c40c204f8328f1fb3612f5a6ef Mon Sep 17 00:00:00 2001 From: Gnome Ann <> Date: Mon, 28 Feb 2022 19:00:26 -0500 Subject: [PATCH 1/2] Re-enable the editor mutation observer --- static/application.js | 18 ++++++++++++++++++ templates/index.html | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/static/application.js b/static/application.js index 7e7352fb..2f380585 100644 --- a/static/application.js +++ b/static/application.js @@ -1628,6 +1628,21 @@ function highlightEditingChunks() { } } +// This gets run every time the text in a chunk is edited +// or a chunk is deleted +function chunkOnDOMMutate(mutations, observer) { + if(!gametext_bound || !allowedit) { + return; + } + var nodes = []; + for(var i = 0; i < mutations.length; i++) { + var mutation = mutations[i]; + nodes = nodes.concat(Array.from(mutation.addedNodes), Array.from(mutation.removedNodes)); + nodes.push(mutation.target); + } + applyChunkDeltas(nodes); +} + // This gets run every time you try to paste text into the editor function chunkOnPaste(event) { // Register the chunk we're pasting in as having been modified @@ -1705,10 +1720,12 @@ function chunkOnFocusOut(event) { } function bindGametext() { + mutation_observer.observe(game_text[0], {characterData: true, childList: true, subtree: true}); gametext_bound = true; } function unbindGametext() { + mutation_observer.disconnect(); gametext_bound = false; } @@ -2280,6 +2297,7 @@ $(document).ready(function(){ ).on('focusout', chunkOnFocusOut ); + mutation_observer = new MutationObserver(chunkOnDOMMutate); // This is required for the editor to work correctly in Firefox on desktop // because the gods of HTML and JavaScript say so diff --git a/templates/index.html b/templates/index.html index 192ed9fc..40812cee 100644 --- a/templates/index.html +++ b/templates/index.html @@ -17,7 +17,7 @@ - + From f9ac23ba4e50146104f02916cba4633cd84e2e98 Mon Sep 17 00:00:00 2001 From: henk717 Date: Wed, 2 Mar 2022 09:51:25 +0100 Subject: [PATCH 2/2] Add Janeway and Shinen --- .gitignore | 14 ++++++++------ aiserver.py | 2 ++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 033958a9..d470fb4b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,24 +1,26 @@ # Ignore client settings file -settings/* +settings # Ignore stories file except for test_story -stories/* +stories !stories/sample_story.json # Ignore stuff that would polute our Git /.project *.bak -miniconda3/* +miniconda3 *.settings __pycache__ *.log -cache/* -userscripts/* +cache +userscripts !userscripts/examples !userscripts/kaipreset_*.lua !userscripts/Readme.* !userscripts/api_documentation.* -softprompts/* +softprompts +models +!models/models go here.txt # Ignore PyCharm project files. .idea diff --git a/aiserver.py b/aiserver.py index b69eb4a1..be860287 100644 --- a/aiserver.py +++ b/aiserver.py @@ -69,8 +69,10 @@ modellist = [ ["Load a model from its directory", "NeoCustom", ""], ["Load an old GPT-2 model (eg CloverEdition)", "GPT2Custom", ""], ["Skein 6B (Hybrid)", "KoboldAI/GPT-J-6B-Skein", "16GB"], + ["Janeway 6B (Novel)", "KoboldAI/GPT-J-6B-Janeway", "16GB"], ["Adventure 6B", "KoboldAI/GPT-J-6B-Adventure", "16GB"], ["Lit 6B (NSFW)", "hakurei/lit-6B", "16GB"], + ["Shinen 6B (NSFW)", "KoboldAI/GPT-J-6B-Shinen", "16GB"], ["C1 6B (Chatbot)", "hakurei/c1-6B", "16GB"], ["Janeway 2.7B (Novel)", "KoboldAI/GPT-Neo-2.7B-Janeway", "8GB"], ["Adventure 2.7B", "KoboldAI/GPT-Neo-2.7B-AID", "8GB"],