定位流程中断
This commit is contained in:
@@ -111,8 +111,8 @@ public class TmTelephoneCorpusServiceImpl extends ServiceImpl<TmTelephoneCorpusM
|
|||||||
private String aiAnalysisRequestIdStr = "aiAnalysisRequestId";
|
private String aiAnalysisRequestIdStr = "aiAnalysisRequestId";
|
||||||
@Override
|
@Override
|
||||||
public void runTelephoneCorpusDify(AicorpusTelephoneDTO aicorpusTelephone) {
|
public void runTelephoneCorpusDify(AicorpusTelephoneDTO aicorpusTelephone) {
|
||||||
|
try {
|
||||||
if(null != aicorpusTelephone){
|
if (null != aicorpusTelephone) {
|
||||||
|
|
||||||
List<DataMaskingRule> maskingRuleItems = dataMaskingRuleService.getDataMaskingRuleListByApplicationChannel(BusinessTypeEnum.SMART_ASSISTANT.getCode());
|
List<DataMaskingRule> maskingRuleItems = dataMaskingRuleService.getDataMaskingRuleListByApplicationChannel(BusinessTypeEnum.SMART_ASSISTANT.getCode());
|
||||||
|
|
||||||
@@ -124,12 +124,11 @@ public class TmTelephoneCorpusServiceImpl extends ServiceImpl<TmTelephoneCorpusM
|
|||||||
diFyImageReq.setUser(ConstantStr.corpus_user);
|
diFyImageReq.setUser(ConstantStr.corpus_user);
|
||||||
|
|
||||||
|
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(aicorpusTelephone.getDisplay());
|
||||||
JSONObject jsonObject = JSONObject.parseObject( aicorpusTelephone.getDisplay());
|
log.info("电话语料内容:{}", jsonObject.toString());
|
||||||
|
inputMap.put("chat", aicorpusTelephone.getDisplay());
|
||||||
inputMap.put("chat",aicorpusTelephone.getDisplay());
|
|
||||||
JSONArray segments = jsonObject.getJSONArray("segments");
|
JSONArray segments = jsonObject.getJSONArray("segments");
|
||||||
|
log.info("电话语料内容segments:{}", segments.toString());
|
||||||
// 遍历 segments
|
// 遍历 segments
|
||||||
StringBuffer chatList = new StringBuffer();
|
StringBuffer chatList = new StringBuffer();
|
||||||
segments.stream()
|
segments.stream()
|
||||||
@@ -139,11 +138,11 @@ public class TmTelephoneCorpusServiceImpl extends ServiceImpl<TmTelephoneCorpusM
|
|||||||
String text = result.getString("text");
|
String text = result.getString("text");
|
||||||
JSONObject analysisInfo = result.getJSONObject("analysis_info");
|
JSONObject analysisInfo = result.getJSONObject("analysis_info");
|
||||||
String role = analysisInfo.getString("role");
|
String role = analysisInfo.getString("role");
|
||||||
String title="";
|
String title = "";
|
||||||
if(role.equals("AGENT")){
|
if (role.equals("AGENT")) {
|
||||||
title="顾问";
|
title = "顾问";
|
||||||
}else{
|
} else {
|
||||||
title="客户";
|
title = "客户";
|
||||||
}
|
}
|
||||||
// 拼接 role 和 text
|
// 拼接 role 和 text
|
||||||
String chat = title + ": " + text;
|
String chat = title + ": " + text;
|
||||||
@@ -157,10 +156,10 @@ public class TmTelephoneCorpusServiceImpl extends ServiceImpl<TmTelephoneCorpusM
|
|||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
String formattedDateStartTime = zonedDateTime.format(formatter);
|
String formattedDateStartTime = zonedDateTime.format(formatter);
|
||||||
|
|
||||||
inputMap.put("chat",chatList.toString());
|
inputMap.put("chat", chatList.toString());
|
||||||
inputMap.put("model",getCarModelList());
|
inputMap.put("model", getCarModelList());
|
||||||
inputMap.put("recordId",aicorpusTelephone.getSourceId());
|
inputMap.put("recordId", aicorpusTelephone.getSourceId());
|
||||||
inputMap.put("version",2);
|
inputMap.put("version", 2);
|
||||||
|
|
||||||
diFyImageReq.setInputs(inputMap);
|
diFyImageReq.setInputs(inputMap);
|
||||||
CorpusReportDTO corpusReportDTO = new CorpusReportDTO();
|
CorpusReportDTO corpusReportDTO = new CorpusReportDTO();
|
||||||
@@ -184,7 +183,7 @@ public class TmTelephoneCorpusServiceImpl extends ServiceImpl<TmTelephoneCorpusM
|
|||||||
BusinessTypeEnum.SMART_ASSISTANT.getCode());
|
BusinessTypeEnum.SMART_ASSISTANT.getCode());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("runDify 异常", e);
|
log.error("runDify 异常", e);
|
||||||
}finally {
|
} finally {
|
||||||
// 释放许可
|
// 释放许可
|
||||||
semaphore.release();
|
semaphore.release();
|
||||||
}
|
}
|
||||||
@@ -201,8 +200,8 @@ public class TmTelephoneCorpusServiceImpl extends ServiceImpl<TmTelephoneCorpusM
|
|||||||
// 获取许可 - 如果没有可用许可会阻塞等待
|
// 获取许可 - 如果没有可用许可会阻塞等待
|
||||||
semaphore.acquire();
|
semaphore.acquire();
|
||||||
// 创建新的DiFyReq对象以避免线程安全问题
|
// 创建新的DiFyReq对象以避免线程安全问题
|
||||||
inputMap.put("businessId",aicorpusTelephone.getSourceId());
|
inputMap.put("businessId", aicorpusTelephone.getSourceId());
|
||||||
inputMap.put(communicateDateStr,aicorpusTelephone.getTranscribeTime());
|
inputMap.put(communicateDateStr, aicorpusTelephone.getTranscribeTime());
|
||||||
inputMap.put("analysisScene", "2");
|
inputMap.put("analysisScene", "2");
|
||||||
diFyImageReq.setInputs(inputMap);
|
diFyImageReq.setInputs(inputMap);
|
||||||
|
|
||||||
@@ -217,7 +216,7 @@ public class TmTelephoneCorpusServiceImpl extends ServiceImpl<TmTelephoneCorpusM
|
|||||||
aicorpusTelephone.getAiAnalysisRequestId(), BusinessTypeEnum.CORPUS_PORTRAIT_DCC.getCode());
|
aicorpusTelephone.getAiAnalysisRequestId(), BusinessTypeEnum.CORPUS_PORTRAIT_DCC.getCode());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("runDify 异常", e);
|
log.error("runDify 异常", e);
|
||||||
}finally {
|
} finally {
|
||||||
// 释放许可
|
// 释放许可
|
||||||
semaphore.release();
|
semaphore.release();
|
||||||
}
|
}
|
||||||
@@ -227,6 +226,9 @@ public class TmTelephoneCorpusServiceImpl extends ServiceImpl<TmTelephoneCorpusM
|
|||||||
//第二个业务场景, 结束
|
//第二个业务场景, 结束
|
||||||
|
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("runTelephoneCorpusDify error:{}", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void parseDfiyResult(JSONObject execDifyFlow,String recordId,String communicateDate,
|
private void parseDfiyResult(JSONObject execDifyFlow,String recordId,String communicateDate,
|
||||||
|
|||||||
Reference in New Issue
Block a user