This document outlines the technical requirements and integration details for the Auto Author Table of Contents (TOC) generation functionality.
The TOC generation feature uses AI to automatically create a structured table of contents based on the user's book summary and responses to clarifying questions. This creates a foundation for the book's structure that can be further refined through the editing interface.
- Minimum word count: 100 words
- Recommended word count: 250-500 words
- Summary must contain sufficient thematic content to generate a meaningful structure
- Confidence score is calculated based on:
- Word count
- Topic clarity
- Genre identification
- Narrative progression identifiers
- Each TOC must generate:
- Top-level chapters (minimum 3, maximum 20)
- Optional subchapters (nested up to 2 levels)
- Brief description for each chapter/subchapter
- Estimated page count
- Structure notes with AI insights
- Summary text is preprocessed to:
- Remove irrelevant content
- Identify key themes and topics
- Extract genre and audience information
- Analyze narrative or argumentative structure
-
Readiness Assessment
- AI analyzes summary for completeness
- Calculates confidence score
- Provides specific feedback if requirements aren't met
-
Clarifying Questions
- AI generates 3-5 targeted questions based on gaps in the summary
- Questions focus on genre, audience, structure, and content depth
- Responses are incorporated into the final TOC generation
-
TOC Generation
- AI constructs hierarchical chapter structure
- Determines logical chapter sequence
- Creates descriptive chapter titles
- Generates brief content descriptions for each chapter
- Adds structure notes with rationale for the organization
The system uses carefully engineered prompts to guide the AI in producing high-quality TOC structures:
-
Readiness Assessment Prompt
- Evaluates summary completeness
- Identifies information gaps
- Calculates confidence score
- Suggests improvements
-
Clarifying Questions Prompt
- Identifies specific gaps in the summary
- Generates questions to fill those gaps
- Ensures questions cover genre, audience, structure, and content depth
-
TOC Generation Prompt
- Combines summary and question responses
- Specifies desired TOC format and depth
- Guides hierarchical structure creation
- Sets constraints for chapter/subchapter count
- Requests brief descriptions and structure notes
- Graceful degradation if AI service fails
- Retry mechanism for transient errors
- User-friendly error messages
- Fallback to manual TOC creation if automated generation fails
- Timeout handling for long-running AI operations
- AI requests are rate-limited (2 per 5 minutes per user)
- Caching of TOC generation results
- Asynchronous processing for long-running operations
- Progress indicators during generation
- Efficient storage of TOC structures in MongoDB