wangqifan 2 anni fa
parent
commit
24e7242e69
1 ha cambiato i file con 3 aggiunte e 3 eliminazioni
  1. 3 3
      src/chat/chat.service.ts

+ 3 - 3
src/chat/chat.service.ts

@@ -63,12 +63,12 @@ export class ChatService {
     }
 
     public async chat1(req, res) {
-        // const user = await this.chatPdfService.getUser(req.user.id)
+        const user = await this.chatPdfService.getUser(req.user.id)
         res.setHeader('Content-type', 'application/octet-stream')
         const defSysMsg = (await this.sysConfigService.findByName('system_message'))?.value
         const membership = await this.membershipService.getMembership(req.user.id)
         const { prompt, options = {}, systemMessage, code, temperature, top_p } = req.body as RequestProps
-        if (!code) {
+        if (!code && !!user.apiUserId) {
             if (!membership) {
                 throw new ForbiddenException('请先成为会员')
             }
@@ -82,7 +82,7 @@ export class ChatService {
         try {
             let content = ''
             const promptTime = new Date()
-            content = await this.chatPdfService.getSystemConfig(req.userId, prompt, code, code, systemMessage)
+            content = await this.chatPdfService.getSystemConfig(req.user.id, prompt, code, code, systemMessage)
             let firstChunk = true
             const result = await chatReplyProcess({
                 message: prompt,