Bläddra i källkod

1.解决客户ai对话无法报错销售发送的语音历史记录问题

jzp 2 dagar sedan
förälder
incheckning
025b4037bf

+ 7 - 5
fs-service/src/main/java/com/fs/fastGpt/service/impl/AiHookServiceImpl.java

@@ -1157,7 +1157,7 @@ public class AiHookServiceImpl implements AiHookService {
     }
 
 
-    private void saveQwUserMsg(FastGptChatSession fastGptChatSession,Integer sendType,String content) {
+    private void saveQwUserMsg(FastGptChatSession fastGptChatSession,Integer sendType,String content,QwUser sendUser) {
         content = replaceWxEmo(content);
         if(content.isEmpty()){
             return;
@@ -1168,6 +1168,7 @@ public class AiHookServiceImpl implements AiHookService {
         fastGptChatMsgAi.setRoleId(Long.parseLong(fastGptChatSession.getKfId()));
         fastGptChatMsgAi.setSendType(sendType);
         fastGptChatMsgAi.setCompanyId(fastGptChatSession.getCompanyId());
+        fastGptChatMsgAi.setCompanyUserId(sendUser.getCompanyUserId());
         fastGptChatMsgAi.setUserId(fastGptChatSession.getUserId());
         fastGptChatMsgAi.setUserType(1);
         fastGptChatMsgAi.setMsgType(1);
@@ -1972,7 +1973,7 @@ public class AiHookServiceImpl implements AiHookService {
             }
             FastGptChatSession fastGptChatSession = fastGptChatSessionMapper.selectFastGptChatSessionByQwExternalContactsAndUserId(qwExternalContacts.getId(), sendUser.getId());
             if (fastGptChatSession!=null){
-                saveQwUserMsg(fastGptChatSession,2,count);
+                saveQwUserMsg(fastGptChatSession,2,count,sendUser);
                 // 客服进行回复后就转人工10分钟
                 if(type == 1){
                     Calendar calendar = Calendar.getInstance();
@@ -2012,9 +2013,10 @@ public class AiHookServiceImpl implements AiHookService {
                         fastGptChatSession.setCompanyId(sendUser.getCompanyId());
                         fastGptChatSession.setLastTime(new Date());
                         fastGptChatSession.setIsReply(0);
+                        fastGptChatSession.setUserId(String.valueOf(sender));
                         fastGptChatSessionMapper.insertFastGptChatSession(fastGptChatSession);
                         addUserSex(qwExternalContacts);
-                        saveQwUserMsg(fastGptChatSession,2,count);
+                        saveQwUserMsg(fastGptChatSession,2,count,sendUser);
                     }
                 }
             }
@@ -2036,7 +2038,7 @@ public class AiHookServiceImpl implements AiHookService {
             }
             FastGptChatSession fastGptChatSession = fastGptChatSessionMapper.selectFastGptChatSessionByQwExternalContactsAndUserId(qwExternalContacts.getId(), sendUser.getId());
             if (fastGptChatSession!=null){
-                saveQwUserMsg(fastGptChatSession,2,count);
+                saveQwUserMsg(fastGptChatSession,2,count,sendUser);
             }else {
 
                 if(qwExternalContacts.getType()!=null&&qwExternalContacts.getType()==1){
@@ -2059,7 +2061,7 @@ public class AiHookServiceImpl implements AiHookService {
                         fastGptChatSession.setIsReply(0);
                         fastGptChatSessionMapper.insertFastGptChatSession(fastGptChatSession);
                         addUserSex(qwExternalContacts);
-                        saveQwUserMsg(fastGptChatSession,2,count);
+                        saveQwUserMsg(fastGptChatSession,2,count,sendUser);
                     }
                 }
             }