|
|
@@ -76,7 +76,7 @@ export class ChatPdfService {
|
|
|
public async upload(file: Express.Multer.File, req) {
|
|
|
const { originalname, buffer, mimetype } = file
|
|
|
let md5 = this.calculateMD5(buffer)
|
|
|
- const user = await this.apiUserService.findByUserId(req.user.id)
|
|
|
+ const user = await this.apiUserService.findByUserId(req.user.userId)
|
|
|
if (!user) {
|
|
|
const res = await ChatEmbedding.findAll({
|
|
|
where: {
|
|
|
@@ -89,7 +89,9 @@ export class ChatPdfService {
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- md5 = user.code
|
|
|
+ if (!!user.code) {
|
|
|
+ md5 = user.code
|
|
|
+ }
|
|
|
}
|
|
|
const pdf = await PdfParse(buffer)
|
|
|
const contents = []
|