Repository navigation
Expand file tree
/
Copy path__init__.py
More file actions
61 lines (51 loc) · 2.32 KB
/
Copy path__init__.py
File metadata and controls
61 lines (51 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import os
import sys
# Ensure lora-manager submodule is importable without collisions
current_dir = os.path.dirname(os.path.abspath(__file__))
lora_manager_path = os.path.join(current_dir, "lora-manager")
if lora_manager_path not in sys.path:
sys.path.insert(0, lora_manager_path)
from server import PromptServer
from aiohttp import web
from .py.nodes.checkpoint_cycler import CheckpointCyclerCU, get_metadata
from .py.nodes.lora_cycler import LoraCyclerCU, get_lora_metadata
from .py.nodes.tag_parser import TagParserCU # Brought over from the user's recent modifications
from .py.nodes.prompt_hasher import PromptHasherCU
from .py.nodes.prompt_selection import PromptSelectionCU
from .py.nodes.lora_stack_update import LoraStackUpdate
from .py.nodes.lora_stack_update_from_tags import LoraStackUpdateFromTagsCU
from .py.nodes.static_random_int import StaticRandomIntCU
from .py.nodes.checkpoint_list import CheckpointListCU
from .py.nodes.string_fallback import StringFallbackCU
from .py.nodes.csv_to_dict import CSVToDictCU
@PromptServer.instance.routes.get("/comfyui-ckpt-utils/cycler-metadata")
async def fetch_cycler_metadata(request):
try:
refresh = request.query.get("refresh") == "true"
data = await get_metadata(force_refresh=refresh)
return web.json_response(data)
except Exception as e:
return web.json_response({"error": str(e)}, status=500)
@PromptServer.instance.routes.get("/comfyui-ckpt-utils/lora-cycler-metadata")
async def fetch_lora_cycler_metadata(request):
try:
refresh = request.query.get("refresh") == "true"
data = await get_lora_metadata(force_refresh=refresh)
return web.json_response(data)
except Exception as e:
return web.json_response({"error": str(e)}, status=500)
NODE_CLASS_MAPPINGS = {
CheckpointCyclerCU.NAME: CheckpointCyclerCU,
LoraCyclerCU.NAME: LoraCyclerCU,
TagParserCU.NAME: TagParserCU,
PromptHasherCU.NAME: PromptHasherCU,
PromptSelectionCU.NAME: PromptSelectionCU,
LoraStackUpdate.NAME: LoraStackUpdate,
LoraStackUpdateFromTagsCU.NAME: LoraStackUpdateFromTagsCU,
StaticRandomIntCU.NAME: StaticRandomIntCU,
CheckpointListCU.NAME: CheckpointListCU,
StringFallbackCU.NAME: StringFallbackCU,
CSVToDictCU.NAME: CSVToDictCU
}
WEB_DIRECTORY = "./web"
__all__ = ["NODE_CLASS_MAPPINGS", "WEB_DIRECTORY"]