fix bogus metadata for extra networks appearing out of cache
fix description editing for checkpoint not immediately appearing on cards
This commit is contained in:
parent
f71630edb3
commit
ccd97886da
@ -80,18 +80,18 @@ def cached_data_for_file(subsection, title, filename, func):
|
||||
|
||||
entry = existing_cache.get(title)
|
||||
if entry:
|
||||
cached_mtime = existing_cache[title].get("mtime", 0)
|
||||
cached_mtime = entry.get("mtime", 0)
|
||||
if ondisk_mtime > cached_mtime:
|
||||
entry = None
|
||||
|
||||
if not entry:
|
||||
entry = func()
|
||||
if entry is None:
|
||||
value = func()
|
||||
if value is None:
|
||||
return None
|
||||
|
||||
entry['mtime'] = ondisk_mtime
|
||||
entry = {'mtime': ondisk_mtime, 'value': value}
|
||||
existing_cache[title] = entry
|
||||
|
||||
dump_cache()
|
||||
|
||||
return entry
|
||||
return entry['value']
|
||||
|
@ -52,7 +52,7 @@ def get_metadata(page: str = "", item: str = ""):
|
||||
if metadata is None:
|
||||
return JSONResponse({})
|
||||
|
||||
return JSONResponse({"metadata": metadata})
|
||||
return JSONResponse({"metadata": json.dumps(metadata, indent=4, ensure_ascii=False)})
|
||||
|
||||
|
||||
def get_single_card(page: str = "", tabname: str = "", name: str = ""):
|
||||
@ -66,6 +66,7 @@ def get_single_card(page: str = "", tabname: str = "", name: str = ""):
|
||||
errors.display(e, "creating item for extra network")
|
||||
item = page.items.get(name)
|
||||
|
||||
page.read_user_metadata(item)
|
||||
item_html = page.create_html_for_item(item, tabname)
|
||||
|
||||
return JSONResponse({"html": item_html})
|
||||
|
@ -13,7 +13,7 @@ class ExtraNetworksPageCheckpoints(ui_extra_networks.ExtraNetworksPage):
|
||||
shared.refresh_checkpoints()
|
||||
|
||||
def create_item(self, name, index=None):
|
||||
checkpoint: sd_models.CheckpointInfo = sd_models.checkpoints_list.get(name)
|
||||
checkpoint: sd_models.CheckpointInfo = sd_models.checkpoint_aliases.get(name)
|
||||
path, ext = os.path.splitext(checkpoint.filename)
|
||||
return {
|
||||
"name": checkpoint.name_for_extra,
|
||||
@ -24,7 +24,6 @@ class ExtraNetworksPageCheckpoints(ui_extra_networks.ExtraNetworksPage):
|
||||
"onclick": '"' + html.escape(f"""return selectCheckpoint({quote_js(name)})""") + '"',
|
||||
"local_preview": f"{path}.{shared.opts.samples_format}",
|
||||
"sort_keys": {'default': index, **self.get_sort_keys(checkpoint.filename)},
|
||||
|
||||
}
|
||||
|
||||
def list_items(self):
|
||||
|
Loading…
Reference in New Issue
Block a user