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
Shared state for the illustration pipeline, constant across all chapters. |
|
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.
- image_root: pathlib.Path
- class fabricatio_novel.capabilities.illustration.IllustratedNovelCompose
Bases:
fabricatio_novel.capabilities.novel.NovelCompose,fabricatio_comfyui.capabilities.comfyui.ComfyuiNovelCompose 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.