x1ongzhu 2 éve
szülő
commit
f7357f93b1
2 módosított fájl, 9 hozzáadás és 3 törlés
  1. 1 1
      src/paper/paper.controller.ts
  2. 8 2
      src/paper/paper.service.ts

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

@@ -44,6 +44,6 @@ export class PaperController {
 
     @Post('/orders/genChapters')
     async genChapters(@Body() body) {
-        return await this.paperService.genChapters(body.major, body.title, body.description)
+        return await this.paperService.genChapters(body.id, body.description)
     }
 }

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

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