|
|
@ -127,10 +127,14 @@ public class ModelRecordTypeServiceImpl extends ServiceImpl<ModelRecordTypeMappe
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private List<TripleInfo> extractTripleInfo(String caseId, String name, String recordId) {
|
|
|
|
private List<TripleInfo> extractTripleInfo(String caseId, String name, String recordId) {
|
|
|
|
List<NoteRecordSplit> records = noteRecordSplitMapper.selectRecord(caseId, name, recordId);
|
|
|
|
// 首先获取所有切分后的笔录
|
|
|
|
|
|
|
|
List<NoteRecordSplit> recordSplitList= noteRecordSplitMapper.selectRecord(caseId, name, recordId);
|
|
|
|
List<TripleInfo> tripleInfos = new ArrayList<>();
|
|
|
|
List<TripleInfo> tripleInfos = new ArrayList<>();
|
|
|
|
for (NoteRecordSplit record : records) {
|
|
|
|
// 对切分后的笔录进行遍历
|
|
|
|
|
|
|
|
for (NoteRecordSplit record : recordSplitList) {
|
|
|
|
|
|
|
|
// 根据笔录类型找到所有的提取三元组的提示词
|
|
|
|
List<NotePrompt> prompts = notePromptMapper.queryPrompt(record.getRecordTypeId());
|
|
|
|
List<NotePrompt> prompts = notePromptMapper.queryPrompt(record.getRecordTypeId());
|
|
|
|
|
|
|
|
// 遍历提示词进行提取
|
|
|
|
for (NotePrompt prompt : prompts) {
|
|
|
|
for (NotePrompt prompt : prompts) {
|
|
|
|
if (StringUtils.isEmpty(prompt.getPrompt())) {
|
|
|
|
if (StringUtils.isEmpty(prompt.getPrompt())) {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
@ -146,6 +150,7 @@ public class ModelRecordTypeServiceImpl extends ServiceImpl<ModelRecordTypeMappe
|
|
|
|
log.info("耗时:{}", stopWatch.getTotalTimeSeconds());
|
|
|
|
log.info("耗时:{}", stopWatch.getTotalTimeSeconds());
|
|
|
|
String content = call.getResult().getOutput().getContent();
|
|
|
|
String content = call.getResult().getOutput().getContent();
|
|
|
|
log.info("分析的结果是:{}", content);
|
|
|
|
log.info("分析的结果是:{}", content);
|
|
|
|
|
|
|
|
// 获取从提示词中提取到的三元组信息
|
|
|
|
JSONObject jsonObject = new JSONObject(content);
|
|
|
|
JSONObject jsonObject = new JSONObject(content);
|
|
|
|
JSONArray threeInfo = jsonObject.getJSONArray("result");
|
|
|
|
JSONArray threeInfo = jsonObject.getJSONArray("result");
|
|
|
|
for (int i = 0; i < threeInfo.length(); i++) {
|
|
|
|
for (int i = 0; i < threeInfo.length(); i++) {
|
|
|
@ -159,6 +164,7 @@ public class ModelRecordTypeServiceImpl extends ServiceImpl<ModelRecordTypeMappe
|
|
|
|
if (StrUtil.hasEmpty(startNodeType, entity, endNodeType, property, value)) {
|
|
|
|
if (StrUtil.hasEmpty(startNodeType, entity, endNodeType, property, value)) {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 将三元组信息进行保存操作
|
|
|
|
TripleInfo tripleInfo = new TripleInfo(entity, property, value, record.getId(), LocalDateTime.now(), startNodeType, endNodeType);
|
|
|
|
TripleInfo tripleInfo = new TripleInfo(entity, property, value, record.getId(), LocalDateTime.now(), startNodeType, endNodeType);
|
|
|
|
tripleInfoMapper.insert(tripleInfo);
|
|
|
|
tripleInfoMapper.insert(tripleInfo);
|
|
|
|
tripleInfos.add(tripleInfo);
|
|
|
|
tripleInfos.add(tripleInfo);
|
|
|
|