|
@@ -15,6 +15,7 @@ import com.fs.common.core.domain.R;
|
|
|
import com.fs.common.core.domain.entity.SysDictData;
|
|
import com.fs.common.core.domain.entity.SysDictData;
|
|
|
import com.fs.common.utils.DateUtils;
|
|
import com.fs.common.utils.DateUtils;
|
|
|
import com.fs.crm.domain.CrmCustomerAnalyze;
|
|
import com.fs.crm.domain.CrmCustomerAnalyze;
|
|
|
|
|
+import com.fs.crm.domain.CrmCustomerChatMessage;
|
|
|
import com.fs.crm.mapper.CrmCustomerAnalyzeMapper;
|
|
import com.fs.crm.mapper.CrmCustomerAnalyzeMapper;
|
|
|
import com.fs.crm.param.PolishingScriptParam;
|
|
import com.fs.crm.param.PolishingScriptParam;
|
|
|
import com.fs.crm.service.ICrmCustomerAnalyzeService;
|
|
import com.fs.crm.service.ICrmCustomerAnalyzeService;
|
|
@@ -365,9 +366,9 @@ public class CrmCustomerAnalyzeServiceImpl extends ServiceImpl<CrmCustomerAnalyz
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public String polishingScript(PolishingScriptParam param) {
|
|
|
|
|
|
|
+ public CrmCustomerChatMessage polishingScript(PolishingScriptParam param) {
|
|
|
Map<String, Object> requestParam = new HashMap<>();
|
|
Map<String, Object> requestParam = new HashMap<>();
|
|
|
- requestParam.put("history", param.getContent());
|
|
|
|
|
|
|
+ requestParam.put("userContent", param.getContent());
|
|
|
requestParam.put("modelType","话术润色");
|
|
requestParam.put("modelType","话术润色");
|
|
|
HashMap<String, Map<String, String>> userInfo = MapUtil.of("userInfo", param.getPortrait());
|
|
HashMap<String, Map<String, String>> userInfo = MapUtil.of("userInfo", param.getPortrait());
|
|
|
requestParam.putAll(userInfo);
|
|
requestParam.putAll(userInfo);
|
|
@@ -375,16 +376,30 @@ public class CrmCustomerAnalyzeServiceImpl extends ServiceImpl<CrmCustomerAnalyz
|
|
|
// 设置其他参数
|
|
// 设置其他参数
|
|
|
requestParam.put("tagInfos", Collections.emptyList());
|
|
requestParam.put("tagInfos", Collections.emptyList());
|
|
|
requestParam.put("isRepository", "");
|
|
requestParam.put("isRepository", "");
|
|
|
- requestParam.put("userContent", "");
|
|
|
|
|
|
|
+ requestParam.put("history", "");
|
|
|
requestParam.put("aiContent", "");
|
|
requestParam.put("aiContent", "");
|
|
|
requestParam.put("likeRatio", "");
|
|
requestParam.put("likeRatio", "");
|
|
|
R aiResponse = CrmCustomerAiTagUtil.callAiService(requestParam, Long.valueOf(param.getChatId()),OTHER_KEY);
|
|
R aiResponse = CrmCustomerAiTagUtil.callAiService(requestParam, Long.valueOf(param.getChatId()),OTHER_KEY);
|
|
|
System.out.println(aiResponse);
|
|
System.out.println(aiResponse);
|
|
|
String result = "";
|
|
String result = "";
|
|
|
|
|
+ CrmCustomerChatMessage crmCustomerChatMessage = new CrmCustomerChatMessage();
|
|
|
|
|
+// Double runningTime;
|
|
|
|
|
+// Long tokens;
|
|
|
try {
|
|
try {
|
|
|
|
|
|
|
|
JsonNode rootS = mapper.readTree(JSONUtil.toJsonStr(aiResponse));
|
|
JsonNode rootS = mapper.readTree(JSONUtil.toJsonStr(aiResponse));
|
|
|
JsonNode choices = rootS.path("data").path("choices");
|
|
JsonNode choices = rootS.path("data").path("choices");
|
|
|
|
|
+// JsonNode responseData = rootS.path("data").path("responseData");
|
|
|
|
|
+// if (responseData.isArray()) {
|
|
|
|
|
+// for (JsonNode node : responseData) {
|
|
|
|
|
+// String nodeId = node.path("nodeId").asText();
|
|
|
|
|
+// String moduleName = node.path("moduleName").asText();
|
|
|
|
|
+// // 获取 runningTime
|
|
|
|
|
+// runningTime = node.path("runningTime").asDouble();
|
|
|
|
|
+// // 获取 tokens
|
|
|
|
|
+// tokens = node.path("tokens").asLong();
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
|
|
|
if (choices.isArray() && choices.size() > 0) {
|
|
if (choices.isArray() && choices.size() > 0) {
|
|
|
JsonNode contentNode = choices.get(0).path("message").path("content");
|
|
JsonNode contentNode = choices.get(0).path("message").path("content");
|
|
@@ -403,10 +418,10 @@ public class CrmCustomerAnalyzeServiceImpl extends ServiceImpl<CrmCustomerAnalyz
|
|
|
|
|
|
|
|
if (contentInnerNode.isTextual()) {
|
|
if (contentInnerNode.isTextual()) {
|
|
|
String innerJsonStr = contentInnerNode.asText();
|
|
String innerJsonStr = contentInnerNode.asText();
|
|
|
-// JsonNode innerJson = mapper.readTree(innerJsonStr);
|
|
|
|
|
-// JsonNode userInfo1 = innerJson.path("aiContent");
|
|
|
|
|
-// = userInfo1.asText();
|
|
|
|
|
- result = innerJsonStr;
|
|
|
|
|
|
|
+ JsonNode innerJson = mapper.readTree(innerJsonStr);
|
|
|
|
|
+ JsonNode userInfo1 = innerJson.path("aiContent");
|
|
|
|
|
+ result = userInfo1.asText();
|
|
|
|
|
+ crmCustomerChatMessage.setContentType(1);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -415,8 +430,11 @@ public class CrmCustomerAnalyzeServiceImpl extends ServiceImpl<CrmCustomerAnalyz
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
|
|
+ crmCustomerChatMessage.setContentType(0);
|
|
|
}
|
|
}
|
|
|
- return result;
|
|
|
|
|
|
|
+ crmCustomerChatMessage.setContent(result);
|
|
|
|
|
+ crmCustomerChatMessage.setModelName("话术润色");
|
|
|
|
|
+ return crmCustomerChatMessage;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|