ai
This commit is contained in:
@ -32,7 +32,7 @@ public class DashScopeChat {
|
|||||||
|
|
||||||
private final ChatClient chatClient;
|
private final ChatClient chatClient;
|
||||||
|
|
||||||
private static final String DEFAULT_PROMPT = "你是一个博学的智能聊天助手,请根据用户提问回答!";
|
private static final String DEFAULT_PROMPT = "你叫煤球,是一个博学的智能聊天助手,请根据用户提问回答!";
|
||||||
|
|
||||||
private static final String DEFAULT_FILE_DIR = System.getProperty("user.dir") + "/chat-memory";
|
private static final String DEFAULT_FILE_DIR = System.getProperty("user.dir") + "/chat-memory";
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ public class DashScopeChat {
|
|||||||
}
|
}
|
||||||
// 构建生成标题的提示词
|
// 构建生成标题的提示词
|
||||||
String prompt = String.format("""
|
String prompt = String.format("""
|
||||||
请为下面这段用户与AI的对话生成一个简短的标题(不超过10个字):
|
请为下面这段用户与AI的对话生成一个简短的标题(不超过10个字),并且以陈述句的形式进行总结:
|
||||||
用户:%s
|
用户:%s
|
||||||
AI:%s
|
AI:%s
|
||||||
""", userMessage, aiResponse);
|
""", userMessage, aiResponse);
|
||||||
|
|||||||
@ -218,11 +218,8 @@ public class OthYs7DeviceImgServiceImpl extends ServiceImpl<OthYs7DeviceImgMappe
|
|||||||
List<HseViolationLevel> levelList = violationLevelService.lambdaQuery()
|
List<HseViolationLevel> levelList = violationLevelService.lambdaQuery()
|
||||||
.in(HseViolationLevel::getProjectId, projectIds)
|
.in(HseViolationLevel::getProjectId, projectIds)
|
||||||
.list();
|
.list();
|
||||||
if (CollUtil.isEmpty(levelList)) {
|
|
||||||
log.error("未设置安全等级");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Map<Long, List<RecognizerTypeEnum>> level = new HashMap<>();
|
Map<Long, List<RecognizerTypeEnum>> level = new HashMap<>();
|
||||||
|
if (CollUtil.isNotEmpty(levelList)) {
|
||||||
Map<Long, List<HseViolationLevel>> levelMap = levelList.stream()
|
Map<Long, List<HseViolationLevel>> levelMap = levelList.stream()
|
||||||
.collect(Collectors.groupingBy(HseViolationLevel::getProjectId));
|
.collect(Collectors.groupingBy(HseViolationLevel::getProjectId));
|
||||||
for (Map.Entry<Long, List<HseViolationLevel>> entry : levelMap.entrySet()) {
|
for (Map.Entry<Long, List<HseViolationLevel>> entry : levelMap.entrySet()) {
|
||||||
@ -235,9 +232,9 @@ public class OthYs7DeviceImgServiceImpl extends ServiceImpl<OthYs7DeviceImgMappe
|
|||||||
.toList();
|
.toList();
|
||||||
level.put(entry.getKey(), recognizerTypeEnums);
|
level.put(entry.getKey(), recognizerTypeEnums);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (CollUtil.isEmpty(level)) {
|
if (CollUtil.isEmpty(level)) {
|
||||||
log.error("未设置安全等级");
|
log.error("未设置安全等级");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
for (OthYs7DeviceImgCreateByCapture img : imgList) {
|
for (OthYs7DeviceImgCreateByCapture img : imgList) {
|
||||||
OthYs7DeviceImg othYs7DeviceImg = new OthYs7DeviceImg();
|
OthYs7DeviceImg othYs7DeviceImg = new OthYs7DeviceImg();
|
||||||
@ -253,9 +250,13 @@ public class OthYs7DeviceImgServiceImpl extends ServiceImpl<OthYs7DeviceImgMappe
|
|||||||
othYs7DeviceImg.setDeviceName(img.getDeviceName());
|
othYs7DeviceImg.setDeviceName(img.getDeviceName());
|
||||||
othYs7DeviceImg.setUrl(ossUrl);
|
othYs7DeviceImg.setUrl(ossUrl);
|
||||||
// 将抓取的图片进行识别
|
// 将抓取的图片进行识别
|
||||||
List<RecognizerTypeEnum> recTypes = level.get(img.getProjectId());
|
List<RecognizerTypeEnum> recTypes = new ArrayList<>();
|
||||||
|
if (CollUtil.isNotEmpty(level)) {
|
||||||
|
recTypes = level.get(img.getProjectId());
|
||||||
|
}
|
||||||
if (CollUtil.isEmpty(recTypes)) {
|
if (CollUtil.isEmpty(recTypes)) {
|
||||||
log.error("未设置安全等级");
|
log.error("项目:{},未设置安全等级", img.getProjectId());
|
||||||
|
saveList.add(othYs7DeviceImg);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
RecognizeVo recognizeVo = null;
|
RecognizeVo recognizeVo = null;
|
||||||
@ -301,12 +302,14 @@ public class OthYs7DeviceImgServiceImpl extends ServiceImpl<OthYs7DeviceImgMappe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (CollUtil.isNotEmpty(saveList)) {
|
if (CollUtil.isNotEmpty(saveList)) {
|
||||||
|
log.info("批量保存抓拍图片开始,共:{} 张", saveList.size());
|
||||||
boolean result = saveBatch(saveList);
|
boolean result = saveBatch(saveList);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
throw new ServiceException("批量新增图片失败,数据库异常", HttpStatus.ERROR);
|
throw new ServiceException("批量新增图片失败,数据库异常", HttpStatus.ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (CollUtil.isNotEmpty(recordList)) {
|
if (CollUtil.isNotEmpty(recordList)) {
|
||||||
|
log.info("批量保存识别记录开始,共:{} 条", recordList.size());
|
||||||
recognizeRecordService.saveByMonitor(recordList);
|
recognizeRecordService.saveByMonitor(recordList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user