fabricatio_novel.actions.illustration

Illustration action for enriching novels with ComfyUI-generated images.

Classes

IllustrateNovel

Enrich a novel with LLM-selected and ComfyUI-generated illustrations.

Module Contents

class fabricatio_novel.actions.illustration.IllustrateNovel(/, **data: Any)

Bases: fabricatio_novel.capabilities.illustration.IllustratedNovelCompose, fabricatio_core.Action

Enrich a novel with LLM-selected and ComfyUI-generated illustrations.

Runs a two-phase pipeline:
  1. Allocate image budget across chapters (LLM-based weighting).

  2. Per chapter: select paragraphs, generate image prompts, call ComfyUI.

Injects <img> tags directly into chapter content. The companion DumpNovel action with image_root set will register those images as EPUB resources.

novel: fabricatio_novel.models.novel.Novel | None = None

The novel to illustrate. Populated from workflow context via ctx_override.

image_root: pathlib.Path | None = None

Root directory for saving generated images (e.g. ./illustrations).

workflow_template: pathlib.Path | None = None

Path to a ComfyUI API-format JSON workflow file. Defaults to the bundled demo workflow.

illustration_budget: int = 5

Total number of images to generate across all chapters.

illustration_language: str = 'en'

Language for illustration prompt generation.

illustration_guideline: str | None = None

Optional extra guideline for paragraph selection.

illustration_prompt_guideline: str | None = None

Optional extra guideline for image prompt wording.

comfyui_timeout: float | None = None

Absolute ComfyUI timeout in seconds. None uses budget-scaled default from config.

output_key: str = 'novel'

Overwrites the novel key in context with the illustrated version.

ctx_override: ClassVar[bool] = True

Whether to override the instance attr by the context variable.