Merge pull request #748 from zanllp/feature/comfyui-flux-prompt-compatibility

Enhance prompt parsing compatibility with ComfyUI Flux
pull/757/head
zanllp 2024-11-10 18:28:55 +08:00 committed by GitHub
commit 7215a4cadf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View File

@ -30,7 +30,7 @@ class ComfyUIParser:
else:
params = get_comfyui_exif_data(img)
info = comfyui_exif_data_to_str(params)
except Exception:
except Exception as e:
logger.error('parse comfyui image failed. prompt:')
logger.error(img.info.get('prompt'))
return ImageGenerationInfo()

View File

@ -422,7 +422,8 @@ def get_comfyui_exif_data(img: Image):
meta["Model"] = data[KSampler_entry["model"][0]]["inputs"]["ckpt_name"]
meta["Source Identifier"] = "ComfyUI"
def get_text_from_clip(idx: str) :
text = data[idx]["inputs"]["text"]
inputs = data[idx]["inputs"]
text = inputs["text"] if "text" in inputs else inputs["t5xxl"]
if isinstance(text, list): # type:CLIPTextEncode (NSP) mode:Wildcards
text = data[text[0]]["inputs"]["text"]
return text.strip()