Restore United

This commit is contained in:
henk717 2022-03-02 11:40:50 +01:00
commit e033b04f87
4 changed files with 28 additions and 8 deletions

14
.gitignore vendored
View File

@ -1,25 +1,25 @@
# Ignore client settings file # Ignore client settings file
settings/* settings
# Ignore stories file except for test_story # Ignore stories file except for test_story
stories/* stories
!stories/sample_story.json !stories/sample_story.json
# Ignore stuff that would polute our Git # Ignore stuff that would polute our Git
/.project /.project
*.bak *.bak
miniconda3/* miniconda3
*.settings *.settings
__pycache__ __pycache__
*.log *.log
cache/* cache
userscripts/* userscripts
!userscripts/examples !userscripts/examples
!userscripts/kaipreset_*.lua !userscripts/kaipreset_*.lua
!userscripts/Readme.* !userscripts/Readme.*
!userscripts/api_documentation.* !userscripts/api_documentation.*
softprompts/* softprompts
models/* models
!models/models go here.txt !models/models go here.txt
# Ignore PyCharm project files. # Ignore PyCharm project files.

View File

@ -69,8 +69,10 @@ mainmenu = [
["Load a model from its directory", "NeoCustom", ""], ["Load a model from its directory", "NeoCustom", ""],
["Load an old GPT-2 model (eg CloverEdition)", "GPT2Custom", ""], ["Load an old GPT-2 model (eg CloverEdition)", "GPT2Custom", ""],
["Skein 6B (Hybrid)", "KoboldAI/GPT-J-6B-Skein", "16GB"], ["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"], ["Adventure 6B", "KoboldAI/GPT-J-6B-Adventure", "16GB"],
["Lit 6B (NSFW)", "hakurei/lit-6B", "16GB"], ["Lit 6B (NSFW)", "hakurei/lit-6B", "16GB"],
["Shinen 6B (NSFW)", "KoboldAI/GPT-J-6B-Shinen", "16GB"],
["C1 6B (Chatbot)", "hakurei/c1-6B", "16GB"], ["C1 6B (Chatbot)", "hakurei/c1-6B", "16GB"],
["Janeway Neo 2.7B (Novel)", "KoboldAI/GPT-Neo-2.7B-Janeway", "8GB"], ["Janeway Neo 2.7B (Novel)", "KoboldAI/GPT-Neo-2.7B-Janeway", "8GB"],
["Janeway FSD 2.7B (Novel)", "KoboldAI/fairseq-dense-2.7B-Janeway", "8GB"], ["Janeway FSD 2.7B (Novel)", "KoboldAI/fairseq-dense-2.7B-Janeway", "8GB"],

View File

@ -1662,6 +1662,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 // This gets run every time you try to paste text into the editor
function chunkOnPaste(event) { function chunkOnPaste(event) {
// Register the chunk we're pasting in as having been modified // Register the chunk we're pasting in as having been modified
@ -1739,10 +1754,12 @@ function chunkOnFocusOut(event) {
} }
function bindGametext() { function bindGametext() {
mutation_observer.observe(game_text[0], {characterData: true, childList: true, subtree: true});
gametext_bound = true; gametext_bound = true;
} }
function unbindGametext() { function unbindGametext() {
mutation_observer.disconnect();
gametext_bound = false; gametext_bound = false;
} }
@ -2325,6 +2342,7 @@ $(document).ready(function(){
).on('focusout', ).on('focusout',
chunkOnFocusOut chunkOnFocusOut
); );
mutation_observer = new MutationObserver(chunkOnDOMMutate);
// This is required for the editor to work correctly in Firefox on desktop // This is required for the editor to work correctly in Firefox on desktop
// because the gods of HTML and JavaScript say so // because the gods of HTML and JavaScript say so

View File

@ -17,7 +17,7 @@
<script src="static/bootstrap.min.js"></script> <script src="static/bootstrap.min.js"></script>
<script src="static/bootstrap-toggle.min.js"></script> <script src="static/bootstrap-toggle.min.js"></script>
<script src="static/rangy-core.min.js"></script> <script src="static/rangy-core.min.js"></script>
<script src="static/application.js?ver=1.17"></script> <script src="static/application.js?ver=1.17a"></script>
</head> </head>
<body> <body>
<input type="file" id="remote-save-select" accept="application/json" style="display:none"> <input type="file" id="remote-save-select" accept="application/json" style="display:none">