fabricatio_novel.capabilities.illustration

IllustratedNovelCompose — NovelCompose subclass for image-enriched novel generation.

Three-phase pipeline:

Phase 1: allocate image budget across chapters → {chapter_index: image_count} Phase 2: per chapter, select paragraphs to illustrate → [paragraph_index, …] Phase 3: per selected paragraph, generate image prompt with character context → image_prompt string

Then: ComfyUI generates images, <img> tags injected directly into raw text.

Classes

IllustrationContext

Shared state for the illustration pipeline, constant across all chapters.

IllustratedNovelCompose

NovelCompose subclass that enriches chapters with LLM-selected illustrations.

Module Contents

class fabricatio_novel.capabilities.illustration.IllustrationContext

Shared state for the illustration pipeline, constant across all chapters.

novel: fabricatio_novel.models.novel.Novel
image_root: pathlib.Path
base_wf: fabricatio_comfyui.models.workflow.Workflow
language: str
guideline: str | None
prompt_guideline: str | None
base_looks: dict[str, str]
comfyui_timeout_per_image: float

Per-image ComfyUI timeout in seconds. Multiply by chapter budget for total timeout.

class fabricatio_novel.capabilities.illustration.IllustratedNovelCompose

Bases: fabricatio_novel.capabilities.novel.NovelCompose, fabricatio_comfyui.capabilities.comfyui.Comfyui

NovelCompose subclass that enriches chapters with LLM-selected illustrations.

Usage:

novel = await self.compose_novel(outline, language) novel = await self.inject_chapter_images(

novel, image_root, workflow_template, budget=5, guideline=”High tension moments.”, prompt_guideline=”Cinematic lighting, painterly style.”,

) DumpNovel(novel=novel, output_path=…, image_root=image_root).execute()

async inject_chapter_images(novel: fabricatio_novel.models.novel.Novel, image_root: pathlib.Path, workflow_template: pathlib.Path | None = None, budget: int = 5, language: str = 'en', guideline: str | None = None, prompt_guideline: str | None = None, comfyui_timeout: float | None = None, **kwargs: Unpack[fabricatio_core.models.kwargs_types.ValidateKwargs[None]]) fabricatio_novel.models.novel.Novel

Two-phase image injection pipeline.