Some checks failed
Python Linting / Run Ruff (push) Has been cancelled
Python Linting / Run Pylint (push) Has been cancelled
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.10, [self-hosted Linux], stable) (push) Has been cancelled
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.11, [self-hosted Linux], stable) (push) Has been cancelled
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.12, [self-hosted Linux], stable) (push) Has been cancelled
Full Comfy CI Workflow Runs / test-unix-nightly (12.1, , linux, 3.11, [self-hosted Linux], nightly) (push) Has been cancelled
Execution Tests / test (macos-latest) (push) Has been cancelled
Execution Tests / test (ubuntu-latest) (push) Has been cancelled
Execution Tests / test (windows-latest) (push) Has been cancelled
Test server launches without errors / test (push) Has been cancelled
Unit Tests / test (macos-latest) (push) Has been cancelled
Unit Tests / test (ubuntu-latest) (push) Has been cancelled
Unit Tests / test (windows-2022) (push) Has been cancelled
Includes 30 custom nodes committed directly, 7 Civitai-exclusive loras stored via Git LFS, and a setup script that installs all dependencies and downloads HuggingFace-hosted models on vast.ai. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
124 lines
3.5 KiB
Python
124 lines
3.5 KiB
Python
import json
|
|
from ..core import CONFIG, CATEGORY, BOOLEAN, BOOLEAN_FALSE, KEYS, TEXTS, STRING, logger, any
|
|
|
|
class CConsoleAny:
|
|
def __init__(self):
|
|
pass
|
|
|
|
@classmethod
|
|
def INPUT_TYPES(cls):
|
|
return {
|
|
"required": {
|
|
},
|
|
"optional": {
|
|
"any_value": (any,),
|
|
"console": BOOLEAN_FALSE,
|
|
"display": BOOLEAN,
|
|
KEYS.PREFIX.value: STRING,
|
|
},
|
|
"hidden": {
|
|
# "unique_id": "UNIQUE_ID",
|
|
# "extra_pnginfo": "EXTRA_PNGINFO",
|
|
},
|
|
}
|
|
|
|
CATEGORY = CATEGORY.MAIN.value + CATEGORY.DEBUGGER.value
|
|
INPUT_IS_LIST = True
|
|
|
|
RETURN_TYPES = ()
|
|
OUTPUT_NODE = True
|
|
|
|
FUNCTION = "execute"
|
|
|
|
def execute(self, any_value=None, console=False, display=True, prefix=None):
|
|
console = console[0]
|
|
display = display[0]
|
|
prefix = prefix[0]
|
|
text = ""
|
|
textToDisplay = TEXTS.INACTIVE_MSG.value
|
|
|
|
if any_value is not None:
|
|
try:
|
|
if type(any_value) == list:
|
|
for item in any_value:
|
|
try:
|
|
text += str(item)
|
|
except Exception as e:
|
|
text += "source exists, but could not be serialized.\n"
|
|
logger.warn(e)
|
|
else:
|
|
logger.warn("any_value is not a list")
|
|
|
|
except Exception:
|
|
try:
|
|
text = json.dumps(any_value)[1:-1]
|
|
except Exception:
|
|
text = 'source exists, but could not be serialized.'
|
|
|
|
logger.debug(f"Show any to console is running...")
|
|
|
|
if console:
|
|
if prefix is not None and prefix != "":
|
|
print(f"{prefix}: {text}")
|
|
else:
|
|
print(text)
|
|
|
|
if display:
|
|
textToDisplay = text
|
|
|
|
value = [console, display, prefix, textToDisplay]
|
|
# setWidgetValues(value, unique_id, extra_pnginfo)
|
|
|
|
return {"ui": {"text": value}}
|
|
|
|
|
|
class CConsoleAnyToJson:
|
|
def __init__(self):
|
|
pass
|
|
|
|
@classmethod
|
|
def INPUT_TYPES(cls):
|
|
return {
|
|
"required": {
|
|
},
|
|
"optional": {
|
|
"any_value": (any,),
|
|
},
|
|
}
|
|
|
|
CATEGORY = CATEGORY.MAIN.value + CATEGORY.DEBUGGER.value
|
|
INPUT_IS_LIST = True
|
|
|
|
RETURN_TYPES = ("STRING",)
|
|
RETURN_NAMES = ("string",)
|
|
OUTPUT_NODE = True
|
|
|
|
FUNCTION = "execute"
|
|
|
|
def execute(self, any_value=None):
|
|
text = TEXTS.INACTIVE_MSG.value
|
|
|
|
if any_value is not None and isinstance(any_value, list):
|
|
item = any_value[0]
|
|
|
|
if isinstance(item, dict):
|
|
try:
|
|
text = json.dumps(item, indent=CONFIG["indent"])
|
|
except Exception as e:
|
|
text = "The input is a dict, but could not be serialized.\n"
|
|
logger.warn(e)
|
|
|
|
elif isinstance(item, list):
|
|
try:
|
|
text = json.dumps(item, indent=CONFIG["indent"])
|
|
except Exception as e:
|
|
text = "The input is a list, but could not be serialized.\n"
|
|
logger.warn(e)
|
|
|
|
else:
|
|
text = str(item)
|
|
|
|
logger.debug(f"Show any-json to console is running...")
|
|
|
|
return {"ui": {"text": [text]}, "result": (text,)}
|