From 7573f64bf25cdebe46b6efed2d195efde8eeda16 Mon Sep 17 00:00:00 2001
From: Gnome Ann <>
Date: Wed, 29 Dec 2021 23:15:59 -0500
Subject: [PATCH 01/10] Add Memory box to Random Story dialog and "Random Story
Persist"
---
aiserver.py | 40 ++++++++++++++++++++++++++++++----------
bridge.lua | 4 ++++
gensettings.py | 33 +++++++++++++++++++++++++++++++++
static/application.js | 11 ++++++++++-
static/custom.css | 18 +++++++++++++++++-
templates/index.html | 7 +++++--
6 files changed, 99 insertions(+), 14 deletions(-)
diff --git a/aiserver.py b/aiserver.py
index 454a8825..e4e4b9f5 100644
--- a/aiserver.py
+++ b/aiserver.py
@@ -179,6 +179,7 @@ class vars:
dynamicscan = False
remote = False
nopromptgen = False
+ rngpersist = False
#==================================================================#
# Function to get model selection at startup
@@ -1263,9 +1264,12 @@ def lua_has_setting(setting):
"setchatmode",
"setdynamicscan",
"setnopromptgen",
+ "setrngpersist",
"temp",
"topp",
+ "top_p",
"topk",
+ "top_k",
"tfs",
"reppen",
"tknmax",
@@ -1276,6 +1280,7 @@ def lua_has_setting(setting):
"adventure",
"dynamicscan",
"nopromptgen",
+ "rngpersist",
"frmttriminc",
"frmtrmblln",
"frmtrmspch",
@@ -1293,8 +1298,8 @@ def lua_has_setting(setting):
#==================================================================#
def lua_get_setting(setting):
if(setting in ("settemp", "temp")): return vars.temp
- if(setting in ("settopp", "topp")): return vars.top_p
- if(setting in ("settopk", "topk")): return vars.top_k
+ if(setting in ("settopp", "topp", "top_p")): return vars.top_p
+ if(setting in ("settopk", "topk", "top_k")): return vars.top_k
if(setting in ("settfs", "tfs")): return vars.tfs
if(setting in ("setreppen", "reppen")): return vars.rep_pen
if(setting in ("settknmax", "tknmax")): return vars.max_length
@@ -1305,6 +1310,7 @@ def lua_get_setting(setting):
if(setting in ("setchatmode", "chatmode")): return vars.chatmode
if(setting in ("setdynamicscan", "dynamicscan")): return vars.dynamicscan
if(setting in ("setnopromptgen", "nopromptgen")): return vars.nopromptgen
+ if(setting in ("setrngpersist", "rngpersist")): return vars.rngpersist
if(setting in ("frmttriminc", "triminc")): return vars.formatoptns["frmttriminc"]
if(setting in ("frmtrmblln", "rmblln")): return vars.formatoptns["frmttrmblln"]
if(setting in ("frmtrmspch", "rmspch")): return vars.formatoptns["frmttrmspch"]
@@ -1333,6 +1339,7 @@ def lua_set_setting(setting, v):
if(setting in ("setadventure", "adventure")): vars.adventure = v
if(setting in ("setdynamicscan", "dynamicscan")): vars.dynamicscan = v
if(setting in ("setnopromptgen", "nopromptgen")): vars.nopromptgen = v
+ if(setting in ("setrngpersist", "rngpersist")): vars.rngpersist = v
if(setting in ("setchatmode", "chatmode")): vars.chatmode = v
if(setting in ("frmttriminc", "triminc")): vars.formatoptns["frmttriminc"] = v
if(setting in ("frmtrmblln", "rmblln")): vars.formatoptns["frmttrmblln"] = v
@@ -1667,7 +1674,7 @@ def get_message(msg):
elif(msg['cmd'] == 'newgame'):
newGameRequest()
elif(msg['cmd'] == 'rndgame'):
- randomGameRequest(msg['data'])
+ randomGameRequest(msg['data'], memory=msg['memory'])
elif(msg['cmd'] == 'settemp'):
vars.temp = float(msg['data'])
emit('from_server', {'cmd': 'setlabeltemp', 'data': msg['data']}, broadcast=True)
@@ -1883,6 +1890,10 @@ def get_message(msg):
vars.nopromptgen = msg['data']
settingschanged()
refresh_settings()
+ elif(msg['cmd'] == 'setrngpersist'):
+ vars.rngpersist = msg['data']
+ settingschanged()
+ refresh_settings()
elif(not vars.remote and msg['cmd'] == 'importwi'):
wiimportrequest()
@@ -1952,6 +1963,7 @@ def savesettings():
js["chatname"] = vars.chatname
js["dynamicscan"] = vars.dynamicscan
js["nopromptgen"] = vars.nopromptgen
+ js["rngpersist"] = vars.rngpersist
js["userscripts"] = vars.userscripts
js["corescript"] = vars.corescript
@@ -2014,6 +2026,8 @@ def loadsettings():
vars.dynamicscan = js["dynamicscan"]
if("nopromptgen" in js):
vars.nopromptgen = js["nopromptgen"]
+ if("rngpersist" in js):
+ vars.rngpersist = js["rngpersist"]
if("userscripts" in js):
vars.userscripts = []
@@ -2992,6 +3006,7 @@ def refresh_settings():
emit('from_server', {'cmd': 'updatechatmode', 'data': vars.chatmode}, broadcast=True)
emit('from_server', {'cmd': 'updatedynamicscan', 'data': vars.dynamicscan}, broadcast=True)
emit('from_server', {'cmd': 'updatenopromptgen', 'data': vars.nopromptgen}, broadcast=True)
+ emit('from_server', {'cmd': 'updaterngpersist', 'data': vars.rngpersist}, broadcast=True)
emit('from_server', {'cmd': 'updatefrmttriminc', 'data': vars.formatoptns["frmttriminc"]}, broadcast=True)
emit('from_server', {'cmd': 'updatefrmtrmblln', 'data': vars.formatoptns["frmtrmblln"]}, broadcast=True)
@@ -4184,23 +4199,28 @@ def newGameRequest():
emit('from_server', {'cmd': 'setanote', 'data': vars.authornote}, broadcast=True)
setStartState()
-def randomGameRequest(topic):
+def randomGameRequest(topic, memory=""):
+ if(vars.noai):
+ newGameRequest()
+ return
vars.recentrng = topic
newGameRequest()
- vars.memory = "You generate the following " + topic + " story concept :"
+ if(len(memory) > 0):
+ memory = memory.rstrip() + "\n\n"
+ vars.memory = memory + "You generate the following " + topic + " story concept :"
vars.lua_koboldbridge.feedback = None
actionsubmit("", force_submit=True, force_prompt_gen=True)
- vars.memory = ""
+ vars.memory = memory
+
+# Load settings from client.settings
+loadmodelsettings()
+loadsettings()
#==================================================================#
# Final startup commands to launch Flask app
#==================================================================#
if __name__ == "__main__":
- # Load settings from client.settings
- loadmodelsettings()
- loadsettings()
-
# Start Flask/SocketIO (Blocking, so this must be last method!)
#socketio.run(app, host='0.0.0.0', port=5000)
diff --git a/bridge.lua b/bridge.lua
index ed177c4e..ccbc05e2 100644
--- a/bridge.lua
+++ b/bridge.lua
@@ -867,9 +867,12 @@ return function(_python, _bridged)
---@field setadventure boolean
---@field setdynamicscan boolean
---@field setnopromptgen boolean
+ ---@field setrngpersist boolean
---@field temp number
---@field topp number
---@field topk integer
+ ---@field top_p number
+ ---@field top_k integer
---@field tfs number
---@field reppen number
---@field tknmax integer
@@ -878,6 +881,7 @@ return function(_python, _bridged)
---@field adventure boolean
---@field dynamicscan boolean
---@field nopromptgen boolean
+ ---@field rngpersist boolean
---@field frmttriminc boolean
---@field frmtrmblln boolean
---@field frmtrmspch boolean
diff --git a/gensettings.py b/gensettings.py
index be578464..fa4e14ef 100644
--- a/gensettings.py
+++ b/gensettings.py
@@ -151,6 +151,17 @@ gensettingstf = [{
"step": 1,
"default": 0,
"tooltip": "When enabled the AI does not generate when you enter the prompt, instead you need to do an action first."
+ },
+ {
+ "uitype": "toggle",
+ "unit": "bool",
+ "label": "Random Story Persist",
+ "id": "setrngpersist",
+ "min": 0,
+ "max": 1,
+ "step": 1,
+ "default": 0,
+ "tooltip": "When enabled, the Memory text box in the Random Story dialog will be prefilled by default with your current story's memory instead of being empty."
}]
gensettingsik =[{
@@ -251,6 +262,28 @@ gensettingsik =[{
"step": 1,
"default": 0,
"tooltip": "Turn this on if you are playing a Choose your Adventure model."
+ },
+ {
+ "uitype": "toggle",
+ "unit": "bool",
+ "label": "No Prompt Generation",
+ "id": "setnopromptgen",
+ "min": 0,
+ "max": 1,
+ "step": 1,
+ "default": 0,
+ "tooltip": "When enabled the AI does not generate when you enter the prompt, instead you need to do an action first."
+ },
+ {
+ "uitype": "toggle",
+ "unit": "bool",
+ "label": "Random Story Persist",
+ "id": "setrngpersist",
+ "min": 0,
+ "max": 1,
+ "step": 1,
+ "default": 0,
+ "tooltip": "When enabled, the Memory text box in the Random Story dialog will be prefilled by default with your current story's memory instead of being empty."
}]
formatcontrols = [{
diff --git a/static/application.js b/static/application.js
index 560568e9..3d27c69d 100644
--- a/static/application.js
+++ b/static/application.js
@@ -1054,6 +1054,9 @@ function hideNewStoryPopup() {
function showRandomStoryPopup() {
rspopup.removeClass("hidden");
rspopup.addClass("flex");
+ if($("#setrngpersist").prop("checked")) {
+ $("#rngmemory").val(memorytext);
+ }
}
function hideRandomStoryPopup() {
@@ -2180,6 +2183,12 @@ $(document).ready(function(){
} else if(msg.cmd == "updatenopromptgen") {
// Update toggle state
$("#setnopromptgen").prop('checked', msg.data).change();
+ } else if(msg.cmd == "updaterngpersist") {
+ // Update toggle state
+ $("#setrngpersist").prop('checked', msg.data).change();
+ if(!$("#setrngpersist").prop("checked")) {
+ $("#rngmemory").val("");
+ }
} else if(msg.cmd == "runs_remotely") {
remote = true;
hide([button_savetofile, button_import, button_importwi]);
@@ -2435,7 +2444,7 @@ $(document).ready(function(){
rs_accept.on("click", function(ev) {
hideMessage();
- socket.send({'cmd': 'rndgame', 'data': topic.val()});
+ socket.send({'cmd': 'rndgame', 'memory': $("#rngmemory").val(), 'data': topic.val()});
hideRandomStoryPopup();
});
diff --git a/static/custom.css b/static/custom.css
index ee573bac..858cf7af 100644
--- a/static/custom.css
+++ b/static/custom.css
@@ -32,6 +32,22 @@ chunk.editing, chunk.editing * {
display: flex;
}
+#topic {
+ margin-top: 20px;
+ resize: none;
+ overflow: auto;
+ background-color: #404040;
+ color: #ffffff;
+}
+
+#rngmemory {
+ height: 80px;
+ resize: none;
+ overflow:auto;
+ background-color: #404040;
+ color: #ffffff;
+}
+
#chatname {
background-color: #404040;
color: #ffffff;
@@ -387,7 +403,7 @@ chunk.editing, chunk.editing * {
#rspopup {
width: 800px;
background-color: #262626;
- margin-top: 200px;
+ margin-top: 150px;
}
/*================= Classes =================*/
diff --git a/templates/index.html b/templates/index.html
index df53315d..f2b9509f 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -10,12 +10,12 @@
-
+
-
+
@@ -353,6 +353,9 @@
+
From 3532a30ad44bb096187b31c54ec3c5c5b8e764c8 Mon Sep 17 00:00:00 2001
From: Gnome Ann <>
Date: Thu, 30 Dec 2021 01:44:35 -0500
Subject: [PATCH 03/10] Make the UI theme grey when not connected to server
---
static/application.js | 2 +
static/custom.css | 140 +++++++++++++++++++++++++++++++++++++++---
templates/index.html | 12 ++--
3 files changed, 139 insertions(+), 15 deletions(-)
diff --git a/static/application.js b/static/application.js
index a6547922..337574c4 100644
--- a/static/application.js
+++ b/static/application.js
@@ -1815,6 +1815,7 @@ $(document).ready(function(){
document.activeElement.blur();
active_element.focus();
})();
+ $("body").addClass("connected");
} else if(msg.cmd == "updatescreen") {
var _gamestarted = gamestarted;
gamestarted = msg.gamestarted;
@@ -2201,6 +2202,7 @@ $(document).ready(function(){
socket.on('disconnect', function() {
connected = false;
+ $("body").removeClass("connected");
connect_status.html("Lost connection...");
connect_status.removeClass("color_green");
connect_status.addClass("color_orange");
diff --git a/static/custom.css b/static/custom.css
index b95ebf86..f1c50115 100644
--- a/static/custom.css
+++ b/static/custom.css
@@ -27,11 +27,15 @@ chunk.editing, chunk.editing * {
}
#topmenu {
- background-color: #337ab7;
+ background-color: #757575;
padding: 10px;
display: flex;
}
+body.connected #topmenu, #topmenu.always-available {
+ background-color: #337ab7;
+}
+
#topic {
margin-top: 20px;
resize: none;
@@ -66,10 +70,14 @@ chunk.editing, chunk.editing * {
#navbar li {
margin-right: 5px;
- background-color: #4787be;
+ background-color: #828282;
border-radius: 5px;
}
+body.connected #navbar li, #navbar li.always-available {
+ background-color: #4787be;
+}
+
#navbar li > a {
color: #ffffff;
font-weight: bold;
@@ -78,16 +86,24 @@ chunk.editing, chunk.editing * {
#settingsmenu {
display: flex;
flex-wrap: wrap;
- background-color: #295071;
+ background-color: #4d4d4d;
padding: 10px;
}
+body.connected #settingsmenu, #settingsmenu.always-available {
+ background-color: #295071;
+}
+
#formatmenu {
display:none;
- background-color: #295071;
+ background-color: #4d4d4d;
padding: 10px;
}
+body.connected #formatmenu, #formatmenu.always-available {
+ background-color: #295071;
+}
+
#connectstatusdiv {
display: flex;
text-align: right;
@@ -255,6 +271,10 @@ chunk.editing, chunk.editing * {
#popuptitlebar {
padding: 10px;
+ background-color: #757575;
+}
+
+body.connected #popuptitlebar, #popuptitlebar.always-available {
background-color: #337ab7;
}
@@ -283,6 +303,10 @@ chunk.editing, chunk.editing * {
padding: 10px;
display: flex;
justify-content: center;
+ background-color: #4d4d4d;
+}
+
+body.connected #popupfooter, #popupfooter.always-available {
background-color: #295071;
}
@@ -418,6 +442,44 @@ chunk.editing, chunk.editing * {
/*================= Classes =================*/
+body:not(.connected) .btn-primary {
+ background-color: #757575;
+ border-color: #4a4a4a;
+}
+
+.btn-primary.always-available {
+ background-color: #337ab7;
+ border-color: #2e6da4;
+}
+
+body:not(.connected) .btn-primary.focus, body:not(.connected) .btn-primary:focus {
+ background-color: #5c5c5c;
+ border-color: #292929;
+}
+
+.btn-primary.focus.always-available, .btn-primary.always-available:focus {
+ background-color: #286090;
+ border-color: #122b40;
+}
+
+body:not(.connected) .btn-primary:hover {
+ background-color: #5c5c5c;
+ border-color: #4a4a4a;
+}
+
+.btn-primary.always-available:hover {
+ background-color: #286090;
+ border-color: #204d74;
+}
+
+body:not(.connected) a.dropdown-item:focus, body:not(.connected) a.dropdown-item:hover {
+ color: #4f4f4f;
+}
+
+a.dropdown-item.always-available:focus, a.dropdown-item.always-available:hover {
+ color: #23527c !important;
+}
+
.aidgpopupcontent {
padding: 10px 40px 10px 40px;
}
@@ -495,26 +557,42 @@ chunk.editing, chunk.editing * {
}
.dropdown-menu {
- background-color: #337ab7;
+ background-color: #757575;
width: 200px;
}
+body.connected .dropdown-menu, .dropdown-menu.always-available {
+ background-color: #337ab7;
+}
+
.dropdown-item {
display: block;
padding: 10px;
color: #ffffff;
+ border-bottom: 1px solid #4d4d4d;
+}
+
+body.connected .dropdown-item, .dropdown-item.always-available {
border-bottom: 1px solid #295071;
}
.dropdown-item:first-child {
+ border-top: 1px solid #4d4d4d;
+}
+
+body.connected .dropdown-item:first-child, .dropdown-item:first-child.always-available {
border-top: 1px solid #295071;
}
.dropdown-item:hover {
- background-color: #98bcdb;
+ background-color: #bababa;
text-decoration: none;
}
+body.connected .dropdown-item:hover, .dropdown-item.always-available:hover {
+ background-color: #98bcdb;
+}
+
.edit-flash, .edit-flash * {
color: #3bf723 !important;
}
@@ -708,6 +786,10 @@ chunk.editing, chunk.editing * {
font-size: 1.4ex;
line-height: 1.8ex;
text-decoration: none;
+ color: #9e9e9e;
+}
+
+body.connected .statusicon, .statusicon.always-available {
color: #68a2d4;
}
@@ -739,12 +821,16 @@ chunk.editing, chunk.editing * {
.statusiconlabel {
pointer-events: none;
- color: #337ab7;
+ color: #757575;
text-align: center;
font-weight: bold;
font-size: 13px;
}
+body.connected .statusiconlabel, .statusiconlabel.always-available {
+ color: #337ab7;
+}
+
#usiconlabel {
transform: translate(-3px, 10px);
-moz-transform: translate(-3px, 10px);
@@ -976,23 +1062,51 @@ chunk.editing, chunk.editing * {
.navbar .navbar-nav .nav-link:hover {
border-radius: 5px;
+ background-color: #bababa;
+}
+
+body.connected .navbar .navbar-nav .nav-link:hover, .navbar .navbar-nav .nav-link.always-available:hover {
+ background-color: #98bcdb;
+}
+
+body .navbar .navbar-nav .dropdown-item.always-available {
+ background-color: #337ab7;
+}
+
+body .navbar .navbar-nav .dropdown-item.always-available:hover {
background-color: #98bcdb;
}
.navbar .navbar-nav .nav-link:focus {
border-radius: 5px;
+ background-color: #bababa;
+}
+
+body.connected .navbar .navbar-nav .nav-link:focus, .navbar .navbar-nav .nav-link.always-available:focus {
background-color: #98bcdb;
}
.navbar-toggler {
- background-color: #337ab7;
- border: 1px solid #98bcdb;
+ background-color: #757575;
+ border: 1px solid #bababa;
height: 45px;
width: 60px;
border-radius: 6px;
}
+body.connected .navbar-toggler, .navbar-toggler.always-available {
+ border: 1px solid #98bcdb;
+}
+
+body .navbar-toggler {
+ background-color: #337ab7;
+}
+
.navbar-toggler:hover {
+ background-color: #bababa;
+}
+
+body.connected .navbar-togger:hover, .navbar-togger.always-available:hover {
background-color: #98bcdb;
}
@@ -1062,6 +1176,10 @@ chunk.editing, chunk.editing * {
.popuptitlebar {
padding: 10px;
+ background-color: #757575;
+}
+
+body .popuptitlebar {
background-color: #337ab7;
}
@@ -1083,6 +1201,10 @@ chunk.editing, chunk.editing * {
padding: 10px;
display: flex;
justify-content: center;
+ background-color: #4d4d4d;
+}
+
+body.connected .popupfooter, .popupfooter.always-available {
background-color: #295071;
}
diff --git a/templates/index.html b/templates/index.html
index 7dee78a6..0b26c29b 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -10,12 +10,12 @@
-
+
-
+
@@ -39,14 +39,14 @@
Random Story
-
- Save
+
+ Save
From 7645db9dd41b0d8acd59af8df2cac2b1b475e91e Mon Sep 17 00:00:00 2001
From: Gnome Ann <>
Date: Thu, 30 Dec 2021 01:45:14 -0500
Subject: [PATCH 04/10] Use set lookup for `sandbox_require_builtins` instead
of iteration
---
bridge.lua | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/bridge.lua b/bridge.lua
index aec5f81f..922d4401 100644
--- a/bridge.lua
+++ b/bridge.lua
@@ -1577,17 +1577,15 @@ return function(_python, _bridged)
if modname == "bridge" then
return function() return env.kobold, env.koboldcore end
end
- for k, v in pairs(sandbox_require_builtins) do
- if modname == k then
- return env[k]
- end
- end
if type(modname) == "number" then
modname = tostring(modname)
elseif type(modname) ~= "string" then
error("bad argument #1 to 'require' (string expected, got "..type(modname)..")")
return
end
+ if sandbox_require_builtins[modname] then
+ return env[modname]
+ end
local allowsearch = type(modname) == "string" and string.match(modname, "[^%w._-]") == nil and string.match(modname, "%.%.") == nil
if allowsearch and package_loaded[env] == nil then
package_loaded[env] = {}
From de8a5046dfdc59c5a323751ef8b687d2e4e4fa3e Mon Sep 17 00:00:00 2001
From: Gnome Ann <>
Date: Thu, 30 Dec 2021 01:45:27 -0500
Subject: [PATCH 05/10] Make sure we don't keep the trimmed memory in
`randomGameRequest()`
---
aiserver.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/aiserver.py b/aiserver.py
index ac828af8..b50451e5 100644
--- a/aiserver.py
+++ b/aiserver.py
@@ -4249,9 +4249,10 @@ def randomGameRequest(topic, memory=""):
return
vars.recentrng = topic
newGameRequest()
+ _memory = memory
if(len(memory) > 0):
- memory = memory.rstrip() + "\n\n"
- vars.memory = memory + "You generate the following " + topic + " story concept :"
+ _memory = memory.rstrip() + "\n\n"
+ vars.memory = _memory + "You generate the following " + topic + " story concept :"
vars.lua_koboldbridge.feedback = None
actionsubmit("", force_submit=True, force_prompt_gen=True)
vars.memory = memory
From 4d06ebb45a7c0c083b81f4643451f24a98c5cf4a Mon Sep 17 00:00:00 2001
From: Gnome Ann <>
Date: Thu, 30 Dec 2021 01:48:25 -0500
Subject: [PATCH 06/10] Consistent capitalization of "Author's note"
---
aiserver.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/aiserver.py b/aiserver.py
index b50451e5..447ea864 100644
--- a/aiserver.py
+++ b/aiserver.py
@@ -3826,7 +3826,7 @@ def loadRequest(loadpath, filename=None):
if("anotetemplate" in js):
vars.authornotetemplate = js["anotetemplate"]
else:
- vars.authornotetemplate = "[Author's Note: <|>]"
+ vars.authornotetemplate = "[Author's note: <|>]"
if("worldinfo" in js):
num = 0
@@ -4009,7 +4009,7 @@ def importgame():
vars.prompt = ""
vars.memory = ref["memory"]
vars.authornote = ref["authorsNote"] if type(ref["authorsNote"]) is str else ""
- vars.authornotetemplate = "[Author's Note: <|>]"
+ vars.authornotetemplate = "[Author's note: <|>]"
vars.actions = structures.KoboldStoryRegister()
vars.worldinfo = []
vars.worldinfo_i = []
@@ -4101,7 +4101,7 @@ def importAidgRequest(id):
vars.prompt = js["promptContent"]
vars.memory = js["memory"]
vars.authornote = js["authorsNote"]
- vars.authornotetemplate = "[Author's Note: <|>]"
+ vars.authornotetemplate = "[Author's note: <|>]"
vars.actions = structures.KoboldStoryRegister()
vars.worldinfo = []
vars.worldinfo_i = []
From 4d27f1e09d80079038200c358ae3c9f7dd00ca1e Mon Sep 17 00:00:00 2001
From: Gnome Ann <>
Date: Thu, 30 Dec 2021 15:27:48 -0500
Subject: [PATCH 07/10] Fix "flash of unstyled content" in FF, and status icon
color
---
static/custom.css | 2 +-
templates/index.html | 13 +++++++------
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/static/custom.css b/static/custom.css
index f1c50115..6703ae2e 100644
--- a/static/custom.css
+++ b/static/custom.css
@@ -794,7 +794,7 @@ body.connected .statusicon, .statusicon.always-available {
}
.statusicon.active {
- color: #3bf723;
+ color: #3bf723 !important;
}
.helpicon:hover, .statusicon:hover {
diff --git a/templates/index.html b/templates/index.html
index 0b26c29b..43e15c6f 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -4,6 +4,13 @@
KoboldAI Client
+
+
+
+
+
+
+
@@ -11,12 +18,6 @@
-
-
-
-
-
-
From 44eaab85156608005a734cb165572147a1702a0c Mon Sep 17 00:00:00 2001
From: Gnome Ann <>
Date: Thu, 30 Dec 2021 16:33:28 -0500
Subject: [PATCH 08/10] Disable most top menu actions when disconnected
---
static/application.js | 16 ++++++++++++----
static/custom.css | 2 +-
templates/index.html | 4 ++--
3 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/static/application.js b/static/application.js
index 337574c4..a0614ffa 100644
--- a/static/application.js
+++ b/static/application.js
@@ -2330,7 +2330,9 @@ $(document).ready(function(){
});
button_impaidg.on("click", function(ev) {
- showAidgPopup();
+ if(connected) {
+ showAidgPopup();
+ }
});
aidg_close.on("click", function(ev) {
@@ -2346,7 +2348,9 @@ $(document).ready(function(){
});
button_saveas.on("click", function(ev) {
- showSaveAsPopup();
+ if(connected) {
+ showSaveAsPopup();
+ }
});
saveas_close.on("click", function(ev) {
@@ -2412,7 +2416,9 @@ $(document).ready(function(){
});
button_newgame.on("click", function(ev) {
- showNewStoryPopup();
+ if(connected) {
+ showNewStoryPopup();
+ }
});
ns_accept.on("click", function(ev) {
@@ -2445,7 +2451,9 @@ $(document).ready(function(){
});
button_rndgame.on("click", function(ev) {
- showRandomStoryPopup();
+ if(connected) {
+ showRandomStoryPopup();
+ }
});
rs_accept.on("click", function(ev) {
diff --git a/static/custom.css b/static/custom.css
index 6703ae2e..e35fed2a 100644
--- a/static/custom.css
+++ b/static/custom.css
@@ -1179,7 +1179,7 @@ body.connected .navbar-togger:hover, .navbar-togger.always-available:hover {
background-color: #757575;
}
-body .popuptitlebar {
+body.connected .popuptitlebar {
background-color: #337ab7;
}
diff --git a/templates/index.html b/templates/index.html
index 43e15c6f..37f8483b 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -9,7 +9,7 @@
-
+
@@ -17,7 +17,7 @@
-
+
From f9c1e38ee8ce73ea362a90502d4e38b235461511 Mon Sep 17 00:00:00 2001
From: Gnome Ann <>
Date: Thu, 30 Dec 2021 16:37:48 -0500
Subject: [PATCH 09/10] Disable "Download Story as Plaintext" when disconnected
This is to help avoid confusion for people who want to backup their
current story after being disconnected from the server.
---
static/application.js | 4 +++-
templates/index.html | 4 ++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/static/application.js b/static/application.js
index a0614ffa..72912f1c 100644
--- a/static/application.js
+++ b/static/application.js
@@ -2367,7 +2367,9 @@ $(document).ready(function(){
});
button_downloadtxt.on("click", function(ev) {
- downloadStory('plaintext');
+ if(connected) {
+ downloadStory('plaintext');
+ }
});
button_load.on("click", function(ev) {
diff --git a/templates/index.html b/templates/index.html
index 37f8483b..88f55b06 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -17,7 +17,7 @@
-
+
@@ -47,7 +47,7 @@
Save As
Save To File...
Download Story as JSON
- Download Story as Plaintext
+ Download Story as Plaintext
From f4c9f06c4ede10f5f0a8773bf6df0d715d8a37b5 Mon Sep 17 00:00:00 2001
From: Gnome Ann <>
Date: Thu, 30 Dec 2021 16:51:50 -0500
Subject: [PATCH 10/10] Set content type of Blobs in `downloadStory()`
---
static/application.js | 4 ++--
templates/index.html | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/static/application.js b/static/application.js
index 72912f1c..a827ef13 100644
--- a/static/application.js
+++ b/static/application.js
@@ -1379,7 +1379,7 @@ function downloadStory(format) {
}
if(format == "plaintext") {
- var objectURL = URL.createObjectURL(new Blob(actionlist_compiled));
+ var objectURL = URL.createObjectURL(new Blob(actionlist_compiled, {type: "text/plain; charset=UTF-8"}));
anchor.setAttribute('href', objectURL);
anchor.setAttribute('download', filename_without_extension + ".txt");
anchor.click();
@@ -1425,7 +1425,7 @@ function downloadStory(format) {
worldinfo: wilist_compiled,
wifolders_d: wifolders_d,
wifolders_l: wifolders_l,
- }, null, 3)]));
+ }, null, 3)], {type: "application/json; charset=UTF-8"}));
anchor.setAttribute('href', objectURL);
anchor.setAttribute('download', filename_without_extension + ".json");
anchor.click();
diff --git a/templates/index.html b/templates/index.html
index 88f55b06..72dcb784 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -17,7 +17,7 @@
-
+