XB-llama - 💬 分镜推理
Story idea in, frame prompts out
- llama_model
- parameters
- images
- output
- output_list
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_ListDispatcherand 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_list → XB_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.
Inputs (18)
| Name | Type | Default | Description |
|---|---|---|---|
| llama_model | LLAMACPPMODEL | — | |
| preset_mode | COMBO | 分镜模式 (Storyboard) | 分镜模式: 生成N帧分镜提示词序列, 每帧一行, 可直连 CLIPTextEncode 批量出图 故事模式: 根据设定创作配有分镜插图的短篇故事 |
| model_target | COMBO | Flux2-Klein | 仅在分镜模式下生效 — 选择目标生成模型的对齐语法 |
| story_style | COMBO | 治愈绘本 (Fairy Tale Illustration) | 全局美术风格与光影基调 选'自定义'则不施加风格约束 |
| camera_logic | COMBO | 固定场景演绎 (Static) | 镜头组接与空间变换逻辑 |
| frame_count | INT | 62–16 | 分镜模式: 生成的分镜帧数 故事模式: 故事配图数量 |
| language | COMBO | 英文[EN] | 输出提示词/故事的语言 |
| character_anchor | STRING | — | |
| background_setting | STRING | — | |
| story_synopsis | STRING | — | |
| inference_mode | COMBO | images | one by one: 逐张读取 (多图时每张单独推理) images: 一次性读取所有图片 video: 将输入图像视为视频帧 |
| max_frames | INT | 242–1024 | 从输入视频中均匀采样的帧数 (仅 video 模式) |
| max_size | INT | 384128–16384 | images/video 模式下输入图像的最大尺寸 |
| seed | INT | 00–18446744073709550000 | — |
| force_offload | BOOLEAN | false | 推理后卸载模型以释放显存 |
| save_states | BOOLEAN | false | 在内存中保留此对话的上下文 |
| parametersopt | LLAMACPPARAMS | — | |
| imagesopt | IMAGE | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| output | STRING | — |
| output_list | STRING | — |