optimize: wildcard selector may slow down object_info transfer

This commit is contained in:
Dr.Lt.Data
2023-11-08 00:01:47 +09:00
parent 1e6895d2e2
commit d25a42aad3
4 changed files with 27 additions and 8 deletions
+18 -5
View File
@@ -2,6 +2,16 @@ import { ComfyApp, app } from "../../scripts/app.js";
import { ComfyDialog, $el } from "../../scripts/ui.js";
import { api } from "../../scripts/api.js";
let wildcards_list = [];
async function load_wildcards() {
let res = await api.fetchApi('/impact/wildcards/list');
let data = await res.json();
wildcards_list = data.data;
}
load_wildcards();
// temporary implementation (copying from https://github.com/pythongosssss/ComfyUI-WD14-Tagger)
// I think this should be included into master!!
class ImpactProgressBadge {
@@ -531,12 +541,15 @@ app.registerExtension({
node.widgets[tbox_id].value += value;
}
}
node._wvalue = value;
},
get: () => {
return node._wvalue;
}
get: () => { return "Select the Wildcard to add to the text"; }
});
Object.defineProperty(node.widgets[combo_id+1].options, "values", {
set: (x) => {},
get: () => {
return wildcards_list;
}
});
if(has_lora) {
+1 -1
View File
@@ -2,7 +2,7 @@ import configparser
import os
version = "V4.30.1"
version = "V4.30.2"
dependency_version = 17
+2 -2
View File
@@ -2011,7 +2011,7 @@ class ImpactWildcardProcessor:
"populated_text": ("STRING", {"multiline": True, "dynamicPrompts": False}),
"mode": ("BOOLEAN", {"default": True, "label_on": "Populate", "label_off": "Fixed"}),
"seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff}),
"Select to add Wildcard": (["Select the Wildcard to add to the text"] + impact.wildcards.get_wildcard_list(), ),
"Select to add Wildcard": (["Select the Wildcard to add to the text"],),
},
}
@@ -2035,7 +2035,7 @@ class ImpactWildcardEncode:
"populated_text": ("STRING", {"multiline": True, "dynamicPrompts": False}),
"mode": ("BOOLEAN", {"default": True, "label_on": "Populate", "label_off": "Fixed"}),
"Select to add LoRA": (["Select the LoRA to add to the text"] + folder_paths.get_filename_list("loras"), ),
"Select to add Wildcard": (["Select the Wildcard to add to the text"] + impact.wildcards.get_wildcard_list(), ),
"Select to add Wildcard": (["Select the Wildcard to add to the text"], ),
"seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff}),
},
}
+6
View File
@@ -189,6 +189,12 @@ async def sam_detect(request):
return web.Response(status=400)
@server.PromptServer.instance.routes.get("/impact/wildcards/list")
async def wildcards_list(request):
data = {'data': impact.wildcards.get_wildcard_list()}
return web.json_response(data)
@server.PromptServer.instance.routes.post("/impact/wildcards")
async def populate_wildcards(request):
data = await request.json()