mirror of
https://github.com/rookiestar28/ComfyUI-OpenClaw.git
synced 2026-08-14 00:48:07 +00:00
refactor(nodes): align node categories with canonical naming
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import json
|
||||
import logging
|
||||
import random
|
||||
from typing import Any, Dict, List, Tuple
|
||||
|
||||
try:
|
||||
@@ -55,7 +56,7 @@ class OpenClawBatchVariants:
|
||||
OUTPUT_IS_LIST = (True, True, True)
|
||||
|
||||
FUNCTION = "generate_variants"
|
||||
CATEGORY = "moltbot"
|
||||
CATEGORY = "openclaw"
|
||||
|
||||
def generate_variants(
|
||||
self,
|
||||
@@ -95,8 +96,6 @@ class OpenClawBatchVariants:
|
||||
# Let's stick to simple increment for now or random python if implied?
|
||||
# "randomized" usually means unpredictable.
|
||||
# Let's implement a simple hash for now to be deterministic but "jumpy"
|
||||
import random
|
||||
|
||||
r = random.Random(seed_base + i)
|
||||
current_seed = r.randint(0, 0xFFFFFFFFFFFFFFFF)
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ class OpenClawImageToPrompt:
|
||||
RETURN_TYPES = ("STRING", "STRING", "STRING")
|
||||
RETURN_NAMES = ("caption", "tags", "prompt_suggestion")
|
||||
FUNCTION = "generate_prompt"
|
||||
CATEGORY = "moltbot"
|
||||
CATEGORY = "openclaw"
|
||||
|
||||
# R154: keep the compatibility method name, but bind the shared helper
|
||||
# directly so node wrappers do not duplicate image conversion logic.
|
||||
|
||||
@@ -59,7 +59,7 @@ class OpenClawPromptPlanner:
|
||||
RETURN_TYPES = ("STRING", "STRING", "STRING")
|
||||
RETURN_NAMES = ("positive", "negative", "params_json")
|
||||
FUNCTION = "plan_generation"
|
||||
CATEGORY = "moltbot"
|
||||
CATEGORY = "openclaw"
|
||||
|
||||
def plan_generation(
|
||||
self, profile: str, requirements: str, style_directives: str, seed: int
|
||||
|
||||
@@ -75,7 +75,7 @@ class OpenClawPromptRefiner:
|
||||
"rationale",
|
||||
)
|
||||
FUNCTION = "refine_prompt"
|
||||
CATEGORY = "moltbot"
|
||||
CATEGORY = "openclaw"
|
||||
|
||||
# R154: keep the compatibility method name, but bind the shared helper
|
||||
# directly so node wrappers do not duplicate image conversion logic.
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import ast
|
||||
import inspect
|
||||
import os
|
||||
import sys
|
||||
import textwrap
|
||||
import unittest
|
||||
|
||||
sys.path.append(os.getcwd())
|
||||
@@ -17,6 +20,29 @@ class TestNodeClassAliases(unittest.TestCase):
|
||||
self.assertIs(MoltbotImageToPrompt, OpenClawImageToPrompt)
|
||||
self.assertIs(MoltbotPromptRefiner, OpenClawPromptRefiner)
|
||||
|
||||
def test_current_node_categories_use_openclaw_baseline(self):
|
||||
node_classes = (
|
||||
OpenClawPromptPlanner,
|
||||
OpenClawBatchVariants,
|
||||
OpenClawImageToPrompt,
|
||||
OpenClawPromptRefiner,
|
||||
)
|
||||
|
||||
for node_class in node_classes:
|
||||
with self.subTest(node_class=node_class.__name__):
|
||||
self.assertEqual(node_class.CATEGORY, "openclaw")
|
||||
|
||||
def test_batch_variants_execution_path_has_no_local_imports(self):
|
||||
source = inspect.getsource(OpenClawBatchVariants.generate_variants)
|
||||
tree = ast.parse(textwrap.dedent(source))
|
||||
|
||||
local_imports = [
|
||||
node
|
||||
for node in ast.walk(tree)
|
||||
if isinstance(node, (ast.Import, ast.ImportFrom))
|
||||
]
|
||||
self.assertEqual(local_imports, [])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user