语料分析增加字段

This commit is contained in:
mliu71
2025-07-23 16:01:37 +08:00
parent 8c1c37bf88
commit bf9fac4f0d
2 changed files with 13 additions and 1 deletions

View File

@@ -56,10 +56,15 @@ public class CorpusQuestionConsumer implements RocketMQListener<Map<String, Obje
JSONObject outputJson = data.getJSONObject("outputs");
JSONObject textJsonObject = JSONObject.parseObject(outputJson.getString("text"));
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.setBusinessType(outputJson.getString("businessType"));
tmCorpusQuestionReport.setSourceCorpusId(outputJson.getString("sourceCorpusId"));
tmCorpusQuestionReport.setUserDemand(userDemand);
Date sourceCorpusDate = DateUtil.parse(outputJson.getString("sourceCorpusTime"), "yyyy-MM-dd HH:mm:ss");
tmCorpusQuestionReport.setAnalysisResultJson(outputJson.toJSONString());
tmCorpusQuestionReport.setMainCategory(consultingScenario.getString("mainCategory"));

View File

@@ -21,9 +21,16 @@ public class CorpusQuestionServiceImpl implements CorpusQuestionService {
String text = consultingRequestDTO.getText();
JSONObject textJsonObject = JSONObject.parseObject(text);
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.setMainCategory(consultingScenario.getString("mainCategory"));
tmCorpusQuestionReport.setSubCategory(consultingScenario.getString("subCategory"));
tmCorpusQuestionReport.setUserDemand(userDemand);
tmCorpusQuestionReport.setConfidence(consultingScenario.getString("confidence"));
tmCorpusQuestionReport.setBusinessType(consultingRequestDTO.getBusinessType());
tmCorpusQuestionReport.setSourceCorpusId(consultingRequestDTO.getSourceCorpusId());