# All files / modules/book-generator langgraph-types.ts

0% Statements 0/0
0% Branches 1/1
0% Functions 1/1
0% Lines 0/0

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53

     /**
     * LangGraph 书籍生成 - 参考类型定义
     *
     * 注意：当前 GraphState 定义在 graph.ts 中（使用 Annotation API），
     * 此文件仅作为类型参考保留，实际运行时不依赖此文件。
     */

    import { Book, BookOutline, Chapter } from './book-generator.types';

    // 书籍规模（与 book-type-config.ts 黄金数系统对齐）
    export type BookScale =
      | '1000' | '2000' | '3000' | '4000' | '7000'
      | '12000' | '19000' | '31000' | '50000' | '80000'
      | '130000' | '210000' | '340000';

    // LangGraph 状态（参考定义，实际见 graph.ts）
    export interface BookGenerationState {
      // 输入
      bookId: string;
      topic: string;
      bookScale: BookScale;
      description?: string;

      // 规划阶段
      outline?: BookOutline;
      outlineError?: string;

      // 章节阶段
      currentChapter: number;
      chapters: ChapterResult[];
      failedChapters: number[];

      // 补充阶段
      foreword?: string;
      afterword?: string;

      // 完成标志
      finished: boolean;
      error?: string;

      // 进度
      progress: number;
    }

    export interface ChapterResult {
      number: number;
      title: string;
      content?: string;
      wordCount: number;
      status: 'pending' | 'completed' | 'failed';
      error?: string;
    }