提交代码优化
parent
f0ff638a94
commit
18d8c0f16c
@ -0,0 +1,19 @@
|
|||||||
|
package com.supervision.neo4j.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class WebRelDTO {
|
||||||
|
|
||||||
|
private long source;
|
||||||
|
|
||||||
|
private long target;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
public WebRelDTO(long source, long target, String name) {
|
||||||
|
this.source = source;
|
||||||
|
this.target = target;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
package com.supervision.police.service;
|
||||||
|
|
||||||
|
public interface ExtractTripleInfoService {
|
||||||
|
|
||||||
|
void extractTripleInfo(String caseId, String name, String recordId);
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
package com.supervision.police.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.supervision.police.domain.NotePrompt;
|
||||||
|
|
||||||
|
public interface NotePromptService extends IService<NotePrompt> {
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
package com.supervision.police.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.supervision.police.domain.TripleInfo;
|
||||||
|
|
||||||
|
public interface TripleInfoService extends IService<TripleInfo> {
|
||||||
|
}
|
@ -0,0 +1,100 @@
|
|||||||
|
package com.supervision.police.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.druid.util.StringUtils;
|
||||||
|
import com.supervision.police.domain.NotePrompt;
|
||||||
|
import com.supervision.police.domain.NoteRecordSplit;
|
||||||
|
import com.supervision.police.domain.TripleInfo;
|
||||||
|
import com.supervision.police.mapper.NotePromptMapper;
|
||||||
|
import com.supervision.police.mapper.NoteRecordSplitMapper;
|
||||||
|
import com.supervision.police.mapper.TripleInfoMapper;
|
||||||
|
import com.supervision.police.service.*;
|
||||||
|
import com.supervision.thread.TripleExtractThread;
|
||||||
|
import com.supervision.thread.TripleExtractThreadPool;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
import org.springframework.ai.chat.ChatResponse;
|
||||||
|
import org.springframework.ai.chat.messages.UserMessage;
|
||||||
|
import org.springframework.ai.chat.prompt.Prompt;
|
||||||
|
import org.springframework.ai.ollama.OllamaChatClient;
|
||||||
|
import org.springframework.scheduling.annotation.Async;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.StopWatch;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.Future;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class ExtractTripleInfoServiceImpl implements ExtractTripleInfoService {
|
||||||
|
|
||||||
|
private final NoteRecordSplitMapper noteRecordSplitMapper;
|
||||||
|
|
||||||
|
private final NotePromptService notePromptService;
|
||||||
|
|
||||||
|
private final TripleInfoService tripleInfoService;
|
||||||
|
|
||||||
|
private final OllamaChatClient chatClient;
|
||||||
|
|
||||||
|
|
||||||
|
@Async
|
||||||
|
public void extractTripleInfo(String caseId, String name, String recordId) {
|
||||||
|
// 首先获取所有切分后的笔录
|
||||||
|
List<NoteRecordSplit> recordSplitList = noteRecordSplitMapper.selectRecord(caseId, name, recordId);
|
||||||
|
List<TripleInfo> tripleInfos = new ArrayList<>();
|
||||||
|
List<Future<TripleInfo>> futures = new ArrayList<>();
|
||||||
|
// 对切分后的笔录进行遍历
|
||||||
|
for (NoteRecordSplit recordSplit : recordSplitList) {
|
||||||
|
// 根据笔录类型找到所有的提取三元组的提示词
|
||||||
|
List<NotePrompt> prompts = notePromptService.lambdaQuery().eq(NotePrompt::getTypeId, recordSplit.getRecordTypeId()).list();
|
||||||
|
// 遍历提示词进行提取
|
||||||
|
for (NotePrompt prompt : prompts) {
|
||||||
|
if (StringUtils.isEmpty(prompt.getPrompt())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
log.info("提交任务到线程池中进行三元组提取");
|
||||||
|
Future<TripleInfo> submit = TripleExtractThreadPool.chatExecutor.submit(new TripleExtractThread(chatClient, caseId, recordId, recordSplit.getId(), prompt.getPrompt(), recordSplit.getQuestion(), recordSplit.getAnswer()));
|
||||||
|
futures.add(submit);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (futures.size() > 0) {
|
||||||
|
Iterator<Future<TripleInfo>> iterator = futures.iterator();
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
Future<TripleInfo> future = iterator.next();
|
||||||
|
try {
|
||||||
|
// 如果提取到结果,且不为空,就进行保存
|
||||||
|
if (future.isDone()) {
|
||||||
|
TripleInfo tripleInfo = future.get();
|
||||||
|
if (tripleInfo != null) {
|
||||||
|
tripleInfos.add(tripleInfo);
|
||||||
|
}
|
||||||
|
iterator.remove();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.info("从线程中获取任务失败");
|
||||||
|
iterator.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
log.info("检查一遍,休眠1s后继续检查");
|
||||||
|
Thread.sleep(1000);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 首先清除
|
||||||
|
tripleInfoService.lambdaUpdate().eq(TripleInfo::getRecordId, recordId).remove();
|
||||||
|
// 首先要把这个笔录已经提取过的三元组记录删除掉,删除掉之后才可以重新提取
|
||||||
|
tripleInfoService.saveBatch(tripleInfos);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package com.supervision.police.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.supervision.police.domain.NotePrompt;
|
||||||
|
import com.supervision.police.mapper.NotePromptMapper;
|
||||||
|
import com.supervision.police.service.NotePromptService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class NotePromptServiceImpl extends ServiceImpl<NotePromptMapper, NotePrompt> implements NotePromptService {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package com.supervision.police.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.supervision.police.domain.TripleInfo;
|
||||||
|
import com.supervision.police.mapper.TripleInfoMapper;
|
||||||
|
import com.supervision.police.service.TripleInfoService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class TripleInfoServiceImpl extends ServiceImpl<TripleInfoMapper, TripleInfo> implements TripleInfoService {
|
||||||
|
|
||||||
|
}
|
@ -1,118 +0,0 @@
|
|||||||
package com.supervision.springaidemo.controller;
|
|
||||||
|
|
||||||
import cn.hutool.core.io.FileUtil;
|
|
||||||
import cn.hutool.core.map.MapUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.supervision.springaidemo.domain.ModelMetric;
|
|
||||||
import com.supervision.springaidemo.service.ModelMetricService;
|
|
||||||
import com.supervision.police.service.NoteCheckRecordService;
|
|
||||||
import com.supervision.springaidemo.thread.RunCheckThread;
|
|
||||||
import com.supervision.springaidemo.thread.RunCheckThreadPool;
|
|
||||||
import com.supervision.springaidemo.util.WordReadUtil;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.ai.chat.messages.AssistantMessage;
|
|
||||||
import org.springframework.ai.chat.messages.Message;
|
|
||||||
import org.springframework.ai.chat.messages.SystemMessage;
|
|
||||||
import org.springframework.ai.chat.messages.UserMessage;
|
|
||||||
import org.springframework.ai.chat.prompt.Prompt;
|
|
||||||
import org.springframework.ai.ollama.OllamaChatClient;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 入罪指标controller
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@Slf4j
|
|
||||||
@RequestMapping("rzChat")
|
|
||||||
public class RzChatController {
|
|
||||||
|
|
||||||
private static final String step1Template = """
|
|
||||||
我们现在需要以step by step的方式进行笔录的指标分析工作,得到最终的结果并返回。
|
|
||||||
|
|
||||||
step1:分析笔录的内容;
|
|
||||||
以下是笔录的内容,笔录中"问"是办案警官问,"答"是{noteUserName}回答:
|
|
||||||
---
|
|
||||||
{context}
|
|
||||||
---
|
|
||||||
|
|
||||||
step2:现在给你指标以及指标的释义或例子:
|
|
||||||
指标释义或例子及判断标准:
|
|
||||||
如满足:{metricDetailTemplate},则为true;
|
|
||||||
如果不满足::{metricDetailTemplate},则为false;
|
|
||||||
如果笔录中,没有任何笔录内容涉及到该项指标,无法进行判断,则为empty。
|
|
||||||
|
|
||||||
step3:现在需要你根据上面提供的所有信息,尽可能实事求是完成判断:
|
|
||||||
1.判断结论:true/false/empty
|
|
||||||
2.得到结论的笔录原话:从笔录的对话中,得到该结论的原文(一定是摘抄的原文且为中文)。如果结论为true,则必须要有原文佐证!
|
|
||||||
3.得到结论的原因:分析得出该结论的原因,需明确说明为什么得到该结论,需要实事求是且为中文回复。如果结论为true/false,则必须有原因!
|
|
||||||
|
|
||||||
step4:必须以json格式回复, JSON的value内容我给你的提示,在实际输出的时候不需要带上:
|
|
||||||
---
|
|
||||||
{"result":"结论", "originalContext":"笔录对应原话","reason":"原因"}
|
|
||||||
---
|
|
||||||
好了,现在可以回复了!
|
|
||||||
""";
|
|
||||||
|
|
||||||
private final OllamaChatClient chatClient;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ModelMetricService modelMetricService;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private NoteCheckRecordService noteCheckRecordService;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public RzChatController(OllamaChatClient chatClient) {
|
|
||||||
this.chatClient = chatClient;
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("extract")
|
|
||||||
public void extract() throws InterruptedException {
|
|
||||||
List<File> files = FileUtil.loopFiles("/Users/flevance/Desktop/宁夏审讯大模型/裴金禄/行为人和受害人/");
|
|
||||||
for (File file : files) {
|
|
||||||
String context = WordReadUtil.readWord(file.getPath());
|
|
||||||
// 只查入罪指标
|
|
||||||
List<ModelMetric> list = modelMetricService.lambdaQuery().likeRight(ModelMetric::getMetricCode, "RZ").list();
|
|
||||||
for (ModelMetric modelMetric : list) {
|
|
||||||
String systemPrompt = """
|
|
||||||
你是一个善于分析办案笔录的模型,能够根据办案笔录的回答内容,实事求是的判断给定指标是否满足。注意,仅根据笔录进行分析,不要做笔录之外的推断。笔录内容可能比较长,可能分多次提交给你。
|
|
||||||
""";
|
|
||||||
List<Message> messages = new ArrayList<>(List.of(new SystemMessage(systemPrompt)));
|
|
||||||
Map<String, Object> param = new HashMap<>();
|
|
||||||
param.put("metricDetailTemplate", StrUtil.format(modelMetric.getMetricDetailTemplate(), MapUtil.of("action", "裴金禄")));
|
|
||||||
param.put("noteUserName", "裴金禄");
|
|
||||||
param.put("context", context);
|
|
||||||
String format = StrUtil.format(step1Template, param);
|
|
||||||
List<Message> userMessageList = new ArrayList<>();
|
|
||||||
if (format.length() > 8000) {
|
|
||||||
log.info("分段提交");
|
|
||||||
for (String s : StrUtil.split(format, 6000)) {
|
|
||||||
userMessageList.add(new UserMessage(s));
|
|
||||||
userMessageList.add(new AssistantMessage("继续"));
|
|
||||||
}
|
|
||||||
userMessageList.remove(userMessageList.size() - 1);
|
|
||||||
} else {
|
|
||||||
userMessageList.add(new UserMessage(format));
|
|
||||||
}
|
|
||||||
messages.addAll(userMessageList);
|
|
||||||
|
|
||||||
RunCheckThread runCheck = new RunCheckThread("裴金禄尝试通过直接定义模板", chatClient, noteCheckRecordService, new Prompt(messages), FileUtil.getName(file), format, systemPrompt, modelMetric, 0);
|
|
||||||
RunCheckThreadPool.chatExecutor.submit(runCheck);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,91 +0,0 @@
|
|||||||
package com.supervision.springaidemo.thread;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import cn.hutool.json.JSONUtil;
|
|
||||||
import com.supervision.springaidemo.domain.ModelMetric;
|
|
||||||
import com.supervision.springaidemo.domain.NoteCheckRecord;
|
|
||||||
import com.supervision.springaidemo.dto.MetricResultDTO;
|
|
||||||
import com.supervision.police.service.NoteCheckRecordService;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.ai.chat.ChatResponse;
|
|
||||||
import org.springframework.ai.chat.Generation;
|
|
||||||
import org.springframework.ai.chat.prompt.Prompt;
|
|
||||||
import org.springframework.ai.ollama.OllamaChatClient;
|
|
||||||
import org.springframework.util.StopWatch;
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class RunCheckThread implements Runnable {
|
|
||||||
|
|
||||||
private final String caseName;
|
|
||||||
|
|
||||||
private final OllamaChatClient chatClient;
|
|
||||||
|
|
||||||
private final NoteCheckRecordService noteCheckRecordService;
|
|
||||||
|
|
||||||
private final Prompt prompt;
|
|
||||||
|
|
||||||
private final String fileName;
|
|
||||||
|
|
||||||
private final String format;
|
|
||||||
|
|
||||||
private final String systemPrompt;
|
|
||||||
|
|
||||||
private final ModelMetric modelMetric;
|
|
||||||
|
|
||||||
|
|
||||||
private Integer count;
|
|
||||||
|
|
||||||
public RunCheckThread(String caseName, OllamaChatClient chatClient, NoteCheckRecordService noteCheckRecordService, Prompt prompt, String fileName, String format, String systemPrompt, ModelMetric modelMetric, Integer count) {
|
|
||||||
this.caseName = caseName;
|
|
||||||
this.chatClient = chatClient;
|
|
||||||
this.noteCheckRecordService = noteCheckRecordService;
|
|
||||||
this.prompt = prompt;
|
|
||||||
this.fileName = fileName;
|
|
||||||
this.format = format;
|
|
||||||
this.systemPrompt = systemPrompt;
|
|
||||||
this.modelMetric = modelMetric;
|
|
||||||
this.count = count;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
try {
|
|
||||||
StopWatch stopWatch = new StopWatch();
|
|
||||||
stopWatch.start();
|
|
||||||
log.info("开始分析:{}",fileName);
|
|
||||||
ChatResponse call = chatClient.call(prompt);
|
|
||||||
stopWatch.stop();
|
|
||||||
log.info("耗时:{}", stopWatch.getTotalTimeSeconds());
|
|
||||||
Generation result = call.getResult();
|
|
||||||
|
|
||||||
String content = result.getOutput().getContent();
|
|
||||||
log.info("分析的结果是:{}", content);
|
|
||||||
MetricResultDTO metricResultDTO = JSONUtil.toBean(content, MetricResultDTO.class);
|
|
||||||
// 如果为空,则再跑一次,最多跑5次
|
|
||||||
if (StrUtil.isBlank(metricResultDTO.getResult())) {
|
|
||||||
if (count > 5) {
|
|
||||||
log.info("{}的{}结果超过5次,不再继续跑了", fileName, modelMetric);
|
|
||||||
} else {
|
|
||||||
log.info("{}的{}结果为空,当前跑了{}次,重新提交,再跑一次", fileName, modelMetric, count);
|
|
||||||
Integer newCount = count++;
|
|
||||||
RunCheckThread runCheck = new RunCheckThread(caseName, chatClient, noteCheckRecordService, prompt, fileName, format, systemPrompt, modelMetric, newCount);
|
|
||||||
RunCheckThreadPool.chatExecutor.submit(runCheck);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
NoteCheckRecord noteCheckRecord = new NoteCheckRecord();
|
|
||||||
noteCheckRecord.setCaseName(caseName);
|
|
||||||
noteCheckRecord.setNoteName(fileName);
|
|
||||||
noteCheckRecord.setMetricCode(modelMetric.getMetricCode());
|
|
||||||
noteCheckRecord.setMetricName(modelMetric.getMetricName());
|
|
||||||
noteCheckRecord.setSystemPrompt(systemPrompt);
|
|
||||||
noteCheckRecord.setPrompt(format);
|
|
||||||
noteCheckRecord.setResult(metricResultDTO.getResult());
|
|
||||||
noteCheckRecord.setOriginalContext(metricResultDTO.getOriginalContext());
|
|
||||||
noteCheckRecord.setReason(metricResultDTO.getReason());
|
|
||||||
noteCheckRecordService.save(noteCheckRecord);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("出现错误", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,88 @@
|
|||||||
|
package com.supervision.thread;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.supervision.police.domain.TripleInfo;
|
||||||
|
import com.supervision.springaidemo.domain.ModelMetric;
|
||||||
|
import com.supervision.springaidemo.domain.NoteCheckRecord;
|
||||||
|
import com.supervision.springaidemo.dto.MetricResultDTO;
|
||||||
|
import com.supervision.police.service.NoteCheckRecordService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
import org.springframework.ai.chat.ChatResponse;
|
||||||
|
import org.springframework.ai.chat.Generation;
|
||||||
|
import org.springframework.ai.chat.messages.UserMessage;
|
||||||
|
import org.springframework.ai.chat.prompt.Prompt;
|
||||||
|
import org.springframework.ai.ollama.OllamaChatClient;
|
||||||
|
import org.springframework.util.StopWatch;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class TripleExtractThread implements Callable<TripleInfo> {
|
||||||
|
|
||||||
|
private final OllamaChatClient chatClient;
|
||||||
|
|
||||||
|
private final String prompt;
|
||||||
|
|
||||||
|
private final String question;
|
||||||
|
|
||||||
|
private final String answer;
|
||||||
|
|
||||||
|
private final String recordSplitId;
|
||||||
|
|
||||||
|
private final String caseId;
|
||||||
|
|
||||||
|
private final String recordId;
|
||||||
|
|
||||||
|
|
||||||
|
public TripleExtractThread(OllamaChatClient chatClient, String caseId, String recordId, String recordSplitId, String prompt, String question, String answer) {
|
||||||
|
this.question = question;
|
||||||
|
this.chatClient = chatClient;
|
||||||
|
this.answer = answer;
|
||||||
|
this.prompt = prompt;
|
||||||
|
this.recordSplitId = recordSplitId;
|
||||||
|
this.caseId = caseId;
|
||||||
|
this.recordId = recordId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TripleInfo call() {
|
||||||
|
try {
|
||||||
|
StopWatch stopWatch = new StopWatch();
|
||||||
|
// 分析三元组
|
||||||
|
Prompt ask = new Prompt(new UserMessage(prompt + question + answer));
|
||||||
|
stopWatch.start();
|
||||||
|
log.info("开始分析:");
|
||||||
|
ChatResponse call = chatClient.call(ask);
|
||||||
|
stopWatch.stop();
|
||||||
|
log.info("耗时:{}", stopWatch.getTotalTimeSeconds());
|
||||||
|
String content = call.getResult().getOutput().getContent();
|
||||||
|
log.info("分析的结果是:{}", content);
|
||||||
|
// 获取从提示词中提取到的三元组信息
|
||||||
|
JSONObject jsonObject = new JSONObject(content);
|
||||||
|
JSONArray threeInfo = jsonObject.getJSONArray("result");
|
||||||
|
for (int i = 0; i < threeInfo.length(); i++) {
|
||||||
|
JSONObject object = threeInfo.getJSONObject(i);
|
||||||
|
String startNodeType = object.getString("startNodeType");
|
||||||
|
String entity = object.getString("entity");
|
||||||
|
String endNodeType = object.getString("endNodeType");
|
||||||
|
String property = object.getString("property");
|
||||||
|
String value = object.getString("value");
|
||||||
|
// 去空,如果存在任何的空值,则忽略
|
||||||
|
if (StrUtil.hasEmpty(startNodeType, entity, endNodeType, property, value)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 构建三元组信息
|
||||||
|
return new TripleInfo(entity, property, value, caseId, recordId, recordSplitId, LocalDateTime.now(), startNodeType, endNodeType);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("提取三元组出现错误", e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,10 +1,10 @@
|
|||||||
package com.supervision.springaidemo.thread;
|
package com.supervision.thread;
|
||||||
|
|
||||||
import cn.hutool.core.thread.ThreadUtil;
|
import cn.hutool.core.thread.ThreadUtil;
|
||||||
|
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
|
|
||||||
public class RunCheckThreadPool {
|
public class TripleExtractThreadPool {
|
||||||
|
|
||||||
public static final ExecutorService chatExecutor = ThreadUtil.newFixedExecutor(20, Integer.MAX_VALUE, "chat", false);
|
public static final ExecutorService chatExecutor = ThreadUtil.newFixedExecutor(20, Integer.MAX_VALUE, "tripleExtract", false);
|
||||||
}
|
}
|
Loading…
Reference in New Issue