Commit 323670b1 by 潘诗林

feat:调用大模型生成预学习话术增加车型/用户字段

1 parent dc98005c
......@@ -254,4 +254,7 @@ public class BadgeRecordings implements Serializable {
/** 接待开始时间(JOIN自reception_customer_info) */
@Transient
private Date receptionStartTime;
@Transient
private String customerName;
}
\ No newline at end of file
......@@ -54,6 +54,18 @@ public class PreLearnProductScript implements Serializable {
@Column(name = "error_msg")
private String errorMsg;
/**
* 车型
*/
@Column(name = "car_model")
private String carModel;
/**
* 车主姓名
*/
@Column(name = "customer_name")
private String customerName;
@ApiModelProperty(notes = "创建人")
@Column(name = "created_by")
private String createdBy;
......
......@@ -162,15 +162,19 @@ public class PreLearnBigModelService {
}
// 2d. 为每个订单生成剧本
int caseIndex = 0;
int caseIndex = 1;
for (OrderCustomerDTO orderCustomer : orderCustomers) {
if (caseIndex >= 50) {
break;
}
// 2d-i. 查询录音及ASR文本(连表查询)
String asrText = fetchAsrText(orderCustomer.getCustomerPhone(),
//获取接待录音数据
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());
......@@ -194,6 +198,8 @@ public class PreLearnBigModelService {
.aiStatus("GENERATING")
.createdBy("system")
.createdDate(new Date())
.carModel(badgeRecordings.getCarModel())
.customerName(badgeRecordings.getCustomerName())
.build();
preLearnProductScriptMapper.insert(script);
......@@ -204,6 +210,23 @@ public class PreLearnBigModelService {
}
}
private BadgeRecordings fetchReceptionRecordings(String phoneNumber, Date orderDate) {
// 1. 连表查询录音(reception_customer_info LEFT JOIN inspection_badge_recordings)
List<BadgeRecordings> recordings = badgeRecordingsMapper.selectByPhoneNumber(phoneNumber);
if (CollectionUtils.isEmpty(recordings)) {
log.info("未找到录音记录: phone={}", phoneNumber);
return null;
}
// 2. 取接待时间与earliestCreatedDate最接近的一条录音
BadgeRecordings closestRecording = findClosestByReceptionTime(recordings, orderDate);
if (closestRecording == null || !StringUtils.hasText(closestRecording.getProcessTaskId())) {
log.info("无有效录音或processTaskId: phone={}", phoneNumber);
return null;
}
return closestRecording;
}
/**
* 查询大模型任务结果(HTTP GET)
*
......
......@@ -32,6 +32,8 @@
<result column="car_brandId" jdbcType="TINYINT" property="carBrandId" />
<result column="one_car_brandId" jdbcType="TINYINT" property="oneCarBrandId" />
<result column="reception_start_time" jdbcType="TIMESTAMP" property="receptionStartTime" />
<result column="customer_name" jdbcType="VARCHAR" property="carModel" />
<result column="car_model" jdbcType="VARCHAR" property="createdBy" />
</resultMap>
<sql id="Base_Column_List">
......@@ -132,7 +134,7 @@
i.recording_start_time, i.recording_end_time, i.recording_duration, i.recording_url, i.right_channel_recording_url,
i.sync_time, i.recording_id, i.resolved_flag, i.upload_flag, i.upload_url, i.process_task_id, i.created_by, i.created_date,
i.updated_by, i.updated_date, i.deleted_flag,i.reception_id,
c.reception_start_time AS reception_start_time
c.reception_start_time AS reception_start_time,c.car_model,c.customer_name
FROM reception_customer_info c
LEFT JOIN inspection_badge_recordings i ON i.reception_id = c.id
WHERE c.phone_number = #{phoneNumber}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!