updated project name, fixed test workflows

This commit is contained in:
donny committed 2026-01-05 19:23:04 -07:00
1 parent 9da275d051
commit 7792f228b1
4 files changed
+61 -34

No files matched your search

+15 -9
View File
@@ -1,17 +1,23 @@
""" """
Entry point for running external-api as a module. Entry point for running Imagelab_Studio_Extension as a module.
Usage: Usage:
python -m external-api generate --all python -m Imagelab_Studio_Extension generate --all
python -m external-api generate basic_sdxl python -m Imagelab_Studio_Extension generate basic_sdxl
python -m external-api generate basic_sdxl --dry-run python -m Imagelab_Studio_Extension generate basic_sdxl --dry-run
python -m external-api validate --all python -m Imagelab_Studio_Extension validate --all
python -m external-api validate basic_sdxl python -m Imagelab_Studio_Extension validate basic_sdxl
python -m external-api list python -m Imagelab_Studio_Extension list
python -m external-api watch # requires: pip install watchdog python -m Imagelab_Studio_Extension watch # requires: pip install watchdog
""" """
import sys import sys
from .cli import main import os
# Add this directory to path so we can import cli directly
# This avoids loading __init__.py which requires ComfyUI's server module
sys.path.insert(0, os.path.dirname(__file__))
from cli import main
if __name__ == "__main__": if __name__ == "__main__":
sys.exit(main()) sys.exit(main())
+4 -5
View File
@@ -15,7 +15,7 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
from base import BaseWorkflow from base import BaseWorkflow
from parameters import ( from parameters import (
Prompt, NegativePrompt, Checkpoint, Seed, Sampler, Scheduler, Prompt, NegativePrompt, Checkpoint, Seed, Sampler, Scheduler,
Width, Height Dimensions
) )
# ============================================ # ============================================
@@ -41,8 +41,7 @@ class WorkflowParams(BaseModel):
sampler: Sampler = "euler" sampler: Sampler = "euler"
scheduler: Scheduler = "normal" scheduler: Scheduler = "normal"
seed: Seed seed: Seed
width: Width = 1024 dimensions: Dimensions
height: Height = 1024
steps: int = Field(default=20, ge=1, le=150) steps: int = Field(default=20, ge=1, le=150)
cfg: float = Field(default=8.0, ge=1.0, le=20.0, json_schema_extra={"step": 0.5}) cfg: float = Field(default=8.0, ge=1.0, le=20.0, json_schema_extra={"step": 0.5})
@@ -56,7 +55,7 @@ class TestWorkflow1(BaseWorkflow):
conditioning = CLIPTextEncode(params.prompt, clip) conditioning = CLIPTextEncode(params.prompt, clip)
conditioning2 = CLIPTextEncode(params.negativePrompt, clip) conditioning2 = CLIPTextEncode(params.negativePrompt, clip)
latent = EmptyLatentImage(params.width, params.height, 1) latent = EmptyLatentImage(params.dimensions.width, params.dimensions.height, 1)
latent = KSampler(model, params.seed, params.steps, params.cfg, params.sampler, params.scheduler, conditioning, conditioning2, latent, 1) latent = KSampler(model, params.seed, params.steps, params.cfg, params.sampler, params.scheduler, conditioning, conditioning2, latent, 1)
@@ -72,7 +71,7 @@ class TestWorkflow1(BaseWorkflow):
# Module-level entry point # Module-level entry point
def run_workflow(**kwargs): def run_workflow(**kwargs):
"""Entry point for the workflow.""" """Entry point for the workflow."""
required = ['prompt', 'checkpoints', 'seed', 'steps', 'negativePrompt', 'width', 'height', 'cfg'] required = ['prompt', 'checkpoints', 'seed', 'steps', 'negativePrompt', 'dimensions', 'cfg']
missing = [f for f in required if f not in kwargs] missing = [f for f in required if f not in kwargs]
if missing: if missing:
raise ValueError(f"Missing required fields: {', '.join(missing)}") raise ValueError(f"Missing required fields: {', '.join(missing)}")
+5 -6
View File
@@ -14,7 +14,7 @@ import os
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__))) sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
from base import BaseWorkflow from base import BaseWorkflow
from parameters import ( from parameters import (
Prompt, NegativePrompt, Checkpoint, Seed, Width, Height, Lora Prompt, NegativePrompt, Checkpoint, Seed, Dimensions, Loras
) )
# ============================================ # ============================================
@@ -37,10 +37,9 @@ class WorkflowParams(BaseModel):
prompt: Prompt prompt: Prompt
negativePrompt: NegativePrompt = "text, watermark" negativePrompt: NegativePrompt = "text, watermark"
checkpoints: Checkpoint checkpoints: Checkpoint
loras: List[Lora] = [] loras: Loras
seed: Seed seed: Seed
width: Width = 1024 dimensions: Dimensions
height: Height = 1024
steps: int = Field(default=20, ge=1, le=150) steps: int = Field(default=20, ge=1, le=150)
cfg: float = Field(default=8.0, ge=1.0, le=20.0, json_schema_extra={"step": 0.5}) cfg: float = Field(default=8.0, ge=1.0, le=20.0, json_schema_extra={"step": 0.5})
@@ -55,7 +54,7 @@ class TestWorkflow2(BaseWorkflow):
conditioning = CLIPTextEncode(params.prompt, clip) conditioning = CLIPTextEncode(params.prompt, clip)
conditioning2 = CLIPTextEncode(params.negativePrompt, clip) conditioning2 = CLIPTextEncode(params.negativePrompt, clip)
latent = EmptyLatentImage(params.width, params.height, 1) latent = EmptyLatentImage(params.dimensions.width, params.dimensions.height, 1)
# Hardcoded sampler/scheduler # Hardcoded sampler/scheduler
latent = KSampler(model, params.seed, params.steps, params.cfg, 'euler', 'normal', conditioning, conditioning2, latent, 1) latent = KSampler(model, params.seed, params.steps, params.cfg, 'euler', 'normal', conditioning, conditioning2, latent, 1)
@@ -72,7 +71,7 @@ class TestWorkflow2(BaseWorkflow):
# Module-level entry point # Module-level entry point
def run_workflow(**kwargs): def run_workflow(**kwargs):
"""Entry point for the workflow.""" """Entry point for the workflow."""
required = ['prompt', 'checkpoints', 'seed', 'steps', 'negativePrompt', 'width', 'height', 'cfg'] required = ['prompt', 'checkpoints', 'seed', 'steps', 'negativePrompt', 'dimensions', 'cfg']
missing = [f for f in required if f not in kwargs] missing = [f for f in required if f not in kwargs]
if missing: if missing:
raise ValueError(f"Missing required fields: {', '.join(missing)}") raise ValueError(f"Missing required fields: {', '.join(missing)}")
+37 -14
View File
@@ -1,28 +1,51 @@
"""
Test Workflow.
Schema is defined in test.yaml (auto-generated from WorkflowParams).
"""
from comfy_script.runtime import * from comfy_script.runtime import *
load('http://127.0.0.1:8188/') load('http://127.0.0.1:8188/')
from comfy_script.runtime.nodes import * from comfy_script.runtime.nodes import *
from pydantic import BaseModel from pydantic import BaseModel, Field
from typing import List from typing import List
import sys import sys
import os import os
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__))) sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
from base import BaseWorkflow from base import BaseWorkflow
from parameters import Lora from parameters import (
Prompt, NegativePrompt, Checkpoint, Seed, Loras, Dimensions, DimensionsParams
)
# ============================================
# Workflow Metadata
# ============================================
WORKFLOW_METADATA = {
"name": "Test Workflow",
"description": "Basic test workflow for development.",
"model_types": ["SDXL"],
"category": "Testing",
}
# ============================================
# Workflow Parameters Model
# ============================================
# Workflow-specific parameters
class WorkflowParams(BaseModel): class WorkflowParams(BaseModel):
prompt: str """Parameters for test workflow."""
negativePrompt: str = "text, watermark" prompt: Prompt
checkpoints: List[str] negativePrompt: NegativePrompt = "text, watermark"
loras: List[Lora] = [] checkpoints: Checkpoint
steps: int = 20 loras: Loras
seed: int = None seed: Seed
width: int = 512 dimensions: Dimensions = DimensionsParams(width=512, height=512)
height: int = 512 steps: int = Field(default=20, ge=1, le=150)
# ============================================
# Workflow Definition
# ============================================
# Workflow definition
class TestWorkflow(BaseWorkflow): class TestWorkflow(BaseWorkflow):
def run(self): def run(self):
params: WorkflowParams = self.params params: WorkflowParams = self.params
@@ -33,7 +56,7 @@ class TestWorkflow(BaseWorkflow):
conditioning = CLIPTextEncode(params.prompt, clip) conditioning = CLIPTextEncode(params.prompt, clip)
conditioning2 = CLIPTextEncode(params.negativePrompt, clip) conditioning2 = CLIPTextEncode(params.negativePrompt, clip)
latent = EmptyLatentImage(params.width, params.height, 1) latent = EmptyLatentImage(params.dimensions.width, params.dimensions.height, 1)
seed = params.seed seed = params.seed
steps = params.steps steps = params.steps
latent = KSampler(model, seed, steps, 8, 'euler', 'normal', conditioning, conditioning2, latent, 1) latent = KSampler(model, seed, steps, 8, 'euler', 'normal', conditioning, conditioning2, latent, 1)
@@ -49,7 +72,7 @@ class TestWorkflow(BaseWorkflow):
# Module-level entry point # Module-level entry point
def run_workflow(**kwargs): def run_workflow(**kwargs):
"""Entry point for the workflow.""" """Entry point for the workflow."""
required = ['prompt', 'checkpoints', 'seed', 'steps', 'negativePrompt', 'width', 'height'] required = ['prompt', 'checkpoints', 'seed', 'steps', 'negativePrompt', 'dimensions']
missing = [f for f in required if f not in kwargs] missing = [f for f in required if f not in kwargs]
if missing: if missing:
raise ValueError(f"Missing required fields: {', '.join(missing)}") raise ValueError(f"Missing required fields: {', '.join(missing)}")