提交 2875a1b7 作者: 洪东保

生成纪要代码改动

debug
父级 8990bc7c
...@@ -197,6 +197,7 @@ public class CmeetingJob { ...@@ -197,6 +197,7 @@ public class CmeetingJob {
// 不能用status筛选,因为可能线程执行一般服务终止,status状态没变 // 不能用status筛选,因为可能线程执行一般服务终止,status状态没变
List<MeetingInfo> meetingInfoList = List<MeetingInfo> meetingInfoList =
meetingInfoService.list(new LambdaQueryWrapper<MeetingInfo>() meetingInfoService.list(new LambdaQueryWrapper<MeetingInfo>()
.isNotNull(MeetingInfo::getMeetingRecordId)
.eq(MeetingInfo::getEmailPushAccess, Boolean.TRUE) .eq(MeetingInfo::getEmailPushAccess, Boolean.TRUE)
.eq(MeetingInfo::getEmailGenerateAccess, Boolean.TRUE) .eq(MeetingInfo::getEmailGenerateAccess, Boolean.TRUE)
.eq(MeetingInfo::getIsGenerated, Boolean.FALSE) .eq(MeetingInfo::getIsGenerated, Boolean.FALSE)
...@@ -252,6 +253,7 @@ public class CmeetingJob { ...@@ -252,6 +253,7 @@ public class CmeetingJob {
//查出所有早于一小时前的,邮件推送失败且未重试过的会议 //查出所有早于一小时前的,邮件推送失败且未重试过的会议
List<MeetingInfo> meetingInfoList = List<MeetingInfo> meetingInfoList =
meetingInfoService.list(new LambdaQueryWrapper<MeetingInfo>() meetingInfoService.list(new LambdaQueryWrapper<MeetingInfo>()
.isNotNull(MeetingInfo::getMeetingRecordId)
.eq(MeetingInfo::getEmailPushAccess, Boolean.TRUE) .eq(MeetingInfo::getEmailPushAccess, Boolean.TRUE)
.eq(MeetingInfo::getIsGenerated, Boolean.TRUE) .eq(MeetingInfo::getIsGenerated, Boolean.TRUE)
.eq(MeetingInfo::getIsPushed, Boolean.FALSE) .eq(MeetingInfo::getIsPushed, Boolean.FALSE)
......
...@@ -124,7 +124,7 @@ public class FileProcessTask { ...@@ -124,7 +124,7 @@ public class FileProcessTask {
MeetingInfo meetingInfo = meetingInfoMapper.selectOne(new LambdaQueryWrapper<MeetingInfo>() MeetingInfo meetingInfo = meetingInfoMapper.selectOne(new LambdaQueryWrapper<MeetingInfo>()
.eq(MeetingInfo::getMeetingRecordId, meetingRecordId)); .eq(MeetingInfo::getMeetingRecordId, meetingRecordId));
if (meetingInfo.getIsGenerated()) { if (meetingInfo.getIsGenerated()) {
log.warn("Generating is down, meetingId: {}, subMeetingId: {}", meetingInfo.getMeetingId(), meetingInfo.getSubMeetingId()); log.warn("Generating is down, meetingRecordId: {}", meetingRecordId);
return; return;
} }
if (!meetingInfo.getEmailPushAccess()) { if (!meetingInfo.getEmailPushAccess()) {
...@@ -147,9 +147,10 @@ public class FileProcessTask { ...@@ -147,9 +147,10 @@ public class FileProcessTask {
for (String recordFileId : recordFileIdList) { for (String recordFileId : recordFileIdList) {
recordTextBuffer.append(TencentMeetingApiUtil.ApiV1AddressesRecordFileIdGetRequest(recordFileId)); recordTextBuffer.append(TencentMeetingApiUtil.ApiV1AddressesRecordFileIdGetRequest(recordFileId));
} }
if (StringUtils.isEmpty(recordTextBuffer.toString().replaceAll("\\n", "").trim())) { if(StringUtils.isEmpty(recordTextBuffer.toString().replaceAll("\\n","").trim())){
log.info("获取的转录文本为空,跳过纪要生成,meetingId:{},fileRecordId:{}", meetingId, recordFileIdList.toString()); log.info("获取的转录文本为空,跳过纪要生成,meetingRecordId:{}", meetingRecordId);
processLogService.log(meetingId, subMeetingId, "获取的转录文本为空,跳过纪要生成"); processLogService.log(meetingId,subMeetingId,meetingRecordId+"获取的转录文本为空,跳过纪要生成");
status = MeetingState.EMPTY.getCode();
throw new RuntimeException("获取的转录文本为空,跳过纪要生成"); throw new RuntimeException("获取的转录文本为空,跳过纪要生成");
} }
// 1. 根据转录文件内容recordTextBuffer判断使用模板类型 // 1. 根据转录文件内容recordTextBuffer判断使用模板类型
...@@ -172,8 +173,16 @@ public class FileProcessTask { ...@@ -172,8 +173,16 @@ public class FileProcessTask {
processLogService.log(meetingId, subMeetingId, "用户" + hostUid + "暂未关联企微信息,无法生成纪要文件"); processLogService.log(meetingId, subMeetingId, "用户" + hostUid + "暂未关联企微信息,无法生成纪要文件");
continue; continue;
} }
String processedResult = null;
String processedResult = processWithClaude(recordTextBuffer.toString(), meetingDate, participantNames, template.getPrompt()); //暂时让所有模板共用一个提示词,两个模板输出同样的结果
LLMResult llmResult = processWithClaude(recordTextBuffer.toString(), meetingDate, participantNames, template.getPrompt());
if (llmResult.success) {
processedResult = llmResult.respond;
} else if (llmResult.reason.equals("会议记录 过短,退出")) {
status = MeetingState.EMPTY.getCode();
throw new RuntimeException("会议记录 过短,退出");
}
log.info("meetingRecordId: {},结果长度:{}", meetingRecordId, processedResult.length());
String minutesPath = saveResult(processedResult, recordTextBuffer.toString(), meetingInfo, toUserCode, template); String minutesPath = saveResult(processedResult, recordTextBuffer.toString(), meetingInfo, toUserCode, template);
DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyyMMdd"); DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyyMMdd");
...@@ -187,12 +196,13 @@ public class FileProcessTask { ...@@ -187,12 +196,13 @@ public class FileProcessTask {
FileUtil.del(minutesPath); FileUtil.del(minutesPath);
} }
if (CollectionUtils.isEmpty(attachments)) { if (CollectionUtils.isEmpty(attachments)) {
log.info("用户{}暂无任何模板权限,纪要生成失败", hostUid); log.info("meetingRecordId:{}用户{}暂无任何模板权限,纪要生成失败", meetingRecordId, hostUid);
isSuccess = false;
continue; continue;
} }
if (!tidWidRelations.containsKey(meetingInfo.getHostUid())) { if (!tidWidRelations.containsKey(meetingInfo.getHostUid())) {
log.error("邮件推送重试失败: 主持人对应关系未配置。meetingId {}", meetingId); log.error("邮件推送重试失败: 主持人对应关系未配置。meetingRecordId {}", meetingRecordId);
processLogService.log(meetingId, subMeetingId, "邮件推送重试失败: 主持人对应关系未配置。meetingId " + meetingId); processLogService.log(meetingId, subMeetingId, "邮件推送重试失败: 主持人对应关系未配置。meetingRecordId:"+meetingRecordId);
continue; continue;
} }
...@@ -215,7 +225,7 @@ public class FileProcessTask { ...@@ -215,7 +225,7 @@ public class FileProcessTask {
StringWriter sw = new StringWriter(); StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw); PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw); e.printStackTrace(pw);
processLogService.log(meetingId, subMeetingId, sw.toString()); processLogService.log(meetingId,subMeetingId,meetingRecordId + sw.toString());
// 异常处理 // 异常处理
retryCount++; retryCount++;
if (retryCount > MAX_RETRY) { if (retryCount > MAX_RETRY) {
...@@ -225,6 +235,7 @@ public class FileProcessTask { ...@@ -225,6 +235,7 @@ public class FileProcessTask {
meetingInfoMapper.update(null, meetingInfoMapper.update(null,
new LambdaUpdateWrapper<MeetingInfo>() new LambdaUpdateWrapper<MeetingInfo>()
.eq(MeetingInfo::getMeetingRecordId, meetingRecordId) .eq(MeetingInfo::getMeetingRecordId, meetingRecordId)
.set(MeetingInfo::getStatus, MeetingState.GENERATE_ERROR.getCode())
.set(MeetingInfo::getGenerateRetry,Boolean.TRUE)); .set(MeetingInfo::getGenerateRetry,Boolean.TRUE));
} else { } else {
meetingInfoMapper.update(null, meetingInfoMapper.update(null,
...@@ -285,16 +296,18 @@ public class FileProcessTask { ...@@ -285,16 +296,18 @@ public class FileProcessTask {
* @param prompt 提示词 * @param prompt 提示词
* @return * @return
*/ */
private String processWithClaude(String textContent, String meetingDate, String participantNames, String prompt) { private LLMResult processWithClaude(String textContent, String meetingDate,String participantNames, String prompt) {
// //将文件传送给大模型处理
LLMConfig baseLLM = new LLMConfig(llmModel, LLMConfig baseLLM = new LLMConfig(llmModel,
llmApiAddr, llmApiAddr,
"Bearer " + llmToken, "Bearer " + llmToken,
llmMaxTokens); llmMaxTokens);
LLMResult llmResult = MeetingProcess.processMeeting(prompt, textContent,meetingDate,participantNames, baseLLM, new ArrayList<>()); LLMResult llmResult = MeetingProcess.processMeeting(prompt, textContent,meetingDate,participantNames, baseLLM, new ArrayList<>());
if (llmResult.success) { return llmResult;
return llmResult.respond; // if (llmResult.success) {
} // return llmResult.respond;
throw new RuntimeException(llmResult.reason); // }
// throw new RuntimeException(llmResult.reason);
// DebugOutputTool.println(llmResult.respond); // DebugOutputTool.println(llmResult.respond);
} }
......
...@@ -207,7 +207,8 @@ public class TencentMeetingServiceImpl extends ServiceImpl<TecentMeetingMapper, ...@@ -207,7 +207,8 @@ public class TencentMeetingServiceImpl extends ServiceImpl<TecentMeetingMapper,
boolean flag = true; boolean flag = true;
if (CollUtil.isNotEmpty(meetingIds)) { if (CollUtil.isNotEmpty(meetingIds)) {
for (TencentMeetingVO.SimpleMeetingInfo meetingInfo : meetingIds) { for (TencentMeetingVO.SimpleMeetingInfo meetingInfo : meetingIds) {
if (meetingInfo.getMeetingRecordId().equals(meetingRecordId)) { String meetingRecordIdTemp = meetingInfo.getMeetingRecordId();
if (meetingRecordIdTemp != null && meetingRecordIdTemp.equals(meetingRecordId)) {
flag = false; flag = false;
break; break;
} }
......
...@@ -100,7 +100,7 @@ tencent: ...@@ -100,7 +100,7 @@ tencent:
aesKey: agy6ALUePp34lljWz1uIQWa7yQq3dgxxQNmfaN9GROm aesKey: agy6ALUePp34lljWz1uIQWa7yQq3dgxxQNmfaN9GROm
base-save-path: E:/save/ #会议纪要临时文件存储路径 base-save-path: E:/save/ #会议纪要临时文件存储路径
search-scope: 2 #腾会转录文件拉取时间范围,查询过去n天的记录 search-scope: 2 #腾会转录文件拉取时间范围,查询过去n天的记录
search-end-time: '2025-07-30 23:59:59' #此时间之前的数据不拉取 search-end-time: '2025-11-26 22:59:59' #此时间之前的数据不拉取
email: email:
sender: ${EMAIL_SENDER} sender: ${EMAIL_SENDER}
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
</foreach> </foreach>
</insert> </insert>
<select id="getAllMeetingIds" resultType="com.cmeeting.vo.TencentMeetingVO$SimpleMeetingInfo"> <select id="getAllMeetingIds" resultType="com.cmeeting.vo.TencentMeetingVO$SimpleMeetingInfo">
select meeting_id,meeting_record_id,sub_meeting_id,record_file_id from cmt_meeting_info order by sync_time limit 10000; select meeting_id,meeting_record_id,sub_meeting_id,record_file_id from cmt_meeting_info order by sync_time desc limit 20000;
</select> </select>
<select id="statistics" resultType="java.util.LinkedHashMap"> <select id="statistics" resultType="java.util.LinkedHashMap">
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论