Commit 50d342a2 by 潘诗林

fix:获取语音转文本时为空校验,添加异常获取

1 parent 0073f885
......@@ -409,6 +409,9 @@ public class ConversationDateService {
public String getBadgeText(Integer recordId){
ConversationBatch conversationBatch = conversationBatchMapper.selectByRecordId(recordId);
if(Objects.isNull(conversationBatch)){
return null;
}
//获取文件内容
List<ConversationDetail> conversationDetails = inspectionConversationDetailExtService.listByBatchId(Arrays.asList(
conversationBatch.getId()));
......
......@@ -166,46 +166,53 @@ public class PreLearnBigModelService {
// 2d. 为每个订单生成剧本
int caseIndex = 1;
for (OrderCustomerDTO orderCustomer : orderCustomers) {
if (caseIndex >= 50) {
break;
}
//获取接待录音数据
BadgeRecordings badgeRecordings = fetchReceptionRecordings(orderCustomer.getCustomerPhone(),
orderCustomer.getEarliestCreatedDate());
if(Objects.isNull(badgeRecordings)){
continue;
}
// 2d-i. 查询录音及ASR文本(连表查询)
String asrText = conversationDateService.getBadgeText(badgeRecordings.getId());
if (!StringUtils.hasText(asrText)) {
log.info("未获取到ASR文本: phone={}, orderCode={}",
orderCustomer.getCustomerPhone(), orderCustomer.getOrderCode());
continue;
}
try{
if (caseIndex >= 50) {
break;
}
//获取接待录音数据
BadgeRecordings badgeRecordings = fetchReceptionRecordings(orderCustomer.getCustomerPhone(),
orderCustomer.getEarliestCreatedDate());
if(Objects.isNull(badgeRecordings)){
continue;
}
// 2d-i. 查询录音及ASR文本(连表查询)
String asrText = conversationDateService.getBadgeText(badgeRecordings.getId());
if (!StringUtils.hasText(asrText)) {
log.info("未获取到ASR文本: phone={}, orderCode={}",
orderCustomer.getCustomerPhone(), orderCustomer.getOrderCode());
continue;
}
// 2e. 提交大模型异步任务
String modelTaskId = submitAsyncTask(asrText);
if (!StringUtils.hasText(modelTaskId)) {
log.warn("大模型任务提交失败: phone={}, orderCode={}",
orderCustomer.getCustomerPhone(), orderCustomer.getOrderCode());
continue;
}
// 2e. 提交大模型异步任务
String modelTaskId = submitAsyncTask(asrText);
if (!StringUtils.hasText(modelTaskId)) {
log.warn("大模型任务提交失败: phone={}, orderCode={}",
orderCustomer.getCustomerPhone(), orderCustomer.getOrderCode());
continue;
}
// 2f. 新建剧本记录,状态为生产中
PreLearnProductScript script = PreLearnProductScript.builder()
.activityId(activityId)
.activityProductId(activityProductId)
.caseIndex(caseIndex)
.modelTaskId(modelTaskId)
.aiStatus("GENERATING")
.createdBy("system")
.createdDate(new Date())
.carModel(badgeRecordings.getCarModel())
.customerName(badgeRecordings.getCustomerName())
.build();
preLearnProductScriptMapper.insert(script);
// 2f. 新建剧本记录,状态为生产中
PreLearnProductScript script = PreLearnProductScript.builder()
.activityId(activityId)
.activityProductId(activityProductId)
.caseIndex(caseIndex)
.modelTaskId(modelTaskId)
.aiStatus(AiStatusEnum.GENERATING.getValue())
.createdBy("system")
.createdDate(new Date())
.carModel(badgeRecordings.getCarModel())
.customerName(badgeRecordings.getCustomerName())
.build();
preLearnProductScriptMapper.insert(script);
caseIndex++;
}catch (Exception e){
log.error("生成案例异常,e",e);
log.error("生成案例失败: activityId={}, activityProductId={}, 提交数量={}",
activityId, activityProductId, caseIndex);
}
caseIndex++;
}
log.info("活动商品剧本提交完成: activityId={}, activityProductId={}, 提交数量={}",
activityId, activityProductId, caseIndex);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!