Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a88722ce8f | ||
|
|
c0b66c4e07 | ||
|
|
d191668607 | ||
|
|
a70cbb0c8d | ||
|
|
b95499617e | ||
|
|
77095ee38b | ||
|
|
1e59445091 | ||
|
|
b3e66eb21c | ||
|
|
145fbbb158 | ||
|
|
7c215dde00 | ||
|
|
07a1a5314d | ||
|
|
ed6533422e | ||
|
|
278e32450f | ||
|
|
b248fcf346 | ||
|
|
4b35b41d08 | ||
|
|
af96defbe0 | ||
|
|
e8ca90fe35 | ||
|
|
659d35b9b8 | ||
|
|
ee54281e45 | ||
|
|
f94e130bef | ||
|
|
6ab1534e85 | ||
|
|
d960b6dbf1 | ||
|
|
0d0afd7f45 | ||
|
|
2069d0c4fc | ||
|
|
55a57a3b2e | ||
|
|
a2e6aff81c | ||
|
|
2af4a879b5 | ||
|
|
12b5178915 | ||
|
|
a4f5891079 | ||
|
|
9042867e97 | ||
|
|
5527096b53 | ||
|
|
9a84eb186b | ||
|
|
faeea1f73c | ||
|
|
e6cca92351 | ||
|
|
05c3553688 | ||
|
|
23b5afbc4f | ||
|
|
c2ac789c44 | ||
|
|
bc62d2be03 | ||
|
|
74beb22df4 | ||
|
|
0d43174e14 | ||
|
|
91336e987d | ||
|
|
cbf771ff03 | ||
|
|
867f5eb6f1 | ||
|
|
88ed9fa966 |
@@ -0,0 +1,22 @@
|
||||
name: Publish to Comfy registry
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- "pyproject.toml"
|
||||
|
||||
jobs:
|
||||
publish-node:
|
||||
name: Publish Custom Node to registry
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
- name: Publish Custom Node
|
||||
uses: Comfy-Org/publish-node-action@main
|
||||
with:
|
||||
personal_access_token: ${{ secrets.REGISTRY_ACCESS_TOKEN }}
|
||||
@@ -1,4 +1,57 @@
|
||||
# Change Log
|
||||
## v1.3.4
|
||||
> [!TIP]
|
||||
> Starting from v1.3, to support auto-detection on Civitai, `calculate_model_hash` will be renamed as
|
||||
> `calculate_hash` and it will be enabled by default. Due to the addition of temporary storage of the model hash values,
|
||||
> the first image generated after switching to the new model will take more time to calculate the hash value,
|
||||
> but it will not affect the generation speed afterwards until the server is restarted.
|
||||
|
||||
> [!NOTE]
|
||||
> comfyui-prompt-reader-node is now published on the [Comfy Registry](https://www.comfyregistry.org/).
|
||||
|
||||
- Add `Any Converter` node #76 #78
|
||||
- Fix the input validation of the `Parameter Generator` node #89
|
||||
- Fix the input validation of the `Parameter Extractor` node #90
|
||||
- Fix the `Parameter Generator` unable to choose standard resolutions #82
|
||||
- Fix the `Prompt Saver` unable to correctly handle filenames containing `.` #80
|
||||
- Update the `Parameter Extractor` node to support parsing quoted parameters #87 @spagatticode
|
||||
- Update PyProject Toml - License #85 @haohaocreates
|
||||
|
||||
## v1.3.3
|
||||
> [!TIP]
|
||||
> Starting from v1.3, to support auto-detection on Civitai, `calculate_model_hash` will be renamed as
|
||||
> `calculate_hash` and it will be enabled by default. Due to the addition of temporary storage of the model hash values,
|
||||
> the first image generated after switching to the new model will take more time to calculate the hash value,
|
||||
> but it will not affect the generation speed afterwards until the server is restarted.
|
||||
|
||||
> [!NOTE]
|
||||
> comfyui-prompt-reader-node is now published on the [Comfy Registry](https://www.comfyregistry.org/).
|
||||
|
||||
- Add pyproject.toml for Custom Node Registry #75 @haohaocreates
|
||||
|
||||
## v1.3.2
|
||||
> Starting from v1.3, to support auto-detection on Civitai, `calculate_model_hash` will be renamed as
|
||||
> `calculate_hash` and it will be enabled by default. Due to the addition of temporary storage of the model hash values,
|
||||
> the first image generated after switching to the new model will take more time to calculate the hash value,
|
||||
> but it will not affect the generation speed afterwards until the server is restarted.
|
||||
|
||||
- Add support for pasted images to the `Prompt Reader` node #64
|
||||
- Update core to [1.3.5](https://github.com/receyuki/stable-diffusion-prompt-reader/releases/tag/v1.3.5)
|
||||
- Update nodes.py save_images to have %width and %height #66 @COvert96
|
||||
- Update the `Prompt Reader` node to the new exception handling method
|
||||
|
||||
## v1.3.1
|
||||
> Starting from v1.3, to support auto-detection on Civitai, `calculate_model_hash` will be renamed as
|
||||
> `calculate_hash` and it will be enabled by default. Due to the addition of temporary storage of the model hash values,
|
||||
> the first image generated after switching to the new model will take more time to calculate the hash value,
|
||||
> but it will not affect the generation speed afterwards until the server is restarted.
|
||||
|
||||
- Add user-friendly warnings and remove the exception raised during the reading of metadata #58 #63
|
||||
- Add JPEG to the image extension list
|
||||
- Fix the issue where the `Prompt Saver` node cannot consume filename from another `Prompt Saver` node #62
|
||||
- Fix the `Prompt Saver` node freezes workflow when name includes `%model` #61
|
||||
- Remove ckpt validation of the `Prompt Reader` node #59
|
||||
|
||||
## v1.3.0
|
||||
> Starting from this version, to support auto-detection on Civitai, `calculate_model_hash` will be renamed as
|
||||
> `calculate_hash` and it will be enabled by default. Due to the addition of temporary storage of the model hash values,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<div align="center">
|
||||
<img alt="icon" src="https://github.com/receyuki/stable-diffusion-prompt-reader/raw/master/sd_prompt_reader/resources/icon.png" width=20% height=20%>
|
||||
<img alt="icon" src="https://github.com/receyuki/stable-diffusion-prompt-reader/raw/master/sd_prompt_reader/resources/icon-cube.png" width=20% height=20%>
|
||||
<h1>SD Prompt Reader Node</h1>
|
||||
<a href="https://github.com/receyuki/comfyui-prompt-reader-node/blob/master/LICENSE">
|
||||
<img alt="GitHub" src="https://img.shields.io/github/license/receyuki/comfyui-prompt-reader-node"></a>
|
||||
@@ -28,22 +28,27 @@ additional metadata to ensure compatibility with metadata detection on websites
|
||||
|
||||
|
||||
## Supported Formats
|
||||
| | PNG | JPEG | WEBP | TXT* |
|
||||
|--------------------------------------------------------------------------|:---:|:----:|:----:|:----:|
|
||||
| [A1111's webUI](https://github.com/AUTOMATIC1111/stable-diffusion-webui) | ✅ | ✅ | ✅ | ✅ |
|
||||
| [Easy Diffusion](https://github.com/easydiffusion/easydiffusion) | ✅ | ✅ | ✅ | |
|
||||
| [StableSwarmUI](https://github.com/Stability-AI/StableSwarmUI)* | ✅ | ✅ | | |
|
||||
| [Fooocus-MRE](https://github.com/MoonRide303/Fooocus-MRE)* | ✅ | ✅ | | |
|
||||
| [InvokeAI](https://github.com/invoke-ai/InvokeAI) | ✅ | | | |
|
||||
| [ComfyUI](https://github.com/comfyanonymous/ComfyUI)* | ✅ | | | |
|
||||
| [NovelAI](https://novelai.net/) | ✅ | | | |
|
||||
| [Draw Things](https://drawthings.ai/) | ✅ | | | |
|
||||
| Naifu(4chan) | ✅ | | | |
|
||||
| | PNG | JPEG | WEBP | TXT* |
|
||||
|----------------------------------------------------------------------------------------|:---:|:----:|:----:|:----:|
|
||||
| [A1111's webUI](https://github.com/AUTOMATIC1111/stable-diffusion-webui) | ✅ | ✅ | ✅ | ✅ |
|
||||
| [Easy Diffusion](https://github.com/easydiffusion/easydiffusion) | ✅ | ✅ | ✅ | |
|
||||
| [StableSwarmUI](https://github.com/Stability-AI/StableSwarmUI)* | ✅ | ✅ | | |
|
||||
| [StableSwarmUI (prior to 0.5.8-alpha)](https://github.com/Stability-AI/StableSwarmUI)* | ✅ | ✅ | | |
|
||||
| [Fooocus-MRE](https://github.com/MoonRide303/Fooocus-MRE)* | ✅ | ✅ | | |
|
||||
| [NovelAI (stealth pnginfo)](https://novelai.net/) | ✅ | | ✅ | |
|
||||
| [NovelAI (legacy)](https://novelai.net/) | ✅ | | | |
|
||||
| [InvokeAI](https://github.com/invoke-ai/InvokeAI) | ✅ | | | |
|
||||
| [InvokeAI (prior to 2.3.5-post.2)](https://github.com/invoke-ai/InvokeAI) | ✅ | | | |
|
||||
| [InvokeAI (prior to 1.15)](https://github.com/invoke-ai/InvokeAI) | ✅ | | | |
|
||||
| [ComfyUI](https://github.com/comfyanonymous/ComfyUI)* | ✅ | | | |
|
||||
| [Draw Things](https://drawthings.ai/) | ✅ | | | |
|
||||
| Naifu(4chan) | ✅ | | | |
|
||||
|
||||
See [SD Prompt Reader](https://github.com/receyuki/stable-diffusion-prompt-reader#supported-formats) for details
|
||||
|
||||
## Installation
|
||||
>While ZIP package is available, it is strongly recommended not to use it for installation.
|
||||
> [!NOTE]
|
||||
> While ZIP package is available, it is strongly recommended not to use it for installation.
|
||||
### Install and update via [ComfyUI Manager](https://github.com/ltdrdata/ComfyUI-Manager) (Recommended)
|
||||
Search for `SD Prompt Reader` in the ComfyUI Manager and install it.
|
||||
### Install manually
|
||||
@@ -76,9 +81,11 @@ It uses the Image Data Reader from the
|
||||
[standalone SD Prompt Reader](https://github.com/receyuki/stable-diffusion-prompt-reader),
|
||||
allowing it to support the same formats and receive updates along with the
|
||||
[SD Prompt Reader](https://github.com/receyuki/stable-diffusion-prompt-reader).
|
||||
- Due to custom nodes and complex workflows potentially causing issues with SD Prompt Reader's ability
|
||||
to read image metadata correctly, it is recommended to embed the `Prompt Saver` Node within the workflow
|
||||
to ensure maximum compatibility.
|
||||
> [!IMPORTANT]
|
||||
> Due to custom nodes and complex workflows potentially causing issues with SD Prompt Reader's ability
|
||||
> to read image metadata correctly, it is recommended to embed the `Prompt Saver` Node within the workflow
|
||||
> to ensure maximum compatibility.
|
||||
|
||||
<details>
|
||||
<summary><b>More Information</b></summary>
|
||||
|
||||
@@ -122,16 +129,19 @@ e.g. `sd_xl_base` will be matched with `SDXL\sd_xl_base.safetensors`, and vice v
|
||||
- The `Prompt Saver` Node will write additional metadata in the A1111 format to the output images
|
||||
to be compatible with any tools that support the A1111 format,
|
||||
including SD Prompt Reader and Civitai.
|
||||
Due to custom nodes and complex workflows potentially causing issues with SD Prompt Reader's ability
|
||||
- Due to custom nodes and complex workflows potentially causing issues with SD Prompt Reader's ability
|
||||
to read image metadata correctly, it's recommended to embed this node within the workflow
|
||||
to ensure maximum compatibility.
|
||||
- Since it's not possible to directly extract metadata from `KSampler`, it's necessary to
|
||||
use the `Parameter Generator` Node to generate parameters and simultaneously output them to
|
||||
the `Prompt Saver` Node and `KSampler` Node.
|
||||
to ensure maximum compatibility.
|
||||
> [!TIP]
|
||||
> Since it's not possible to directly extract metadata from `KSampler`, it's necessary to
|
||||
> use the `Parameter Generator` Node to generate parameters and simultaneously output them to
|
||||
> the `Prompt Saver` Node and `KSampler` Node.
|
||||
|
||||
<details>
|
||||
<summary><b>More Information</b></summary>
|
||||
|
||||
#### Image Format
|
||||
- Only PNG format supports embedding both metadata and workflow at the same time. Other formats can only embed metadata.
|
||||
#### Duplicate Filename
|
||||
- When the filename already exists, an index will be added at the end of the filename,
|
||||
e.g. `file.png, file_1.png, file_2.png`.
|
||||
@@ -175,7 +185,9 @@ from the `%counter` in the built-in `Saver` node, it will count all image files
|
||||
- Since it's not possible to directly extract metadata from `KSampler`, it's necessary to
|
||||
use the `Parameter Generator` Node to generate parameters and simultaneously output them to both
|
||||
the `Prompt Saver` Node and `KSampler` Node.
|
||||
- The `Parameter Generator` Node can also be used as a control panel for complex ComfyUI workflows, just like the [AP workflow](https://perilli.com/ai/comfyui/).
|
||||
> [!TIP]
|
||||
> The `Parameter Generator` Node can also be used as a control panel for complex ComfyUI workflows, just like the [AP workflow](https://perilli.com/ai/comfyui/).
|
||||
|
||||
<details>
|
||||
<summary><b>More Information</b></summary>
|
||||
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
VERSION = "1.3.0"
|
||||
VERSION = "1.3.4"
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 156 KiB |
@@ -2,7 +2,7 @@
|
||||
@author: receyuki
|
||||
@title: SD Prompt Reader
|
||||
@nickname: SD Prompt Reader
|
||||
@description: ComfyUI node version of the SD Prompt Reader
|
||||
@description: The ultimate solution for managing image metadata and multi-tool compatibility. ComfyUI node version of the SD Prompt Reader
|
||||
"""
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ import folder_paths
|
||||
|
||||
from .stable_diffusion_prompt_reader.sd_prompt_reader.constants import (
|
||||
SUPPORTED_FORMATS,
|
||||
MESSAGE,
|
||||
)
|
||||
from .stable_diffusion_prompt_reader.sd_prompt_reader.image_data_reader import (
|
||||
ImageDataReader,
|
||||
@@ -45,6 +44,15 @@ BLUE = "\033[1;34m"
|
||||
CYAN = "\033[36m"
|
||||
RESET = "\033[0m"
|
||||
|
||||
ERROR_MESSAGE = {
|
||||
"format_error": "No data detected or unsupported format. "
|
||||
"Please see the README for more details.\n"
|
||||
"https://github.com/receyuki/comfyui-prompt-reader-node#supported-formats",
|
||||
"complex_workflow": "The workflow is overly complex, or unsupported custom nodes have been used. "
|
||||
"Please see the README for more details.\n"
|
||||
"https://github.com/receyuki/comfyui-prompt-reader-node#prompt-reader-node",
|
||||
}
|
||||
|
||||
|
||||
def output_to_terminal(text: str):
|
||||
print(f"{RESET+BLUE}" f"[SD Prompt Reader] " f"{CYAN+text+RESET}")
|
||||
@@ -133,6 +141,8 @@ class SDPromptReader:
|
||||
def load_image(self, image, parameter_index):
|
||||
if image in SDPromptReader.files:
|
||||
image_path = folder_paths.get_annotated_filepath(image)
|
||||
elif image.startswith("pasted/"):
|
||||
image_path = folder_paths.get_annotated_filepath(image)
|
||||
else:
|
||||
image_path = image
|
||||
i = Image.open(image_path)
|
||||
@@ -148,15 +158,28 @@ class SDPromptReader:
|
||||
|
||||
file_path = Path(image_path)
|
||||
|
||||
if file_path.suffix not in SUPPORTED_FORMATS:
|
||||
output_to_terminal(MESSAGE["suffix_error"][1])
|
||||
raise ValueError(MESSAGE["suffix_error"][1])
|
||||
|
||||
with open(file_path, "rb") as f:
|
||||
image_data = ImageDataReader(f)
|
||||
if not image_data.tool:
|
||||
output_to_terminal(MESSAGE["format_error"][1])
|
||||
raise ValueError(MESSAGE["format_error"][1])
|
||||
if image_data.status.name == "COMFYUI_ERROR":
|
||||
output_to_terminal(ERROR_MESSAGE["complex_workflow"])
|
||||
return self.error_output(
|
||||
error_message=ERROR_MESSAGE["complex_workflow"],
|
||||
image=image,
|
||||
mask=mask,
|
||||
width=i.width,
|
||||
height=i.height,
|
||||
filename=file_path.stem,
|
||||
)
|
||||
elif image_data.status.name in ["FORMAT_ERROR", "UNREAD"]:
|
||||
output_to_terminal(ERROR_MESSAGE["format_error"])
|
||||
return self.error_output(
|
||||
error_message=ERROR_MESSAGE["format_error"],
|
||||
image=image,
|
||||
mask=mask,
|
||||
width=i.width,
|
||||
height=i.height,
|
||||
filename=file_path.stem,
|
||||
)
|
||||
|
||||
seed = int(
|
||||
self.param_parser(image_data.parameter.get("seed", 0), parameter_index)
|
||||
@@ -235,6 +258,28 @@ class SDPromptReader:
|
||||
|
||||
return model
|
||||
|
||||
@staticmethod
|
||||
def error_output(
|
||||
error_message, image=None, mask=None, width=0, height=0, filename=""
|
||||
):
|
||||
return {
|
||||
"ui": {"text": ("", "", error_message)},
|
||||
"result": (
|
||||
image,
|
||||
mask,
|
||||
"",
|
||||
"",
|
||||
0,
|
||||
0,
|
||||
0.0,
|
||||
width,
|
||||
height,
|
||||
"",
|
||||
filename,
|
||||
"",
|
||||
),
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def IS_CHANGED(s, image, parameter_index):
|
||||
if image in SDPromptReader.files:
|
||||
@@ -245,6 +290,10 @@ class SDPromptReader:
|
||||
image_data = ImageDataReader(f)
|
||||
return image_data.props
|
||||
|
||||
@classmethod
|
||||
def VALIDATE_INPUTS(s, image):
|
||||
return True
|
||||
|
||||
|
||||
class SDPromptSaver:
|
||||
model_hash_dict = {}
|
||||
@@ -308,15 +357,15 @@ class SDPromptSaver:
|
||||
"lora_name": any_type,
|
||||
"width": (
|
||||
"INT",
|
||||
{"default": 1, "min": 1, "max": MAX_RESOLUTION, "step": 8},
|
||||
{"default": 1, "min": 1, "max": MAX_RESOLUTION, "step": 1},
|
||||
),
|
||||
"height": (
|
||||
"INT",
|
||||
{"default": 1, "min": 1, "max": MAX_RESOLUTION, "step": 8},
|
||||
{"default": 1, "min": 1, "max": MAX_RESOLUTION, "step": 1},
|
||||
),
|
||||
"positive": ("STRING", {"default": "", "multiline": True}),
|
||||
"negative": ("STRING", {"default": "", "multiline": True}),
|
||||
"extension": (["png", "jpg", "webp"],),
|
||||
"extension": (["png", "jpg", "jpeg", "webp"],),
|
||||
"calculate_hash": ("BOOLEAN", {"default": True}),
|
||||
"resource_hash": ("BOOLEAN", {"default": True}),
|
||||
"lossless_webp": ("BOOLEAN", {"default": True}),
|
||||
@@ -407,8 +456,10 @@ class SDPromptSaver:
|
||||
"%seed": seed,
|
||||
"%steps": steps,
|
||||
"%cfg": cfg,
|
||||
"%width": width,
|
||||
"%height": height,
|
||||
"%extension": extension,
|
||||
"%model": model_name_real,
|
||||
"%model": Path(model_name_real).stem,
|
||||
"%sampler": sampler_name_real,
|
||||
"%scheduler": scheduler_real,
|
||||
"%quality": jpg_webp_quality,
|
||||
@@ -552,7 +603,14 @@ class SDPromptSaver:
|
||||
output_to_terminal("Saved file: " + str(file))
|
||||
comments.append(comment)
|
||||
|
||||
return {"ui": {"images": results}, "result": (files, file_paths, comments)}
|
||||
return {
|
||||
"ui": {"images": results},
|
||||
"result": (
|
||||
self.unpack_singleton(files),
|
||||
self.unpack_singleton(file_paths),
|
||||
self.unpack_singleton(comments),
|
||||
),
|
||||
}
|
||||
|
||||
@staticmethod
|
||||
def calculate_hash(name, hash_type):
|
||||
@@ -611,13 +669,13 @@ class SDPromptSaver:
|
||||
|
||||
@staticmethod
|
||||
def get_unique_filename(stem: Path, extension: str, output_folder: Path):
|
||||
file = stem.with_suffix(f".{extension}")
|
||||
file = stem.with_suffix(f"{stem.suffix}.{extension}")
|
||||
index = 0
|
||||
|
||||
while (output_folder / file).exists():
|
||||
index += 1
|
||||
new_stem = f"{stem}_{index}"
|
||||
file = Path(new_stem).with_suffix(f".{extension}")
|
||||
new_stem = Path(f"{stem}_{index}")
|
||||
file = new_stem.with_suffix(f"{new_stem.suffix}.{extension}")
|
||||
|
||||
return file
|
||||
|
||||
@@ -634,6 +692,10 @@ class SDPromptSaver:
|
||||
|
||||
return ""
|
||||
|
||||
@staticmethod
|
||||
def unpack_singleton(arr: list):
|
||||
return arr[0] if len(arr) == 1 else arr
|
||||
|
||||
|
||||
class SDParameterGenerator:
|
||||
ASPECT_RATIO_MAP = {
|
||||
@@ -726,11 +788,11 @@ class SDParameterGenerator:
|
||||
),
|
||||
"width": (
|
||||
"INT",
|
||||
{"default": 512, "min": 1, "max": MAX_RESOLUTION, "step": 8},
|
||||
{"default": 512, "min": 16, "max": MAX_RESOLUTION, "step": 8},
|
||||
),
|
||||
"height": (
|
||||
"INT",
|
||||
{"default": 512, "min": 1, "max": MAX_RESOLUTION, "step": 8},
|
||||
{"default": 512, "min": 16, "max": MAX_RESOLUTION, "step": 8},
|
||||
),
|
||||
"batch_size": (
|
||||
"INT",
|
||||
@@ -807,9 +869,6 @@ class SDParameterGenerator:
|
||||
output_vae=True,
|
||||
output_clip=True,
|
||||
):
|
||||
if ckpt_name not in SDParameterGenerator.ckpt_list:
|
||||
raise FileNotFoundError(f"Invalid ckpt_name: {ckpt_name}")
|
||||
|
||||
ckpt_path = folder_paths.get_full_path("checkpoints", ckpt_name)
|
||||
if config_name != "none":
|
||||
config_path = folder_paths.get_full_path("configs", config_name)
|
||||
@@ -912,6 +971,10 @@ class SDParameterGenerator:
|
||||
),
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def VALIDATE_INPUTS(s, aspect_ratio):
|
||||
return True
|
||||
|
||||
|
||||
class SDPromptMerger:
|
||||
@classmethod
|
||||
@@ -981,6 +1044,30 @@ class SDTypeConverter:
|
||||
)
|
||||
|
||||
|
||||
class SDAnyConverter:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
"required": {},
|
||||
"optional": {
|
||||
"any_type_input": (
|
||||
any_type,
|
||||
{"forceInput": True},
|
||||
),
|
||||
},
|
||||
}
|
||||
|
||||
RETURN_TYPES = (any_type,)
|
||||
|
||||
RETURN_NAMES = ("ANY_TYPE_OUTPUT",)
|
||||
|
||||
FUNCTION = "convert_any"
|
||||
CATEGORY = "SD Prompt Reader"
|
||||
|
||||
def convert_any(self, any_type_input: str = ""):
|
||||
return (any_type_input,)
|
||||
|
||||
|
||||
class SDBatchLoader:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
@@ -1135,17 +1222,20 @@ class SDParameterExtractor:
|
||||
|
||||
@staticmethod
|
||||
def parse_setting(settings):
|
||||
pattern = re.compile(r"([^:,]+):\s*\(([^)]+)\)|([^:,]+):\s*([^,]+)")
|
||||
pattern = re.compile(r"([^:,]+):\s*\(([^)]+)\)|([^:,]+):\s*\"([^\"]+)\"|([^:,]+):\s*([^,]+)")
|
||||
|
||||
matches = pattern.findall(settings)
|
||||
|
||||
result = {}
|
||||
for match in matches:
|
||||
key, value_paren, key_nonparen, value_nonparen = match
|
||||
if key:
|
||||
key = key.strip()
|
||||
key_paren, value_paren, key_quotes, value_quotes, key_nonparen, value_nonparen = match
|
||||
if key_paren:
|
||||
key = key_paren.strip()
|
||||
value = value_paren.strip()
|
||||
value = tuple(v.strip() for v in value.split(","))
|
||||
elif key_quotes:
|
||||
key = key_quotes.strip()
|
||||
value = value_quotes.strip()
|
||||
else:
|
||||
key = key_nonparen.strip()
|
||||
value = value_nonparen.strip()
|
||||
@@ -1153,6 +1243,10 @@ class SDParameterExtractor:
|
||||
|
||||
return result
|
||||
|
||||
@classmethod
|
||||
def VALIDATE_INPUTS(s, parameter):
|
||||
return True
|
||||
|
||||
|
||||
class SDLoraLoader:
|
||||
def __init__(self):
|
||||
@@ -1243,6 +1337,7 @@ NODE_CLASS_MAPPINGS = {
|
||||
"SDParameterGenerator": SDParameterGenerator,
|
||||
"SDPromptMerger": SDPromptMerger,
|
||||
"SDTypeConverter": SDTypeConverter,
|
||||
"SDAnyConverter": SDAnyConverter,
|
||||
"SDBatchLoader": SDBatchLoader,
|
||||
"SDParameterExtractor": SDParameterExtractor,
|
||||
"SDLoraLoader": SDLoraLoader,
|
||||
@@ -1255,6 +1350,7 @@ NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"SDParameterGenerator": "SD Parameter Generator",
|
||||
"SDPromptMerger": "SD Prompt Merger",
|
||||
"SDTypeConverter": "SD Type Converter",
|
||||
"SDAnyConverter": "SD Any Converter",
|
||||
"SDBatchLoader": "SD Batch Loader",
|
||||
"SDParameterExtractor": "SD Parameter Extractor",
|
||||
"SDLoraLoader": "SD Lora Loader",
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
[project]
|
||||
name = "comfyui-prompt-reader-node"
|
||||
description = "The ultimate solution for managing image metadata and multi-tool compatibility. ComfyUI node version of the SD Prompt Reader."
|
||||
version = "1.3.4"
|
||||
license = { text = "MIT License" }
|
||||
dependencies = ["piexif"]
|
||||
|
||||
[project.urls]
|
||||
Repository = "https://github.com/receyuki/comfyui-prompt-reader-node"
|
||||
# Used by Comfy Registry https://comfyregistry.org
|
||||
|
||||
[tool.comfy]
|
||||
PublisherId = "receyuki"
|
||||
DisplayName = "comfyui-prompt-reader-node"
|
||||
Icon = "https://raw.githubusercontent.com/receyuki/comfyui-prompt-reader-node/main/images/icon-400.png"
|
||||
Submodule stable_diffusion_prompt_reader updated: cc3c8b2b3d...1a499becb0
Reference in New Issue
Block a user