语料分析增加字段
This commit is contained in:
@@ -56,10 +56,15 @@ public class CorpusQuestionConsumer implements RocketMQListener<Map<String, Obje
|
|||||||
JSONObject outputJson = data.getJSONObject("outputs");
|
JSONObject outputJson = data.getJSONObject("outputs");
|
||||||
JSONObject textJsonObject = JSONObject.parseObject(outputJson.getString("text"));
|
JSONObject textJsonObject = JSONObject.parseObject(outputJson.getString("text"));
|
||||||
JSONObject consultingScenario = textJsonObject.getJSONObject("consultingScenario");
|
JSONObject consultingScenario = textJsonObject.getJSONObject("consultingScenario");
|
||||||
|
String userDemand = textJsonObject.getString("userDemand");
|
||||||
|
if (userDemand != null && userDemand.length() > 4000) {
|
||||||
|
log.warn("userDemand 字段长度超过 4000,已自动截取。原始长度:{}", userDemand.length());
|
||||||
|
userDemand = userDemand.substring(0, 4000);
|
||||||
|
}
|
||||||
TmCorpusQuestionReport tmCorpusQuestionReport = new TmCorpusQuestionReport();
|
TmCorpusQuestionReport tmCorpusQuestionReport = new TmCorpusQuestionReport();
|
||||||
tmCorpusQuestionReport.setBusinessType(outputJson.getString("businessType"));
|
tmCorpusQuestionReport.setBusinessType(outputJson.getString("businessType"));
|
||||||
tmCorpusQuestionReport.setSourceCorpusId(outputJson.getString("sourceCorpusId"));
|
tmCorpusQuestionReport.setSourceCorpusId(outputJson.getString("sourceCorpusId"));
|
||||||
|
tmCorpusQuestionReport.setUserDemand(userDemand);
|
||||||
Date sourceCorpusDate = DateUtil.parse(outputJson.getString("sourceCorpusTime"), "yyyy-MM-dd HH:mm:ss");
|
Date sourceCorpusDate = DateUtil.parse(outputJson.getString("sourceCorpusTime"), "yyyy-MM-dd HH:mm:ss");
|
||||||
tmCorpusQuestionReport.setAnalysisResultJson(outputJson.toJSONString());
|
tmCorpusQuestionReport.setAnalysisResultJson(outputJson.toJSONString());
|
||||||
tmCorpusQuestionReport.setMainCategory(consultingScenario.getString("mainCategory"));
|
tmCorpusQuestionReport.setMainCategory(consultingScenario.getString("mainCategory"));
|
||||||
|
|||||||
@@ -21,9 +21,16 @@ public class CorpusQuestionServiceImpl implements CorpusQuestionService {
|
|||||||
String text = consultingRequestDTO.getText();
|
String text = consultingRequestDTO.getText();
|
||||||
JSONObject textJsonObject = JSONObject.parseObject(text);
|
JSONObject textJsonObject = JSONObject.parseObject(text);
|
||||||
JSONObject consultingScenario = textJsonObject.getJSONObject("consultingScenario");
|
JSONObject consultingScenario = textJsonObject.getJSONObject("consultingScenario");
|
||||||
|
String userDemand = textJsonObject.getString("userDemand");
|
||||||
|
if (userDemand != null && userDemand.length() > 4000) {
|
||||||
|
log.warn("userDemand 字段长度超过 4000,已自动截取。原始长度:{}", userDemand.length());
|
||||||
|
userDemand = userDemand.substring(0, 4000);
|
||||||
|
}
|
||||||
TmCorpusQuestionReport tmCorpusQuestionReport = new TmCorpusQuestionReport();
|
TmCorpusQuestionReport tmCorpusQuestionReport = new TmCorpusQuestionReport();
|
||||||
tmCorpusQuestionReport.setMainCategory(consultingScenario.getString("mainCategory"));
|
tmCorpusQuestionReport.setMainCategory(consultingScenario.getString("mainCategory"));
|
||||||
tmCorpusQuestionReport.setSubCategory(consultingScenario.getString("subCategory"));
|
tmCorpusQuestionReport.setSubCategory(consultingScenario.getString("subCategory"));
|
||||||
|
tmCorpusQuestionReport.setUserDemand(userDemand);
|
||||||
|
|
||||||
tmCorpusQuestionReport.setConfidence(consultingScenario.getString("confidence"));
|
tmCorpusQuestionReport.setConfidence(consultingScenario.getString("confidence"));
|
||||||
tmCorpusQuestionReport.setBusinessType(consultingRequestDTO.getBusinessType());
|
tmCorpusQuestionReport.setBusinessType(consultingRequestDTO.getBusinessType());
|
||||||
tmCorpusQuestionReport.setSourceCorpusId(consultingRequestDTO.getSourceCorpusId());
|
tmCorpusQuestionReport.setSourceCorpusId(consultingRequestDTO.getSourceCorpusId());
|
||||||
|
|||||||
Reference in New Issue
Block a user