Nodes/XB_ToolBox/XB-llama - 💬 分镜推理
ComfyUI Node

XB-llama - 💬 分镜推理

Story idea in, frame prompts out

By wjluoxiao·Created 5 months ago·Updated 6 days ago· 302
XB-llama - 💬 分镜推理
  • llama_model
  • parameters
  • images
  • output
  • output_list
preset_mode分镜模式 (Storyboard)
model_targetFlux2-Klein
story_style治愈绘本 (Fairy Tale Illustration)
camera_logic固定场景演绎 (Static)
frame_count6
language英文[EN]
character_anchor
background_setting
story_synopsis
inference_modeimages
max_frames24
max_size384
seed0
force_offloadfalse
save_statesfalse

If XB_llamaStoryboardEnhancer + XB_llamaInstruct is the two-node way to generate a storyboard, XB_llamaStoryboardInstruct is the one-node version: it fuses the enhancer's prompt-building and the instruct node's actual LLM call into a single node. Drop in a loaded model, describe your story, and out come the frame prompts - one per line on a list output you can fan straight into CLIP Text Encode nodes for batch generation.

The tooltips frame it perfectly: storyboard mode generates "an N-frame storyboard prompt sequence, one line per frame, directly connectable to CLIPTextEncode for batch image generation," and story-writing mode creates "a short story with storyboard illustrations." Both modes in one node.

The inputs

The story-side inputs mirror the enhancer: preset_mode (Storyboard / Story Writing), model_target (Flux2-Klein / Qwen-Edit syntax rules - only effective in storyboard mode), story_style (12 styles), camera_logic (5 logics), frame_count (2–16: frames for storyboard mode, illustration count for story mode), language (EN/ZH), character_anchor, background_setting, and story_synopsis - the three text boxes are your actual creative input, and character_anchor is the consistency insurance that stops the protagonist from morphing between frames.

The inference-side inputs come from the instruct half: inference_mode (one by one / images / video), max_frames (video sampling), max_size (image downscale cap, default 384), seed, force_offload (unload the LLM after inference so the diffusion model gets the VRAM), save_states (multi-run conversation continuity), plus optional parameters (LLAMACPPARAMS from XB_llamaParameters) and images (IMAGE).

Outputs

  • output - the full response text.
  • output_list - the response split into lines. In storyboard mode, this is your per-frame prompt list: wire it into XB_ListDispatcher and each frame gets its own STRING output, ready for separate CLIP Text Encode nodes.

Installing it

Part of XB_ToolBox - ComfyUI Manager (XB_ToolBox) or:

cd ComfyUI/custom_nodes
git clone https://github.com/WJLUOXIAO/XB_ToolBox.git

restart. This node requires the llama stack to function: llama-cpp-python (see XB_llamaModelLoader for the CUDA/ROCm wheel install) plus a GGUF model in ComfyUI/models/LLM/.

The workflow it wants

Model loader → this node (story in the three text boxes, model_target matched to your generation model) → output_listXB_ListDispatcher → per-frame CLIP Text Encode → batch sampler. If you're generating an actual video, the output_list also pairs with the pack's storyboard processors (XB_llamaStoryboardProcessor) for finer per-frame handling.

Where people get burned

1. Empty story boxes. The enhancer-side refuses to run on a blank story_synopsis - the error is in Chinese and reads like "please fill in your story description." Put something in, even a sentence. 2. Model mismatch. model_target is the syntax your frame prompts are written in; if you feed Klein-prose to a Qwen-Edit workflow or an anime tag model, the frames will fight the encoder. 3. Format drift on small models. The defaults (XB_llamaParameters: temperature 0.6, repeat_penalty 1.12) are tuned to keep [SHOT_START]-style framing intact - bump the temperature and you'll get lovely prose that no longer parses into clean per-frame lines. 4. save_states left on. It accumulates context across runs; if your output starts "remembering" last week's story, run XB_llamaCleanStates and turn it off unless you want continuity. And as with every local-LLM output here: it's a first draft, not a film script - the frames you actually generate will be much better than the prompt list is.

CategoryXB-llama

Inputs (18)

NameTypeDefaultDescription
llama_modelLLAMACPPMODEL
preset_modeCOMBO分镜模式 (Storyboard)分镜模式: 生成N帧分镜提示词序列, 每帧一行, 可直连 CLIPTextEncode 批量出图 故事模式: 根据设定创作配有分镜插图的短篇故事
model_targetCOMBOFlux2-Klein仅在分镜模式下生效 — 选择目标生成模型的对齐语法
story_styleCOMBO治愈绘本 (Fairy Tale Illustration)全局美术风格与光影基调 选'自定义'则不施加风格约束
camera_logicCOMBO固定场景演绎 (Static)镜头组接与空间变换逻辑
frame_countINT62–16分镜模式: 生成的分镜帧数 故事模式: 故事配图数量
languageCOMBO英文[EN]输出提示词/故事的语言
character_anchorSTRING
background_settingSTRING
story_synopsisSTRING
inference_modeCOMBOimagesone by one: 逐张读取 (多图时每张单独推理) images: 一次性读取所有图片 video: 将输入图像视为视频帧
max_framesINT242–1024从输入视频中均匀采样的帧数 (仅 video 模式)
max_sizeINT384128–16384images/video 模式下输入图像的最大尺寸
seedINT00–18446744073709550000
force_offloadBOOLEANfalse推理后卸载模型以释放显存
save_statesBOOLEANfalse在内存中保留此对话的上下文
parametersoptLLAMACPPARAMS
imagesoptIMAGE

Outputs (2)

NameTypeDescription
outputSTRING
output_listSTRING