ComfyUI Node

TK 服装抽卡

An outfit gacha that reads the clothing library in your browser

By Ararararararaki·Created 3 months ago·Updated about 16 hours ago· 10
TK 服装抽卡
    • 服装提示词
    • 服装名称
    • 服装分类
    • 服装数据
    mode随机抽取
    seed0

    Outfit prompts are where a lot of runs die. You want a specific look, you get school uniform and the model does its own thing, and the fix is usually a longer, more specific clothing tag string - which is exactly the kind of string nobody enjoys retyping.

    TK 服装抽卡 ("clothing gacha") turns that into a draw. You keep a library of outfit cards in TK Toolkit's panel, and the node randomly picks one per run - or lets you choose from a thumbnail grid. It's part of TK Toolkit (anima-toolkit by 时运tk).

    What the library is

    The clothing library lives in the browser, in an IndexedDB database the panel writes (clothing-db). Each card is an outfit prompt plus a name, a category and an optional preview image - the panel groups them flat under things like 裙装, 泳装, 制服, 袜类, and lets you import, export, and randomly combine cards to build new ones. This is genuinely more useful than a text file, because the picture is what you actually choose by.

    The node reads that same database. Both halves run in your browser, which is convenient and the source of the only real gotcha, listed below.

    Inputs and outputs

    Two inputs:

    • mode - 随机抽取 (random draw, default) or 手动选择 (manual pick).
    • seed - your draw seed. Same seed plus the same pool gives the same card, so a lucky outfit is reproducible. Clicking the node's own 随机抽取 button rolls a new seed for you.

    In manual mode, the node's 选择服装 button opens a thumbnail grid - the same visual browsing you get in the LoRA loader - and whatever you click becomes the selection. If you queue in manual mode without choosing, you get a plain error telling you to pick a card, which is the right behaviour.

    Four outputs, all STRING:

    • 服装提示词 - the clothing tag string. This is the one you wire.
    • 服装名称 - the card's name. Useful as a save-prefix token, so a run folder tells you which outfit it was.
    • 服装分类 - its category.
    • 服装数据 - a structured string with the full card, for nodes that want more than the prompt.

    Wire 服装提示词 into a CLIP text encode, or into TK 文本合并 if it's one ingredient among lighting, camera and trigger words. The name and category are what you route into a filename; they're the difference between a folder of anonymous images and one you can sort later.

    What it deliberately doesn't do

    The preview image stays a preview. There's no IMAGE output, and images aren't embedded into the workflow. That's deliberate, and good: the pack worked to make the workflow snapshot store only the current draw and the metadata it needs, not the whole library or a pile of image blobs. If you want the picture downstream, produce it and pass that; don't expect the card's thumbnail on a wire.

    Renaming a card inside the node writes back to the toolkit, so your library and your node stay in sync in both directions.

    Install

    cd ComfyUI/custom_nodes
    git clone https://github.com/Ararararararaki/comfyui-anima-toolkit
    # restart ComfyUI
    

    ComfyUI Manager: search TK Toolkit (anima-toolkit). Required packages: aiohttp, requests. The node registers under TK/prompt, and it patches into the same browser storage the panel uses, so there's nothing extra to install.

    Where people get burned

    Same origin or nothing. The node and the panel share a browser database, so they must be open in the same browser, on the same host and port. localhost:8188 and 127.0.0.1:8188 are separate origins as far as IndexedDB is concerned - switch between them and your clothing library appears empty. Pick one and stay on it.

    Refresh the library after editing it. Add or change cards in the panel and the node's cached view is stale until you hit 刷新库 on the node. This one wastes an embarrassing amount of time before you notice.

    Random draws on a headless queue. A draw resolves against the snapshot the node UI put into the workflow. Queue the same graph from a script or API with a different seed and the node is careful not to hand you a stale card for the new seed - which means you can get an error rather than a result. Random outfit gacha is a UI-driven feature; if you're automating, set mode to a fixed selection.

    Empty library, empty prompt. Nothing in the library means nothing to draw. Import or build cards first - the panel's AI 抽卡 feature is a decent way to bootstrap a set of outfit strings without writing them by hand.

    CategoryTK/prompt

    Inputs (2)

    NameTypeDefaultDescription
    modeCOMBO随机抽取2 options: 随机抽取, 手动选择
    seedINT00–9223372036854776000随机抽取使用的稳定种子;点击节点中的「随机抽取」会自动更换种子。

    Outputs (4)

    NameTypeDescription
    服装提示词STRING
    服装名称STRING
    服装分类STRING
    服装数据STRING