wangqifan 3 лет назад
Родитель
Сommit
133be05c82
2 измененных файлов с 3 добавлено и 3 удалено
  1. 1 1
      src/chat-pdf/chat-pdf.controller.ts
  2. 2 2
      src/chat-pdf/chat-pdf.service.ts

+ 1 - 1
src/chat-pdf/chat-pdf.controller.ts

@@ -11,7 +11,7 @@ export class ChatPdfController {
     @Post('upload')
     @UseInterceptors(FileInterceptor('file'))
     public async uploadFile(@UploadedFile() file: Express.Multer.File, @Req() req) {
-        return await this.chatPdfService.upload(file,req)
+        return await this.chatPdfService.upload(file, req.user.id)
     }
 
     // @Public()

+ 2 - 2
src/chat-pdf/chat-pdf.service.ts

@@ -73,10 +73,10 @@ export class ChatPdfService {
         this.sequelize.sync()
     }
 
-    public async upload(file: Express.Multer.File, req) {
+    public async upload(file: Express.Multer.File, userId: number) {
         const { originalname, buffer, mimetype } = file
         let md5 = this.calculateMD5(buffer)
-        const user = await this.apiUserService.findByUserId(req.user.userId)
+        const user = await this.apiUserService.findByUserId(userId)
         if (!user) {
             const res = await ChatEmbedding.findAll({
                 where: {