So much for that 100px hack
This commit is contained in:
somebody
2022-09-11 21:41:37 -05:00
parent 0425d87b29
commit 6fb372c5e1
3 changed files with 175 additions and 43 deletions

View File

@@ -7481,7 +7481,7 @@ def UI_2_import_world_info(data):
koboldai_vars.worldinfo_v2.add_item_to_folder(uids[child], folder_name)
@socketio.on("search_wi")
def UI_2_load_softprompt_list(data):
def UI_2_search_wi(data):
query = data["query"].lower()
full_data = koboldai_vars.worldinfo_v2.to_json()
@@ -7502,6 +7502,32 @@ def UI_2_load_softprompt_list(data):
socketio.emit("wi_results", results, broadcast=True, room="UI_2")
@socketio.on("update_wi_attribute")
def UI_2_update_wi_attribute(data):
uid, key, value = data["uid"], data["key"], data["value"]
koboldai_vars.worldinfo_v2.world_info[uid][key] = value
socketio.emit("world_info_entry", koboldai_vars.worldinfo_v2.world_info[uid], broadcast=True, room="UI_2")
@socketio.on("update_wi_keys")
def UI_2_update_wi_attribute(data):
uid, key, is_secondary, operation = data["uid"], data["key"], data["is_secondary"], data["operation"]
keykey = "key" if not is_secondary else "keysecondary"
key_exists = key in koboldai_vars.worldinfo_v2.world_info[uid][keykey]
if operation == "add":
if not key_exists:
koboldai_vars.worldinfo_v2.world_info[uid][keykey].append(key)
elif operation == "remove":
if key_exists:
koboldai_vars.worldinfo_v2.world_info[uid][keykey].remove(key)
if keykey == "keysecondary":
koboldai_vars.worldinfo_v2.world_info[uid]["selective"] = len(koboldai_vars.worldinfo_v2.world_info[uid]["keysecondary"]) > 0
# Send to UI
socketio.emit("world_info_entry", koboldai_vars.worldinfo_v2.world_info[uid], broadcast=True, room="UI_2")
#==================================================================#
# Event triggered when user edits phrase biases