mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-03-29 21:13:33 +08:00
Merge bdf444df06 into fc1fdf3389
This commit is contained in:
commit
87d229059c
@ -15,6 +15,7 @@ from comfy_execution.progress import get_progress_state, PreviewImageTuple
|
|||||||
from PIL import Image
|
from PIL import Image
|
||||||
from comfy.cli_args import args
|
from comfy.cli_args import args
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
class ComfyAPI_latest(ComfyAPIBase):
|
class ComfyAPI_latest(ComfyAPIBase):
|
||||||
@ -25,6 +26,7 @@ class ComfyAPI_latest(ComfyAPIBase):
|
|||||||
super().__init__()
|
super().__init__()
|
||||||
self.node_replacement = self.NodeReplacement()
|
self.node_replacement = self.NodeReplacement()
|
||||||
self.execution = self.Execution()
|
self.execution = self.Execution()
|
||||||
|
self.environment = self.Environment()
|
||||||
self.caching = self.Caching()
|
self.caching = self.Caching()
|
||||||
|
|
||||||
class NodeReplacement(ProxiedSingleton):
|
class NodeReplacement(ProxiedSingleton):
|
||||||
@ -85,6 +87,27 @@ class ComfyAPI_latest(ComfyAPIBase):
|
|||||||
image=to_display,
|
image=to_display,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
class Environment(ProxiedSingleton):
|
||||||
|
"""
|
||||||
|
Query the current execution environment.
|
||||||
|
|
||||||
|
Managed deployments set the ``COMFY_EXECUTION_ENVIRONMENT`` env var
|
||||||
|
so custom nodes can adapt their behaviour at runtime.
|
||||||
|
|
||||||
|
Example::
|
||||||
|
|
||||||
|
from comfy_api.latest import api
|
||||||
|
|
||||||
|
env = api.environment.get() # "local" | "cloud" | "remote"
|
||||||
|
"""
|
||||||
|
|
||||||
|
_VALID = {"local", "cloud", "remote"}
|
||||||
|
|
||||||
|
async def get(self) -> str:
|
||||||
|
"""Return the execution environment: ``"local"``, ``"cloud"``, or ``"remote"``."""
|
||||||
|
value = os.environ.get("COMFY_EXECUTION_ENVIRONMENT", "local").lower().strip()
|
||||||
|
return value if value in self._VALID else "local"
|
||||||
|
|
||||||
class Caching(ProxiedSingleton):
|
class Caching(ProxiedSingleton):
|
||||||
"""
|
"""
|
||||||
External cache provider API for sharing cached node outputs
|
External cache provider API for sharing cached node outputs
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user