|
@@ -5,7 +5,6 @@ import cn.hutool.json.JSONUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.fs.common.annotation.Excel;
|
|
import com.fs.common.annotation.Excel;
|
|
|
-import com.fs.common.config.FSConfig;
|
|
|
|
|
import com.fs.common.core.domain.R;
|
|
import com.fs.common.core.domain.R;
|
|
|
import com.fs.common.core.redis.RedisCache;
|
|
import com.fs.common.core.redis.RedisCache;
|
|
|
import com.fs.company.domain.CompanyConfig;
|
|
import com.fs.company.domain.CompanyConfig;
|
|
@@ -27,6 +26,7 @@ import com.fs.fastGpt.domain.*;
|
|
|
import com.fs.fastGpt.mapper.FastGptChatReplaceWordsMapper;
|
|
import com.fs.fastGpt.mapper.FastGptChatReplaceWordsMapper;
|
|
|
import com.fs.fastGpt.mapper.FastGptChatSessionMapper;
|
|
import com.fs.fastGpt.mapper.FastGptChatSessionMapper;
|
|
|
import com.fs.fastGpt.mapper.FastgptChatVoiceHomoMapper;
|
|
import com.fs.fastGpt.mapper.FastgptChatVoiceHomoMapper;
|
|
|
|
|
+import com.fs.fastGpt.param.FastgptKnowledgeMissCollectParam;
|
|
|
import com.fs.fastGpt.param.SendAIParam;
|
|
import com.fs.fastGpt.param.SendAIParam;
|
|
|
import com.fs.fastGpt.service.*;
|
|
import com.fs.fastGpt.service.*;
|
|
|
import com.fs.fastgptApi.param.ChatParam;
|
|
import com.fs.fastgptApi.param.ChatParam;
|
|
@@ -41,13 +41,11 @@ import com.fs.his.domain.FsStoreOrder;
|
|
|
import com.fs.his.dto.ExpressInfoDTO;
|
|
import com.fs.his.dto.ExpressInfoDTO;
|
|
|
import com.fs.his.dto.TracesDTO;
|
|
import com.fs.his.dto.TracesDTO;
|
|
|
import com.fs.his.enums.ShipperCodeEnum;
|
|
import com.fs.his.enums.ShipperCodeEnum;
|
|
|
-import com.fs.his.mapper.FsStoreMapper;
|
|
|
|
|
import com.fs.his.mapper.FsStoreOrderMapper;
|
|
import com.fs.his.mapper.FsStoreOrderMapper;
|
|
|
import com.fs.his.service.IFsExpressService;
|
|
import com.fs.his.service.IFsExpressService;
|
|
|
import com.fs.his.service.IFsStoreOrderService;
|
|
import com.fs.his.service.IFsStoreOrderService;
|
|
|
import com.fs.his.utils.ConfigUtil;
|
|
import com.fs.his.utils.ConfigUtil;
|
|
|
import com.fs.hisStore.enums.SysConfigEnum;
|
|
import com.fs.hisStore.enums.SysConfigEnum;
|
|
|
-import com.fs.im.dto.OpenImMsgDTO;
|
|
|
|
|
import com.fs.im.vo.OpenImMsgCallBackVO;
|
|
import com.fs.im.vo.OpenImMsgCallBackVO;
|
|
|
import com.fs.qw.domain.*;
|
|
import com.fs.qw.domain.*;
|
|
|
import com.fs.qw.mapper.*;
|
|
import com.fs.qw.mapper.*;
|
|
@@ -62,14 +60,12 @@ import com.fs.qwHookApi.vo.QwHookMsgVO;
|
|
|
import com.fs.qwHookApi.vo.QwHookVO;
|
|
import com.fs.qwHookApi.vo.QwHookVO;
|
|
|
import com.fs.sop.domain.QwSopLogs;
|
|
import com.fs.sop.domain.QwSopLogs;
|
|
|
import com.fs.sop.mapper.QwSopLogsMapper;
|
|
import com.fs.sop.mapper.QwSopLogsMapper;
|
|
|
-import com.fs.utils.SensitiveDataUtils;
|
|
|
|
|
import com.fs.voice.utils.StringUtil;
|
|
import com.fs.voice.utils.StringUtil;
|
|
|
import com.fs.wxwork.dto.*;
|
|
import com.fs.wxwork.dto.*;
|
|
|
import com.fs.wxwork.service.WxWorkService;
|
|
import com.fs.wxwork.service.WxWorkService;
|
|
|
import com.google.gson.Gson;
|
|
import com.google.gson.Gson;
|
|
|
import com.vdurmont.emoji.EmojiParser;
|
|
import com.vdurmont.emoji.EmojiParser;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.apache.commons.lang3.ObjectUtils;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.jetbrains.annotations.Nullable;
|
|
import org.jetbrains.annotations.Nullable;
|
|
|
import org.json.JSONObject;
|
|
import org.json.JSONObject;
|
|
@@ -77,7 +73,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
-
|
|
|
|
|
import java.lang.reflect.Field;
|
|
import java.lang.reflect.Field;
|
|
|
import java.sql.Time;
|
|
import java.sql.Time;
|
|
|
import java.time.DayOfWeek;
|
|
import java.time.DayOfWeek;
|
|
@@ -188,6 +183,9 @@ public class AiHookServiceImpl implements AiHookService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private ConfigUtil configUtil;
|
|
private ConfigUtil configUtil;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private FastgptChatQuestionCollectServiceImpl fastgptChatQuestionCollectServiceImpl;
|
|
|
|
|
+
|
|
|
|
|
|
|
|
/** Ai半小时未回复提醒 **/
|
|
/** Ai半小时未回复提醒 **/
|
|
|
/**
|
|
/**
|
|
@@ -602,6 +600,22 @@ public class AiHookServiceImpl implements AiHookService {
|
|
|
Gson gson = new Gson();
|
|
Gson gson = new Gson();
|
|
|
FastGptChatConversation fastGptChatConversation = gson.fromJson(contentKh, FastGptChatConversation.class);
|
|
FastGptChatConversation fastGptChatConversation = gson.fromJson(contentKh, FastGptChatConversation.class);
|
|
|
content = fastGptChatConversation.getAiContent();
|
|
content = fastGptChatConversation.getAiContent();
|
|
|
|
|
+
|
|
|
|
|
+ // 知识库未命中:异步写明细 + 归类统计(不阻塞主流程)
|
|
|
|
|
+ if ("0".equals(String.valueOf(fastGptChatConversation.getIsRepository()))) {
|
|
|
|
|
+ FastgptKnowledgeMissCollectParam p = new FastgptKnowledgeMissCollectParam();
|
|
|
|
|
+ p.setAiUserContent(fastGptChatConversation.getUserContent());
|
|
|
|
|
+ p.setContentEmj(contentEmj);
|
|
|
|
|
+ p.setSessionId(fastGptChatSession.getSessionId());
|
|
|
|
|
+ p.setExtId(qwExternalContacts.getExternalUserId());
|
|
|
|
|
+ p.setUserId(fastGptChatSession.getUserId());
|
|
|
|
|
+ p.setCompanyId(qwExternalContacts.getCompanyId());
|
|
|
|
|
+ p.setCompanyUserId(qwExternalContacts.getCompanyUserId());
|
|
|
|
|
+ p.setRoleId(role.getRoleId());
|
|
|
|
|
+ p.setNickName(qwExternalContacts.getName());
|
|
|
|
|
+ p.setUserType(fastGptChatSession.getUserType());
|
|
|
|
|
+ fastgptChatQuestionCollectServiceImpl.collectAsync(p);
|
|
|
|
|
+ }
|
|
|
}else{
|
|
}else{
|
|
|
content = replace(result.getChoices().get(0).getMessage().getContent()).trim();
|
|
content = replace(result.getChoices().get(0).getMessage().getContent()).trim();
|
|
|
}
|
|
}
|
|
@@ -688,11 +702,6 @@ public class AiHookServiceImpl implements AiHookService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- //
|
|
|
|
|
- // todo 把当前的内容转成jsonObject,然后取出isRepository,判断是否为知识库,如果不是知识库的,就存储到表中
|
|
|
|
|
- // 什么时候销售回复,销售回复的在哪里可以看到
|
|
|
|
|
-// contentKh
|
|
|
|
|
-
|
|
|
|
|
aiEventProcess(sender, uid, role, contentKh, user, fastGptChatSession, serverId,qwExternalContacts);
|
|
aiEventProcess(sender, uid, role, contentKh, user, fastGptChatSession, serverId,qwExternalContacts);
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1609,7 +1618,7 @@ public class AiHookServiceImpl implements AiHookService {
|
|
|
Integer reply = (Integer)redisCache.getCacheObject("reply:" + fastGptChatSession.getSessionId());
|
|
Integer reply = (Integer)redisCache.getCacheObject("reply:" + fastGptChatSession.getSessionId());
|
|
|
if (reply!=i){
|
|
if (reply!=i){
|
|
|
//次数变动 重新等待5秒
|
|
//次数变动 重新等待5秒
|
|
|
- R r = sendAiMsg(reply, fastGptChatSession, role, user, qwExternalContactsId, appKey, qwExternalContacts,sender);
|
|
|
|
|
|
|
+ R r = sendAiMsgNew(reply, fastGptChatSession, role, user, qwExternalContactsId, appKey, qwExternalContacts,sender);
|
|
|
return r;
|
|
return r;
|
|
|
}else {
|
|
}else {
|
|
|
System.out.println("开始ai回答");
|
|
System.out.println("开始ai回答");
|
|
@@ -1650,7 +1659,7 @@ public class AiHookServiceImpl implements AiHookService {
|
|
|
//次数变动 重新等待5秒
|
|
//次数变动 重新等待5秒
|
|
|
if (reply2!=i){
|
|
if (reply2!=i){
|
|
|
System.out.println("等待");
|
|
System.out.println("等待");
|
|
|
- R r1 = sendAiMsg(reply, fastGptChatSession, role, user, qwExternalContactsId, appKey, qwExternalContacts,sender);
|
|
|
|
|
|
|
+ R r1 = sendAiMsgNew(reply, fastGptChatSession, role, user, qwExternalContactsId, appKey, qwExternalContacts,sender);
|
|
|
return r1;
|
|
return r1;
|
|
|
}
|
|
}
|
|
|
addSaveAiMsg(2,1,messageList.get(0).getContent(),user,fastGptChatSession.getSessionId(),role.getRoleId(),qwExternalContacts,fastGptChatSession.getUserId(),null,null,null);
|
|
addSaveAiMsg(2,1,messageList.get(0).getContent(),user,fastGptChatSession.getSessionId(),role.getRoleId(),qwExternalContacts,fastGptChatSession.getUserId(),null,null,null);
|