Files
da2el-ai-D2-PromptSelector-…/__init__.py
T
da2el-alandClaude Opus 4.8 203465d780 feat: add D2 Prompt Selector node for token replacement
Add a V3-schema node that expands registered-prompt tokens
(--file/category/name--, @@category@@, and short forms) into the
actual prompts, so prompts can be composed inside a workflow rather
than only via the UI panel. delete_unmatch and the two delimiters
are exposed as inputs.

Switch __init__.py to comfy_entrypoint registration: the custom-node
loader uses NODE_CLASS_MAPPINGS when that attribute exists and skips
comfy_entrypoint (elif branch), so the empty mapping was removed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 19:23:34 +09:00

47 lines
1.2 KiB
Python

"""
@author: da2el
@title: D2 Prompt Selector
@description:
"""
from pathlib import Path
import os
import server
from server import PromptServer
from aiohttp import web
from .nodes import tags
from .nodes.utils import copy_if_empty
from .nodes.nodes import comfy_entrypoint
WEB_DIRECTORY = "./web"
# ノードは V3 スキーマ(comfy_entrypoint / ComfyExtension)で登録する。
# ComfyUI のローダーは NODE_CLASS_MAPPINGS 属性があるとそちらを優先し
# comfy_entrypoint を無視する(nodes.py の load 分岐は elif)ため、
# NODE_CLASS_MAPPINGS はあえて定義しない。
__all__ = ["WEB_DIRECTORY", "comfy_entrypoint"]
"""
# css読み取り用のパスを設定
"""
d2_ps_path = os.path.join(os.path.dirname(__file__))
d2_web_path = os.path.join(d2_ps_path, "web")
if os.path.exists(d2_web_path):
server.PromptServer.instance.app.add_routes([
web.static("/D2_prompt-selector/assets/", d2_web_path)
])
# タグファイルがなかったらサンプルをコピーする
# ファイルがあったら何もしない
current_dir = Path(__file__).parent
src = current_dir / 'tags_sample'
dist = current_dir / 'tags'
copy_if_empty(src, dist)