|
@@ -597,7 +597,15 @@ public class AiHookServiceImpl implements AiHookService {
|
|
|
return R.ok();
|
|
return R.ok();
|
|
|
}
|
|
}
|
|
|
String contentKh = result.getChoices().get(0).getMessage().getContent();
|
|
String contentKh = result.getChoices().get(0).getMessage().getContent();
|
|
|
- String content = replace(result.getChoices().get(0).getMessage().getContent()).trim();
|
|
|
|
|
|
|
+ String content = null;
|
|
|
|
|
+ if(isNewVersion){
|
|
|
|
|
+ Gson gson = new Gson();
|
|
|
|
|
+ FastGptChatConversation fastGptChatConversation = gson.fromJson(contentKh, FastGptChatConversation.class);
|
|
|
|
|
+ content = fastGptChatConversation.getAiContent();
|
|
|
|
|
+ }else{
|
|
|
|
|
+ content = replace(result.getChoices().get(0).getMessage().getContent()).trim();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
//计算token
|
|
//计算token
|
|
|
List<ChatDetailTStreamFResult.ResponseNode> responseData = result.getResponseData();
|
|
List<ChatDetailTStreamFResult.ResponseNode> responseData = result.getResponseData();
|
|
|
int token=0;
|
|
int token=0;
|
|
@@ -617,12 +625,15 @@ public class AiHookServiceImpl implements AiHookService {
|
|
|
notifyArtificial(fastGptChatSession.getSessionId(),user,qwExternalContacts.getName()," 触发关键词",qwExternalContacts.getId(),sender);
|
|
notifyArtificial(fastGptChatSession.getSessionId(),user,qwExternalContacts.getName()," 触发关键词",qwExternalContacts.getId(),sender);
|
|
|
return R.ok();
|
|
return R.ok();
|
|
|
}
|
|
}
|
|
|
- //ai回复文字长度大于500就转人工
|
|
|
|
|
- if(content.length() > 500){
|
|
|
|
|
- log.error("回复长度异常:"+role.getRoleId()+":"+qwExternalContacts.getName());
|
|
|
|
|
- notifyArtificial(fastGptChatSession.getSessionId(),user,qwExternalContacts.getName()," 回复长度异常",qwExternalContacts.getId(),sender);
|
|
|
|
|
- return R.ok();
|
|
|
|
|
|
|
+ if(!isNewVersion){
|
|
|
|
|
+ //ai回复文字长度大于500就转人工
|
|
|
|
|
+ if(content.length() > 500){
|
|
|
|
|
+ log.error("回复长度异常:"+role.getRoleId()+":"+qwExternalContacts.getName());
|
|
|
|
|
+ notifyArtificial(fastGptChatSession.getSessionId(),user,qwExternalContacts.getName()," 回复长度异常",qwExternalContacts.getId(),sender);
|
|
|
|
|
+ return R.ok();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
if (result.isLongText()){
|
|
if (result.isLongText()){
|
|
|
//新增用户信息
|
|
//新增用户信息
|
|
|
addUserInfo(contentKh, qwExternalContacts.getId(),fastGptChatSession);
|
|
addUserInfo(contentKh, qwExternalContacts.getId(),fastGptChatSession);
|