|
@@ -652,10 +652,10 @@ public class AiHookServiceImpl implements AiHookService {
|
|
|
if (result.isLongText()){
|
|
if (result.isLongText()){
|
|
|
//新增用户信息
|
|
//新增用户信息
|
|
|
addUserInfo(contentKh, qwExternalContacts.getId(),fastGptChatSession);
|
|
addUserInfo(contentKh, qwExternalContacts.getId(),fastGptChatSession);
|
|
|
- //发送图片消息
|
|
|
|
|
- sendImgMsg(contentKh,sender,uid,serverId);
|
|
|
|
|
|
|
|
|
|
if(isNewVersion){
|
|
if(isNewVersion){
|
|
|
|
|
+ //发送图片消息
|
|
|
|
|
+ sendImgMsg(contentKh,sender,uid,serverId);
|
|
|
sendAiMsg(content,sender,uid,serverId);
|
|
sendAiMsg(content,sender,uid,serverId);
|
|
|
} else {
|
|
} else {
|
|
|
if (type==16){
|
|
if (type==16){
|
|
@@ -677,10 +677,10 @@ public class AiHookServiceImpl implements AiHookService {
|
|
|
List<String> countList = countString(content);
|
|
List<String> countList = countString(content);
|
|
|
//新增用户信息
|
|
//新增用户信息
|
|
|
addUserInfo(contentKh, qwExternalContacts.getId(),fastGptChatSession);
|
|
addUserInfo(contentKh, qwExternalContacts.getId(),fastGptChatSession);
|
|
|
- //发送图片消息
|
|
|
|
|
- sendImgMsg(contentKh,sender,uid,serverId);
|
|
|
|
|
for (String msg : countList) {
|
|
for (String msg : countList) {
|
|
|
if(isNewVersion){
|
|
if(isNewVersion){
|
|
|
|
|
+ //发送图片消息
|
|
|
|
|
+ sendImgMsg(contentKh,sender,uid,serverId);
|
|
|
sendAiMsg(msg,sender,uid,serverId);
|
|
sendAiMsg(msg,sender,uid,serverId);
|
|
|
} else {
|
|
} else {
|
|
|
if (type==16){
|
|
if (type==16){
|
|
@@ -1706,9 +1706,12 @@ public class AiHookServiceImpl implements AiHookService {
|
|
|
private void addPromptWordNew(List<ChatParam.Message> messageList,String count,Long extId,FastGptRole role,FastGptChatSession fastGptChatSession){
|
|
private void addPromptWordNew(List<ChatParam.Message> messageList,String count,Long extId,FastGptRole role,FastGptChatSession fastGptChatSession){
|
|
|
|
|
|
|
|
FastGptChatConversation conversation = new FastGptChatConversation();
|
|
FastGptChatConversation conversation = new FastGptChatConversation();
|
|
|
- conversation.setAiInfo(new com.alibaba.fastjson.JSONObject());
|
|
|
|
|
conversation.setUserInfo(new com.alibaba.fastjson.JSONObject());
|
|
conversation.setUserInfo(new com.alibaba.fastjson.JSONObject());
|
|
|
- conversation.setHistory(new com.alibaba.fastjson.JSONObject());
|
|
|
|
|
|
|
+ conversation.setHistory(new com.alibaba.fastjson.JSONArray());
|
|
|
|
|
+
|
|
|
|
|
+ if(role.getReminderWords() != null && !role.getReminderWords().isEmpty()){
|
|
|
|
|
+ conversation.setAiInfo(role.getReminderWords());
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
//组装客户信息
|
|
//组装客户信息
|
|
|
String sessionUserInfo = fastGptChatSession.getUserInfo();
|
|
String sessionUserInfo = fastGptChatSession.getUserInfo();
|
|
@@ -1739,7 +1742,7 @@ public class AiHookServiceImpl implements AiHookService {
|
|
|
|
|
|
|
|
List<FastGptChatMsg> msgs=fastGptChatMsgService.selectFastGptChatMsgByMsgSessionIdAndExtId(fastGptChatSession.getSessionId(),extId);
|
|
List<FastGptChatMsg> msgs=fastGptChatMsgService.selectFastGptChatMsgByMsgSessionIdAndExtId(fastGptChatSession.getSessionId(),extId);
|
|
|
if (!msgs.isEmpty()){
|
|
if (!msgs.isEmpty()){
|
|
|
- com.alibaba.fastjson.JSONObject history = conversation.getHistory();
|
|
|
|
|
|
|
+ com.alibaba.fastjson.JSONArray historyArray = new com.alibaba.fastjson.JSONArray();
|
|
|
Collections.reverse(msgs);
|
|
Collections.reverse(msgs);
|
|
|
msgs.remove(msgs.size() - 1);
|
|
msgs.remove(msgs.size() - 1);
|
|
|
for (FastGptChatMsg msg : msgs) {
|
|
for (FastGptChatMsg msg : msgs) {
|
|
@@ -1750,9 +1753,12 @@ public class AiHookServiceImpl implements AiHookService {
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- history.put(sendType==1?"user":"ai",content);
|
|
|
|
|
|
|
+ com.alibaba.fastjson.JSONObject msgObj = new com.alibaba.fastjson.JSONObject();
|
|
|
|
|
+ msgObj.put("role", sendType==1?"user":"ai");
|
|
|
|
|
+ msgObj.put("content", content);
|
|
|
|
|
+ historyArray.add(msgObj);
|
|
|
}
|
|
}
|
|
|
- conversation.setHistory(history);
|
|
|
|
|
|
|
+ conversation.setHistory(historyArray);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (count!=null&& !count.isEmpty()){
|
|
if (count!=null&& !count.isEmpty()){
|