Files
ComfyUI_Skills_OpenClaw/scripts/shared/json_utils.py
科林_Cyril Pilgrim bc4097ac2d refactor(backend): support multi-server workflow isolation and registry mapping
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.
2026-03-08 17:40:03 +08:00

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")