From 43586c8f602533884bc4bcbccaa27e43416bb29c Mon Sep 17 00:00:00 2001
From: Gnome Ann <>
Date: Mon, 10 Jan 2022 17:09:47 -0500
Subject: [PATCH] Fix some of the logic for generation aborting

---
 aiserver.py           | 10 ++++++----
 static/application.js |  2 +-
 templates/index.html  |  2 +-
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/aiserver.py b/aiserver.py
index d9fea41f..30c06ee3 100644
--- a/aiserver.py
+++ b/aiserver.py
@@ -1708,8 +1708,9 @@ def get_message(msg):
     # Submit action
     if(msg['cmd'] == 'submit'):
         if(vars.mode == "play"):
-            if(vars.aibusy and msg.get('allowabort', False)):
-                vars.abort = True
+            if(vars.aibusy):
+                if(msg.get('allowabort', False)):
+                    vars.abort = True
                 return
             vars.abort = False
             vars.lua_koboldbridge.feedback = None
@@ -1727,8 +1728,9 @@ def get_message(msg):
             memsubmit(msg['data'])
     # Retry Action
     elif(msg['cmd'] == 'retry'):
-        if(vars.aibusy and msg.get('allowabort', False)):
-            vars.abort = True
+        if(vars.aibusy):
+            if(msg.get('allowabort', False)):
+                vars.abort = True
             return
         vars.abort = False
         if(vars.chatmode):
diff --git a/static/application.js b/static/application.js
index 8b42a298..5d4aed8b 100644
--- a/static/application.js
+++ b/static/application.js
@@ -799,7 +799,7 @@ function formatChunkInnerText(chunk) {
 
 function dosubmit(disallow_abort) {
 	var txt = input_text.val().replace(/\u00a0/g, " ");
-	if(gamestate !== "wait" && !memorymode && !gamestarted && ((!adventure || !action_mode) && txt.trim().length == 0)) {
+	if((disallow_abort || gamestate !== "wait") && !memorymode && !gamestarted && ((!adventure || !action_mode) && txt.trim().length == 0)) {
 		return;
 	}
 	input_text.val("");
diff --git a/templates/index.html b/templates/index.html
index b64683e8..360826b0 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -17,7 +17,7 @@
 	<script src="static/bootstrap.min.js"></script>
 	<script src="static/bootstrap-toggle.min.js"></script>
 	<script src="static/rangy-core.min.js"></script>
-	<script src="static/application.js?ver=1.16.4w"></script>
+	<script src="static/application.js?ver=1.16.4x"></script>
 </head>
 <body>
 	<input type="file" id="remote-save-select" accept="application/json" style="display:none">