Просмотр исходного кода

fix: toBook 转换 + Book 类型补回 autoGenerateContent/Audio 字段

之前 commit 漏了这两处,导致响应不返回新字段,前端详情页判断不到状态。

Co-Authored-By: Claude <noreply@anthropic.com>
MyFramework User 2 месяцев назад
Родитель
Сommit
20e97b23d1

+ 4 - 0
server/src/modules/book-generator/book-generator.store.ts

@@ -1777,6 +1777,8 @@ ${writingStyle ? `写作风格:${writingStyle}` : ''}
     afterword: string | null;
     afterword: string | null;
     errorMsg: string | null;
     errorMsg: string | null;
     bookAnalysis?: string | null;
     bookAnalysis?: string | null;
+    autoGenerateContent?: boolean;
+    autoGenerateAudio?: boolean;
     createdAt: Date;
     createdAt: Date;
     updatedAt: Date;
     updatedAt: Date;
     chapters: any[];
     chapters: any[];
@@ -1798,6 +1800,8 @@ ${writingStyle ? `写作风格:${writingStyle}` : ''}
       isPublished: dbBook.isPublished,
       isPublished: dbBook.isPublished,
       genStage: computeBookGenStage(dbBook.chapters),
       genStage: computeBookGenStage(dbBook.chapters),
       failedStage: dbBook.failedStage || undefined,
       failedStage: dbBook.failedStage || undefined,
+      autoGenerateContent: dbBook.autoGenerateContent ?? true,
+      autoGenerateAudio: dbBook.autoGenerateAudio ?? true,
       chapters: chaptersFromDb(dbBook.chapters, dbBook.id, excludeContent),
       chapters: chaptersFromDb(dbBook.chapters, dbBook.id, excludeContent),
       outline: outline || undefined,
       outline: outline || undefined,
       metadata: {
       metadata: {

+ 2 - 0
server/src/modules/book-generator/book-generator.types.ts

@@ -57,6 +57,8 @@ export interface Book extends BookBase {
   metadata?: BookMetadata;          // 元数据(作者、前言、后记等)
   metadata?: BookMetadata;          // 元数据(作者、前言、后记等)
   error?: string;                   // 错误信息
   error?: string;                   // 错误信息
   bookAnalysis?: string;            // AI 书籍规划结果(planBookNode 输出)
   bookAnalysis?: string;            // AI 书籍规划结果(planBookNode 输出)
+  autoGenerateContent?: boolean;    // 自动生成文本:true=创建后立即跑,false=停在 draft
+  autoGenerateAudio?: boolean;      // 自动生成音频:true=AudioScanner 自动入队,false=手动触发
 }
 }
 
 
 /** 书籍大纲 */
 /** 书籍大纲 */