mirror of
https://github.com/HuangYuChuh/ComfyUI_Skills_OpenClaw.git
synced 2026-07-30 11:33:45 +00:00
Motivation: The backend previously assumed a single global ComfyUI server, making it impossible to switch between environments or add remote nodes. Implementation: Refactored UIStorageService and scripts to organize workflows into server-specific subdirectories. Introduced ServerModel and runtime configuration loader to handle multi-server routing.
19 lines
495 B
Python
19 lines
495 B
Python
from __future__ import annotations
|
|
|
|
import json
|
|
from pathlib import Path
|
|
from typing import Any
|
|
|
|
|
|
def load_json(path: str | Path) -> Any:
|
|
with Path(path).open("r", encoding="utf-8") as file:
|
|
return json.load(file)
|
|
|
|
|
|
def save_json(path: str | Path, data: Any) -> None:
|
|
target = Path(path)
|
|
target.parent.mkdir(parents=True, exist_ok=True)
|
|
with target.open("w", encoding="utf-8") as file:
|
|
json.dump(data, file, ensure_ascii=False, indent=2)
|
|
file.write("\n")
|