Update prompt configuration and enhance Lora management functionality

- Expanded the prompt.json file with new configurations for KSampler, CheckpointLoaderSimple, and various CLIPTextEncode nodes.
- Introduced additional Lora management features, including a new Lora Stacker and improved trigger word handling.
- Enhanced the loras_widget.js to log the generated prompt when saving recipes directly, aiding in debugging and user feedback.
- Improved overall structure and organization of the prompt configurations for better maintainability.
This commit is contained in:
Will Miao
2025-03-21 16:35:52 +08:00
parent d4f300645d
commit 4bff17aa1a
27 changed files with 1990 additions and 1 deletions

68
py/workflow_params/cli.py Normal file
View File

@@ -0,0 +1,68 @@
#!/usr/bin/env python3
"""Command-line interface for testing the workflow parser"""
import argparse
import json
import sys
from pathlib import Path
import logging
from .workflow_parser import WorkflowParser
# Configure logging
logging.basicConfig(level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
logger = logging.getLogger(__name__)
def main():
"""Main entry point for the command-line interface"""
parser = argparse.ArgumentParser(description="Parse ComfyUI workflow JSON files")
parser.add_argument("input_file", type=str, help="Path to input workflow JSON file")
parser.add_argument("-o", "--output", type=str, help="Path to output JSON file (defaults to stdout)")
parser.add_argument("-v", "--verbose", action="store_true", help="Enable verbose output")
args = parser.parse_args()
# Set log level based on verbosity
if args.verbose:
logging.getLogger().setLevel(logging.DEBUG)
# Read input file
input_path = Path(args.input_file)
if not input_path.exists():
logger.error(f"Input file {input_path} does not exist")
return 1
try:
with open(input_path, 'r', encoding='utf-8') as f:
workflow_json = f.read()
except Exception as e:
logger.error(f"Failed to read input file: {e}")
return 1
# Parse workflow
try:
workflow_parser = WorkflowParser()
result = workflow_parser.parse_workflow(workflow_json)
except Exception as e:
logger.error(f"Failed to parse workflow: {e}")
return 1
# Output result
output_json = json.dumps(result, indent=4)
if args.output:
try:
with open(args.output, 'w', encoding='utf-8') as f:
f.write(output_json)
logger.info(f"Output written to {args.output}")
except Exception as e:
logger.error(f"Failed to write output file: {e}")
return 1
else:
print(output_json)
return 0
if __name__ == "__main__":
sys.exit(main())