mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-03-10 00:20:11 +01:00
Make the dynamic world info scan toggleable
This commit is contained in:
parent
de3664e73c
commit
0a91ea27b3
15
aiserver.py
15
aiserver.py
@ -124,6 +124,7 @@ class vars:
|
||||
acregex_ui = re.compile(r'^ *(>.*)$', re.MULTILINE) # Pattern for matching actions in the HTML-escaped story so we can apply colouring, etc (make sure to encase part to format in parentheses)
|
||||
actionmode = 1
|
||||
adventure = False
|
||||
dynamicscan = False
|
||||
remote = False
|
||||
|
||||
#==================================================================#
|
||||
@ -564,8 +565,10 @@ if(not vars.model in ["InferKit", "Colab", "OAI", "ReadOnly"]):
|
||||
) -> bool:
|
||||
assert input_ids.ndim == 2
|
||||
#assert input_ids.shape[:-1] == self.head_length.shape
|
||||
tail = input_ids[..., self.head_length:]
|
||||
self.any_new_entries = False
|
||||
if(not vars.dynamicscan):
|
||||
return False
|
||||
tail = input_ids[..., self.head_length:]
|
||||
for t in tail:
|
||||
decoded = tokenizer.decode(t)
|
||||
_, found = checkworldinfo(decoded, force_use_txt=True)
|
||||
@ -943,6 +946,10 @@ def get_message(msg):
|
||||
vars.adventure = msg['data']
|
||||
settingschanged()
|
||||
refresh_settings()
|
||||
elif(msg['cmd'] == 'setdynamicscan'):
|
||||
vars.dynamicscan = msg['data']
|
||||
settingschanged()
|
||||
refresh_settings()
|
||||
elif(not vars.remote and msg['cmd'] == 'importwi'):
|
||||
wiimportrequest()
|
||||
|
||||
@ -1000,6 +1007,7 @@ def savesettings():
|
||||
js["widepth"] = vars.widepth
|
||||
js["useprompt"] = vars.useprompt
|
||||
js["adventure"] = vars.adventure
|
||||
js["dynamicscan"] = vars.dynamicscan
|
||||
|
||||
# Write it
|
||||
if not os.path.exists('settings'):
|
||||
@ -1050,6 +1058,8 @@ def loadsettings():
|
||||
vars.useprompt = js["useprompt"]
|
||||
if("adventure" in js):
|
||||
vars.adventure = js["adventure"]
|
||||
if("dynamicscan" in js):
|
||||
vars.dynamicscan = js["dynamicscan"]
|
||||
|
||||
file.close()
|
||||
|
||||
@ -1074,6 +1084,8 @@ def loadmodelsettings():
|
||||
vars.rep_pen = js["rep_pen"]
|
||||
if("adventure" in js):
|
||||
vars.adventure = js["adventure"]
|
||||
if("dynamicscan" in js):
|
||||
vars.dynamicscan = js["dynamicscan"]
|
||||
if("formatoptns" in js):
|
||||
vars.formatoptns = js["formatoptns"]
|
||||
model_config.close()
|
||||
@ -1735,6 +1747,7 @@ def refresh_settings():
|
||||
emit('from_server', {'cmd': 'updatewidepth', 'data': vars.widepth}, broadcast=True)
|
||||
emit('from_server', {'cmd': 'updateuseprompt', 'data': vars.useprompt}, broadcast=True)
|
||||
emit('from_server', {'cmd': 'updateadventure', 'data': vars.adventure}, broadcast=True)
|
||||
emit('from_server', {'cmd': 'updatedynamicscan', 'data': vars.dynamicscan}, broadcast=True)
|
||||
|
||||
emit('from_server', {'cmd': 'updatefrmttriminc', 'data': vars.formatoptns["frmttriminc"]}, broadcast=True)
|
||||
emit('from_server', {'cmd': 'updatefrmtrmblln', 'data': vars.formatoptns["frmtrmblln"]}, broadcast=True)
|
||||
|
@ -118,6 +118,17 @@ gensettingstf = [{
|
||||
"step": 1,
|
||||
"default": 0,
|
||||
"tooltip": "Turn this on if you are playing a Choose your Adventure model."
|
||||
},
|
||||
{
|
||||
"uitype": "toggle",
|
||||
"unit": "bool",
|
||||
"label": "Dynamic WI Scan",
|
||||
"id": "setdynamicscan",
|
||||
"min": 0,
|
||||
"max": 1,
|
||||
"step": 1,
|
||||
"default": 0,
|
||||
"tooltip": "Scan the AI's output for world info keys as it's generating the output. Turning this on will set Gens Per Action to 1, as these two features are not currently compatible with each other."
|
||||
}]
|
||||
|
||||
gensettingsik =[{
|
||||
|
@ -1592,6 +1592,9 @@ $(document).ready(function(){
|
||||
$("#setadventure").prop('checked', msg.data).change();
|
||||
// Update adventure state
|
||||
setadventure(msg.data);
|
||||
} else if(msg.cmd == "updatedynamicscan") {
|
||||
// Update toggle state
|
||||
$("#setdynamicscan").prop('checked', msg.data).change();
|
||||
} else if(msg.cmd == "runs_remotely") {
|
||||
hide([button_loadfrfile, button_savetofile, button_import, button_importwi]);
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<script src="static/jquery-3.6.0.min.js"></script>
|
||||
<script src="static/socket.io.min.js"></script>
|
||||
<script src="static/application.js?ver=1.16.3ua"></script>
|
||||
<script src="static/application.js?ver=1.16.3ub"></script>
|
||||
<script src="static/bootstrap.min.js"></script>
|
||||
<script src="static/bootstrap-toggle.min.js"></script>
|
||||
<script src="static/rangy-core.min.js"></script>
|
||||
|
Loading…
x
Reference in New Issue
Block a user