mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-21 21:22:11 -03:00
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:
68
py/workflow_params/cli.py
Normal file
68
py/workflow_params/cli.py
Normal 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())
|
||||
Reference in New Issue
Block a user