""" Test Workflow 1 (No LoRAs). Schema is defined in basic_test1.yaml (auto-generated from WorkflowParams). """ from comfy_script.runtime import * load('http://127.0.0.1:8188/') from comfy_script.runtime.nodes import * from pydantic import BaseModel, Field from typing import List import sys import os sys.path.insert(0, os.path.dirname(os.path.dirname(__file__))) from base import BaseWorkflow from parameters import ( Prompt, NegativePrompt, Checkpoint, Seed, Sampler, Scheduler, Width, Height ) # ============================================ # Workflow Metadata # ============================================ WORKFLOW_METADATA = { "name": "Test Workflow 1 (No LoRAs)", "description": "Test workflow without LoRA support.", "model_types": ["SDXL"], "category": "Testing", } # ============================================ # Workflow Parameters Model # ============================================ class WorkflowParams(BaseModel): """Parameters for test workflow without LoRAs.""" prompt: Prompt negativePrompt: NegativePrompt = "text, watermark" checkpoints: Checkpoint sampler: Sampler = "euler" scheduler: Scheduler = "normal" seed: Seed width: Width = 1024 height: Height = 1024 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}) # Workflow definition class TestWorkflow1(BaseWorkflow): def run(self): params: WorkflowParams = self.params with Workflow(wait=False): model, clip, vae = self.load_checkpoints() conditioning = CLIPTextEncode(params.prompt, clip) conditioning2 = CLIPTextEncode(params.negativePrompt, clip) latent = EmptyLatentImage(params.width, params.height, 1) latent = KSampler(model, params.seed, params.steps, params.cfg, params.sampler, params.scheduler, conditioning, conditioning2, latent, 1) image = VAEDecode(latent, vae) preview = PreviewImage(image) return { 'prompt_id': preview.task.prompt_id, 'status': 'queued', 'parameters': self.params.model_dump() } # Module-level entry point def run_workflow(**kwargs): """Entry point for the workflow.""" required = ['prompt', 'checkpoints', 'seed', 'steps', 'negativePrompt', 'width', 'height', 'cfg'] missing = [f for f in required if f not in kwargs] if missing: raise ValueError(f"Missing required fields: {', '.join(missing)}") params = WorkflowParams(**kwargs) # Create and run workflow workflow = TestWorkflow1(params) return workflow.run()