Add object_type as a WI parameter

This commit is contained in:
somebody
2022-12-12 19:18:48 -06:00
parent 08cf53ac67
commit 62d4ed8f3e
3 changed files with 27 additions and 7 deletions

View File

@@ -8990,14 +8990,17 @@ def UI_2_edit_world_info(data):
koboldai_vars.worldinfo_v2.add_item(data['title'], data['key'],
data['keysecondary'], data['folder'],
data['constant'], data['manual_text'],
data['comment'], wpp=data['wpp'], use_wpp=data['use_wpp'])
data['comment'], wpp=data['wpp'],
use_wpp=data['use_wpp'], object_type=data["object_type"])
emit("delete_new_world_info_entry", {})
else:
logger.debug("Editting WI: {}".format(data))
koboldai_vars.worldinfo_v2.edit_item(data['uid'], data['title'], data['key'],
data['keysecondary'], data['folder'],
data['constant'], data['manual_text'],
data['comment'], wi_type=data["type"], wpp=data['wpp'], use_wpp=data['use_wpp'])
data['comment'], wi_type=data["type"],
wpp=data['wpp'], use_wpp=data['use_wpp'],
object_type=data["object_type"])
#==================================================================#

View File

@@ -2139,7 +2139,7 @@ class KoboldWorldInfo(object):
def add_item(self, title, key, keysecondary, folder, constant, manual_text,
comment, wi_type="wi", use_wpp=False,
wpp={'name': "", 'type': "", 'format': "W++", 'attributes': {}},
v1_uid=None, recalc=True, sync=True, send_to_ui=True):
v1_uid=None, recalc=True, sync=True, send_to_ui=True, object_type=None):
if len(self.world_info) == 0:
uid = 0
else:
@@ -2189,7 +2189,8 @@ class KoboldWorldInfo(object):
"used_in_game": constant,
'wpp': wpp,
'use_wpp': use_wpp,
'v1_uid': v1_uid
'v1_uid': v1_uid,
"object_type": object_type,
}
except:
print("Error:")
@@ -2213,7 +2214,22 @@ class KoboldWorldInfo(object):
ignore = self.koboldai_vars.calc_ai_text()
return uid
def edit_item(self, uid, title, key, keysecondary, folder, constant, manual_text, comment, wi_type, use_wpp=False, before=None, wpp={'name': "", 'type': "", 'format': "W++", 'attributes': {}}):
def edit_item(
self,
uid,
title,
key,
keysecondary,
folder,
constant,
manual_text,
comment,
wi_type,
use_wpp=False,
before=None,
wpp={'name': "", 'type': "", 'format': "W++", 'attributes': {}},
object_type=None,
):
logger.debug("Editing World Info {}: {}".format(uid, title))
old_folder = self.world_info[uid]['folder']
#move the world info entry if the folder changed or if there is a new order requested
@@ -2253,7 +2269,8 @@ class KoboldWorldInfo(object):
"selective": len(keysecondary) > 0,
"used_in_game": constant,
'wpp': wpp,
'use_wpp': use_wpp
'use_wpp': use_wpp,
"object_type": object_type,
}
self.story_settings.gamesaved = False
@@ -2369,6 +2386,7 @@ class KoboldWorldInfo(object):
wi_type=item["type"],
use_wpp=item['use_wpp'] if 'use_wpp' in item else False,
wpp=item['wpp'] if 'wpp' in item else {'name': "", 'type': "", 'format': "W++", 'attributes': {}},
object_type=item.get("object_type"),
recalc=False, sync=False)
if folder is None:
#self.world_info = {int(x): data['entries'][x] for x in data['entries']}

View File

@@ -81,7 +81,6 @@
</div>
</div>
<div>
Comment:
<textarea draggable="true" ondragstartondragstart="event.preventDefault();event.stopPropagation();" rows=1 id="world_info_comment_"
class="world_info_text world_info_comment fullwidth" oninput="autoResize(this, 60)" onfocus="autoResize(this, 60)" onblur="this.style.height='60px';"
onfocus="this.parentElement.parentElement.setAttribute('draggable', 'false');this.setAttribute('draggable', 'false');;"