diff --git a/aiserver.py b/aiserver.py index 1ee492e4..3ff03751 100644 --- a/aiserver.py +++ b/aiserver.py @@ -7241,7 +7241,7 @@ def UI_2_edit_world_info(data): print("edit_world_info") print(data) - if data['uid'] == -1: + if data['uid'] < 0: koboldai_vars.worldinfo_v2.add_item(data['title'], data['key'], data['keysecondary'], data['folder'], data['constant'], data['manual_text'], diff --git a/static/koboldai.js b/static/koboldai.js index 16f939e2..c28871de 100644 --- a/static/koboldai.js +++ b/static/koboldai.js @@ -2269,7 +2269,13 @@ function add_secondary_tags(tags, data) { } function create_new_wi_entry(folder) { - data = {"uid": -1, + var uid = -1; + for (item of document.getElementsByClassName('world_info_card')) { + if (parseInt(item.getAttribute("uid")) <= uid) { + uid = parseInt(item.getAttribute("uid")) - 1; + } + } + data = {"uid": uid, "title": "New World Info Entry", "key": [], "keysecondary": [],