Apply suggestions from code review
Co-authored-by: Aarni Koskela <akx@iki.fi>
This commit is contained in:
parent
4cc0cede6d
commit
9009e25cb1
@ -27,7 +27,8 @@ class ExtraNetworksPageLora(ui_extra_networks.ExtraNetworksPage):
|
|||||||
"prompt": json.dumps(f"<lora:{alias}:") + " + opts.extra_networks_default_multiplier + " + json.dumps(">"),
|
"prompt": json.dumps(f"<lora:{alias}:") + " + opts.extra_networks_default_multiplier + " + json.dumps(">"),
|
||||||
"local_preview": f"{path}.{shared.opts.samples_format}",
|
"local_preview": f"{path}.{shared.opts.samples_format}",
|
||||||
"metadata": json.dumps(lora_on_disk.metadata, indent=4) if lora_on_disk.metadata else None,
|
"metadata": json.dumps(lora_on_disk.metadata, indent=4) if lora_on_disk.metadata else None,
|
||||||
"sort_keys": {**self.get_sort_keys(lora_on_disk.filename), **{'default': index}},
|
"sort_keys": {'default': index, **self.get_sort_keys(lora_on_disk.filename)},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def allowed_directories_for_previews(self):
|
def allowed_directories_for_previews(self):
|
||||||
|
@ -210,10 +210,12 @@ class ExtraNetworksPage:
|
|||||||
"""
|
"""
|
||||||
List of default keys used for sorting in the UI.
|
List of default keys used for sorting in the UI.
|
||||||
"""
|
"""
|
||||||
|
pth = Path(path)
|
||||||
|
stat = pth.stat()
|
||||||
return {
|
return {
|
||||||
"date_created": int(Path(path).stat().st_ctime or 0),
|
"date_created": int(stat.st_ctime or 0),
|
||||||
"date_modified": int(Path(path).stat().st_mtime or 0),
|
"date_modified": int(stat.st_mtime or 0),
|
||||||
"name": Path(path).name.lower(),
|
"name": pth.name.lower(),
|
||||||
}
|
}
|
||||||
|
|
||||||
def find_preview(self, path):
|
def find_preview(self, path):
|
||||||
|
@ -24,7 +24,8 @@ class ExtraNetworksPageCheckpoints(ui_extra_networks.ExtraNetworksPage):
|
|||||||
"search_term": self.search_terms_from_path(checkpoint.filename) + " " + (checkpoint.sha256 or ""),
|
"search_term": self.search_terms_from_path(checkpoint.filename) + " " + (checkpoint.sha256 or ""),
|
||||||
"onclick": '"' + html.escape(f"""return selectCheckpoint({json.dumps(name)})""") + '"',
|
"onclick": '"' + html.escape(f"""return selectCheckpoint({json.dumps(name)})""") + '"',
|
||||||
"local_preview": f"{path}.{shared.opts.samples_format}",
|
"local_preview": f"{path}.{shared.opts.samples_format}",
|
||||||
"sort_keys": {**self.get_sort_keys(checkpoint.filename), **{'default': index}},
|
"sort_keys": {'default': index, **self.get_sort_keys(checkpoint.filename)},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def allowed_directories_for_previews(self):
|
def allowed_directories_for_previews(self):
|
||||||
|
@ -23,7 +23,8 @@ class ExtraNetworksPageHypernetworks(ui_extra_networks.ExtraNetworksPage):
|
|||||||
"search_term": self.search_terms_from_path(path),
|
"search_term": self.search_terms_from_path(path),
|
||||||
"prompt": json.dumps(f"<hypernet:{name}:") + " + opts.extra_networks_default_multiplier + " + json.dumps(">"),
|
"prompt": json.dumps(f"<hypernet:{name}:") + " + opts.extra_networks_default_multiplier + " + json.dumps(">"),
|
||||||
"local_preview": f"{path}.preview.{shared.opts.samples_format}",
|
"local_preview": f"{path}.preview.{shared.opts.samples_format}",
|
||||||
"sort_keys": {**self.get_sort_keys(path + ext), **{'default': index}},
|
"sort_keys": {'default': index, **self.get_sort_keys(path + ext)},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def allowed_directories_for_previews(self):
|
def allowed_directories_for_previews(self):
|
||||||
|
@ -23,7 +23,8 @@ class ExtraNetworksPageTextualInversion(ui_extra_networks.ExtraNetworksPage):
|
|||||||
"search_term": self.search_terms_from_path(embedding.filename),
|
"search_term": self.search_terms_from_path(embedding.filename),
|
||||||
"prompt": json.dumps(embedding.name),
|
"prompt": json.dumps(embedding.name),
|
||||||
"local_preview": f"{path}.preview.{shared.opts.samples_format}",
|
"local_preview": f"{path}.preview.{shared.opts.samples_format}",
|
||||||
"sort_keys": {**self.get_sort_keys(embedding.filename), **{'default': index}},
|
"sort_keys": {'default': index, **self.get_sort_keys(embedding.filename)},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def allowed_directories_for_previews(self):
|
def allowed_directories_for_previews(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user