mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-02-02 09:40:19 +08:00
Add search aliases to model-related and miscellaneous nodes: - Model nodes: nodes_model_merging.py, nodes_model_advanced.py, nodes_lora_extract.py - Sampler nodes: nodes_custom_sampler.py, nodes_align_your_steps.py - Control nodes: nodes_controlnet.py, nodes_attention_multiply.py, nodes_hooks.py - Training nodes: nodes_train.py, nodes_dataset.py - Utility nodes: nodes_logic.py, nodes_canny.py, nodes_differential_diffusion.py - Architecture-specific: nodes_sd3.py, nodes_pixart.py, nodes_lumina2.py, nodes_kandinsky5.py, nodes_hidream.py, nodes_fresca.py, nodes_hunyuan3d.py - Media nodes: nodes_load_3d.py, nodes_webcam.py, nodes_preview_any.py, nodes_wanmove.py Uses search_aliases parameter in io.Schema() for v3 nodes, SEARCH_ALIASES class attribute for legacy nodes.
45 lines
1.2 KiB
Python
45 lines
1.2 KiB
Python
import json
|
|
from comfy.comfy_types.node_typing import IO
|
|
|
|
# Preview Any - original implement from
|
|
# https://github.com/rgthree/rgthree-comfy/blob/main/py/display_any.py
|
|
# upstream requested in https://github.com/Kosinkadink/rfcs/blob/main/rfcs/0000-corenodes.md#preview-nodes
|
|
class PreviewAny():
|
|
@classmethod
|
|
def INPUT_TYPES(cls):
|
|
return {
|
|
"required": {"source": (IO.ANY, {})},
|
|
}
|
|
|
|
RETURN_TYPES = ()
|
|
FUNCTION = "main"
|
|
OUTPUT_NODE = True
|
|
|
|
CATEGORY = "utils"
|
|
SEARCH_ALIASES = ["show output", "inspect", "debug", "print value", "show text"]
|
|
|
|
def main(self, source=None):
|
|
value = 'None'
|
|
if isinstance(source, str):
|
|
value = source
|
|
elif isinstance(source, (int, float, bool)):
|
|
value = str(source)
|
|
elif source is not None:
|
|
try:
|
|
value = json.dumps(source, indent=4)
|
|
except Exception:
|
|
try:
|
|
value = str(source)
|
|
except Exception:
|
|
value = 'source exists, but could not be serialized.'
|
|
|
|
return {"ui": {"text": (value,)}}
|
|
|
|
NODE_CLASS_MAPPINGS = {
|
|
"PreviewAny": PreviewAny,
|
|
}
|
|
|
|
NODE_DISPLAY_NAME_MAPPINGS = {
|
|
"PreviewAny": "Preview as Text",
|
|
}
|