xiongzhu 2 anni fa
parent
commit
17d3a845b4

+ 1 - 1
src/paper/entities/paper-order.entity.ts

@@ -34,5 +34,5 @@ export class PaperOrder {
     status: PaperOrderStatus
 
     @Column({ type: 'longtext', nullable: true, transformer: new JsonTransformer() })
-    outline?: any
+    chapters?: any
 }

+ 3 - 3
src/paper/paper.controller.ts

@@ -39,8 +39,8 @@ export class PaperController {
         return await this.paperService.gen(Number(id))
     }
 
-    @Post('/orders/:id/genChapters')
-    async genChapters(@Param('id') id: string) {
-        return await this.paperService.genChapters(Number(id))
+    @Post('/orders/genChapters')
+    async genChapters(@Body() body) {
+        return await this.paperService.genChapters(body.major, body.title, body.description)
     }
 }

+ 2 - 3
src/paper/paper.service.ts

@@ -69,10 +69,9 @@ export class PaperService implements OnModuleInit {
         this.genPaper(order)
     }
 
-    async genChapters(id: number) {
-        const order = await this.findOrderById(id)
+    async genChapters(major: string, title: string, description: string) {
         const tools = createLLM('gpt-3.5-turbo')
-        const chapters = await genChapters(tools, order.major, order.title, order.description)
+        const chapters = await genChapters(tools, major, title, description)
         return chapters
     }