feat: external interface for wildcard feature
This commit is contained in:
@@ -546,6 +546,7 @@ app.registerExtension({
|
||||
|
||||
// Preventing validation errors from occurring in any situation.
|
||||
node.widgets[combo_id].serializeValue = () => { return "Select the LoRA to add to the text"; }
|
||||
node.widgets[combo_id+1].serializeValue = () => { return "Select the Wildcard to add to the text"; }
|
||||
}
|
||||
|
||||
if(node.comfyClass == "ImpactWildcardProcessor" || node.comfyClass == "ImpactWildcardEncode") {
|
||||
|
||||
@@ -2,7 +2,7 @@ import configparser
|
||||
import os
|
||||
|
||||
|
||||
version = "V4.18.5"
|
||||
version = "V4.18.6"
|
||||
|
||||
dependency_version = 14
|
||||
|
||||
|
||||
@@ -1943,6 +1943,14 @@ class ImpactWildcardEncode:
|
||||
RETURN_NAMES = ("model", "clip", "conditioning", "populated_text")
|
||||
FUNCTION = "doit"
|
||||
|
||||
@staticmethod
|
||||
def process_with_loras(**kwargs):
|
||||
return impact.wildcards.process_with_loras(**kwargs)
|
||||
|
||||
@staticmethod
|
||||
def get_wildcard_list():
|
||||
return impact.wildcards.get_wildcard_list()
|
||||
|
||||
def doit(self, *args, **kwargs):
|
||||
populated = kwargs['populated_text']
|
||||
model, clip, conditioning = impact.wildcards.process_with_loras(populated, kwargs['model'], kwargs['clip'])
|
||||
|
||||
@@ -271,7 +271,7 @@ def resolve_lora_name(lora_name_cache, name):
|
||||
return x
|
||||
|
||||
|
||||
def process_with_loras(wildcard_opt, model, clip):
|
||||
def process_with_loras(wildcard_opt, model, clip, clip_encoder=None):
|
||||
lora_name_cache = []
|
||||
|
||||
pass1 = process(wildcard_opt)
|
||||
@@ -305,5 +305,8 @@ def process_with_loras(wildcard_opt, model, clip):
|
||||
print(f"LORA NOT FOUND: {lora_name}")
|
||||
|
||||
print(f"CLIP: {pass2}")
|
||||
return model, clip, nodes.CLIPTextEncode().encode(clip, pass2)[0]
|
||||
|
||||
if clip_encoder is None:
|
||||
return model, clip, nodes.CLIPTextEncode().encode(clip, pass2)[0]
|
||||
else:
|
||||
return model, clip, clip_encoder.encode(clip, pass2)[0]
|
||||
|
||||
Reference in New Issue
Block a user