mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-12 07:10:52 +08:00
DeleteAll updated
modify deleteAll to only delete the images listed in the drawer
This commit is contained in:
parent
0b829dc4d4
commit
a95f4e9757
@ -187,8 +187,8 @@ class PromptServer():
|
||||
if not os.path.exists(output_dir):
|
||||
return web.json_response({"message": "Output directory does not exist."}, status=404)
|
||||
try:
|
||||
if (filename == "all"):
|
||||
for file_name in os.listdir(output_dir):
|
||||
if isinstance(filename, list):
|
||||
for file_name in filename: #os.listdir(output_dir):
|
||||
file_path = os.path.join(output_dir, file_name)
|
||||
if os.path.isfile(file_path):
|
||||
os.remove(file_path)
|
||||
|
||||
@ -210,9 +210,10 @@ app.registerExtension({
|
||||
right: "5px",
|
||||
});
|
||||
deleteAllButton.onclick = () => {
|
||||
const confirmDelete = confirm("Are you sure you want to delete all images?");
|
||||
const confirmDelete = confirm("Are you sure you want to delete all images in the drawer?");
|
||||
if (confirmDelete) {
|
||||
api.deleteAllImages();
|
||||
debugger;
|
||||
api.deleteAllImages(allImages.map(item => item.filename));
|
||||
allImages = []
|
||||
imageList.replaceChildren(menu, resizeHandle);
|
||||
}
|
||||
|
||||
@ -117,8 +117,8 @@ class ComfyApi extends EventTarget {
|
||||
return await resp.json();
|
||||
}
|
||||
|
||||
async deleteAllImages() {
|
||||
await this.#postItem("delete", { delete: "all" })
|
||||
async deleteAllImages(filenames) {
|
||||
await this.#postItem("delete", { delete: filenames })
|
||||
}
|
||||
async deleteImage(filename) {
|
||||
await this.#postItem("delete", { delete: filename })
|
||||
|
||||
Loading…
Reference in New Issue
Block a user