(args: argparse.Namespace)
| 657 | |
| 658 | |
| 659 | def cmd_generate_from_workflow(args: argparse.Namespace) -> int: |
| 660 | comfy = _run_comfy_workflow(args) |
| 661 | host = str(comfy["comfy_url"]) |
| 662 | prompt_id = str(comfy["prompt_id"]) |
| 663 | history = comfy["history"] if isinstance(comfy.get("history"), dict) else {} |
| 664 | asset_ref = _find_comfy_file_ref(history, WORKFLOW_ASSET_SUFFIXES) |
| 665 | if asset_ref: |
| 666 | if not args.output: |
| 667 | raise ModlyCliError("--output is required when a workflow produces a direct 3D asset", code="OUTPUT_REQUIRED") |
| 668 | export_dest = Path(args.output).expanduser().resolve() |
| 669 | bytes_written = _download_comfy_ref(host, asset_ref, export_dest, timeout=args.request_timeout) |
| 670 | _json_print({ |
| 671 | "ok": True, |
| 672 | "source": "comfy-workflow", |
| 673 | "output_type": "asset", |
| 674 | "export_path": str(export_dest), |
| 675 | "bytes_written": bytes_written, |
| 676 | "workflow": comfy["workflow"], |
| 677 | "prompt_id": prompt_id, |
| 678 | "comfy_url": host, |
| 679 | "asset": asset_ref, |
| 680 | "meta": {"experimental": True, "canonical": False}, |
| 681 | }, compact=args.compact) |
| 682 | return 0 |
| 683 | |
| 684 | comfy_image = _download_comfy_image_output(args, comfy) |
| 685 | _require_health(args.base_url.rstrip("/"), args.request_timeout) |
| 686 | output = Path(args.output).expanduser().resolve() if args.output else None |
| 687 | result = _generate_one(args, Path(str(comfy_image["image_path"])), output) |
| 688 | result["source"] = "comfy-workflow" |
| 689 | result["output_type"] = "image" |
| 690 | result["comfy"] = comfy_image |
| 691 | result.setdefault("meta", {})["experimental"] = True |
| 692 | _json_print(result, compact=args.compact) |
| 693 | return 0 |
| 694 | |
| 695 | |
| 696 | def _canonical_generation_params(args: argparse.Namespace) -> dict[str, Any]: |
nothing calls this directly
no test coverage detected