Nodes/XB_ToolBox/XB-llama - ๐ŸŽž๏ธ ๅˆ†้•œ่ฏๅค„็†ๅ™จ
ComfyUI Node

XB-llama - ๐ŸŽž๏ธ ๅˆ†้•œ่ฏๅค„็†ๅ™จ

Draw cards from your storyboard, one shot at a time

By wjluoxiaoยทCreated 5 months agoยทUpdated 6 days agoยท 302
XB-llama - ๐ŸŽž๏ธ ๅˆ†้•œ่ฏๅค„็†ๅ™จ
  • text_input
  • output_list
โ—„draw_modefalseโ–บ
โ—„draw_rangeๅ…จ้ƒจโ–บ

If you've ever run an LLM storyboard workflow you know the problem: the model hands you a single wall of text with a dozen shots in it, and you want to generate one of those shots without re-encoding the whole thing. XB_llamaStoryboardProcessor is the little slot machine in the middle of the XB-llama chain that splits that wall of text into cards and lets you draw from the deck.

It's part of the XB_ToolBox "XB-llama" family, which is a llama-cpp-python reimplementation of the ComfyUI-llama-cpp_vlm nodes with extra AMD/ROCm handling. The processor sits downstream of the storyboard writer - feed it the multi-line output where every shot starts with ๅˆ†้•œๅ›พ_01, ๅˆ†้•œๅ›พ_02, or Scene_1 - and it caches those lines, then hands you a single list you can wire into your text encoder.

How it works

The mechanism is simpler than the Chinese UI suggests. It regex-matches each line for a ๅˆ†้•œๅ›พ_\d+ or Scene_\d+ header and stashes the whole text in a class-level cache. Then it has two personalities:

  • draw_mode off (default): it's a pass-through. It strips blank lines and emits every line as a list item, so you get a clean per-shot list.
  • draw_mode on: this is the "ๆŠฝๅก" (draw/gacha) mode. It ignores new upstream input and serves from the cache instead, letting draw_range pick which shot to output - ๅ…จ้ƒจ for everything, or a single ๅˆ†้•œๅ›พ_01 through ๅˆ†้•œๅ›พ_16.

That cache trick is the whole point. Because the upstream LLM gets skipped in draw mode, you can generate shot 7 twelve times, tweaking the seed, without the language model ever running again. Wire the processor's output to your CLIP/text encoder (or straight into a video i2v node that takes a prompt), and each shot prompt becomes its own generation.

The inputs that matter

Only three, and only two of them will ever bite you:

  • draw_mode (BOOLEAN) - the off/on switch for gacha mode.
  • draw_range (enum: ๅ…จ้ƒจ + ๅˆ†้•œๅ›พ_01โ€ฆๅˆ†้•œๅ›พ_16) - which shot to draw.
  • text_input (optional, any type) - the storyboard text from upstream. Marked optional because the whole design assumes it can go dark while the cache serves.

Output is output_list, a list of STRINGs. In normal mode each line is one item; in draw mode it's the shot (or shots) you picked. If draw mode can't find the requested shot in the cache, it doesn't error - it emits a placeholder prompt that just renders a solid-color image with "ๆœชๆ‰พๅˆฐๅˆ†้•œๅ›พ_XX" text on it. Confusing the first time you see it, actually helpful once you realize it's telling you the header name doesn't exist in your text.

Install

The pack itself:

cd ComfyUI/custom_nodes
git clone https://github.com/WJLUOXIAO/XB_ToolBox.git
# or: ComfyUI Manager โ†’ search "XB_ToolBox" โ†’ install

The README swears there are zero pip dependencies, and for the core pack that's mostly true. But the whole XB-llama family only loads when llama-cpp-python is installed - without it these nodes don't appear in your node list at all. Install it built for your backend:

pip install llama-cpp-python

On an AMD card you want the ROCm/HIP (or Vulkan fallback for older cards) build; the nodes auto-detect which GPU family they're on.

Common issues

  • Node missing entirely - llama-cpp-python isn't installed, or the module import failed. Check your ComfyUI console for a line like [XB-llama] llama-cpp-python ๆœชๅฎ‰่ฃ….
  • Draw mode says "ๆš‚ๆ— ็ผ“ๅญ˜" (no cache) - you ran it with draw mode on before ever running it in pass-through mode. Run once with draw_mode off so it can cache, then flip the switch.
  • The "ๆœชๆ‰พๅˆฐ" placeholder image - your cached text uses a different header name than the range you picked (e.g. Scene_1 vs ๅˆ†้•œๅ›พ_01). The regex accepts both, but the dropdown only knows ๅˆ†้•œๅ›พ_01-style names, so check which one your writer actually emitted.
CategoryXB-llama

Inputs (3)

NameTypeDefaultDescription
draw_modeBOOLEANfalseโ€”
draw_rangeCOMBOๅ…จ้ƒจ17 options: ๅ…จ้ƒจ, ๅˆ†้•œๅ›พ_01, ๅˆ†้•œๅ›พ_02, ๅˆ†้•œๅ›พ_03, ๅˆ†้•œๅ›พ_04, ๅˆ†้•œๅ›พ_05, +11
text_inputopt*โ€”

Outputs (1)

NameTypeDescription
output_listSTRINGโ€”