Commit 0fac3996 authored by pengxin's avatar pengxin

Merge remote-tracking branch 'remotes/origin/master'

# Conflicts:
#	application-webadmin/src/main/java/com/yice/webadmin/app/controller/DatasetVersionController.java
#	zzlogs/application-webadmin/application-webadmin.log
parents 0512d02b 7b08ed31
...@@ -47,5 +47,13 @@ public class PythonConfig { ...@@ -47,5 +47,13 @@ public class PythonConfig {
*/ */
private String pythonWebsocketUri; private String pythonWebsocketUri;
/**
* python 输出控制地址
*/
private String controllerAddress;
/**
* 对话基础地址
*/
private String chatAddress;
} }
package com.yice.webadmin.app.config; package com.yice.webadmin.app.config;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.reactive.function.client.WebClient; import org.springframework.web.reactive.function.client.WebClient;
......
package com.yice.webadmin.app.controller; package com.yice.webadmin.app.controller;
import cn.hutool.core.io.FileUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.node.ObjectNode;
import com.github.pagehelper.page.PageMethod; import com.github.pagehelper.page.PageMethod;
...@@ -16,12 +19,10 @@ import com.yice.common.core.util.MyPageUtil; ...@@ -16,12 +19,10 @@ import com.yice.common.core.util.MyPageUtil;
import com.yice.common.log.annotation.OperationLog; import com.yice.common.log.annotation.OperationLog;
import com.yice.common.log.model.constant.SysOperationLogType; import com.yice.common.log.model.constant.SysOperationLogType;
import com.yice.webadmin.app.config.PythonConfig; import com.yice.webadmin.app.config.PythonConfig;
import com.yice.webadmin.app.data.DatasetData;
import com.yice.webadmin.app.dto.DatasetDetailDto; import com.yice.webadmin.app.dto.DatasetDetailDto;
import com.yice.webadmin.app.dto.DatasetVersionDto; import com.yice.webadmin.app.dto.DatasetVersionDto;
import com.yice.webadmin.app.model.DatasetDetail; import com.yice.webadmin.app.model.DatasetDetail;
import com.yice.webadmin.app.model.DatasetVersion; import com.yice.webadmin.app.model.DatasetVersion;
import com.yice.webadmin.app.service.DatasetDataService;
import com.yice.webadmin.app.service.DatasetVersionService; import com.yice.webadmin.app.service.DatasetVersionService;
import com.yice.webadmin.app.util.Sha1Util; import com.yice.webadmin.app.util.Sha1Util;
import com.yice.webadmin.app.vo.DatasetVersionVo; import com.yice.webadmin.app.vo.DatasetVersionVo;
...@@ -42,7 +43,10 @@ import java.nio.charset.StandardCharsets; ...@@ -42,7 +43,10 @@ import java.nio.charset.StandardCharsets;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.*; import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
/** /**
* 数据集版本操作控制器类。 * 数据集版本操作控制器类。
...@@ -59,8 +63,6 @@ public class DatasetVersionController { ...@@ -59,8 +63,6 @@ public class DatasetVersionController {
@Autowired @Autowired
private DatasetVersionService datasetVersionService; private DatasetVersionService datasetVersionService;
@Autowired @Autowired
private DatasetDataService datasetMongoService;
@Autowired
private PythonConfig pythonConfig; private PythonConfig pythonConfig;
/** /**
...@@ -198,9 +200,32 @@ public class DatasetVersionController { ...@@ -198,9 +200,32 @@ public class DatasetVersionController {
errorMessage = "数据操作失败,删除的对象不存在,请刷新后重试!"; errorMessage = "数据操作失败,删除的对象不存在,请刷新后重试!";
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage); return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
} }
try {
this.updateJsonFile(pythonConfig.getDatasetFileBaseDir() + pythonConfig.getDatasetInfo(),originalDatasetVersion.getVersionName());
} catch (IOException e) {
throw new RuntimeException(e);
}
FileUtil.del(originalDatasetVersion.getFileUrl());
return ResponseResult.success(); return ResponseResult.success();
} }
private void updateJsonFile(String filePath, String keyToRemove) throws IOException {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.enable(SerializationFeature.INDENT_OUTPUT);
File jsonFile = new File(filePath);
// 读取JSON文件
JsonNode rootNode = objectMapper.readTree(jsonFile);
// 删除指定键的对象
if (rootNode.isObject()) {
ObjectNode objectNode = (ObjectNode) rootNode;
objectNode.remove(keyToRemove);
} else {
log.error("Root node is not an object.");
}
// 将更新后的JSON写回文件
objectMapper.writeValue(jsonFile, rootNode);
}
@PostMapping(value = "/detail") @PostMapping(value = "/detail")
public ResponseResult<MyPageData<String>> detail(@MyRequestBody Long versionId, public ResponseResult<MyPageData<String>> detail(@MyRequestBody Long versionId,
@MyRequestBody MyPageParam pageParam) throws IOException { @MyRequestBody MyPageParam pageParam) throws IOException {
...@@ -233,7 +258,6 @@ public class DatasetVersionController { ...@@ -233,7 +258,6 @@ public class DatasetVersionController {
@OperationLog(type = SysOperationLogType.IMPORT) @OperationLog(type = SysOperationLogType.IMPORT)
@PostMapping("/import") @PostMapping("/import")
public ResponseResult<Void> importFile( public ResponseResult<Void> importFile(
@RequestParam Long datasetId,
@RequestParam Long versionId, @RequestParam Long versionId,
@RequestParam("importFile") MultipartFile importFile) throws IOException { @RequestParam("importFile") MultipartFile importFile) throws IOException {
String errorMessage; String errorMessage;
...@@ -242,7 +266,11 @@ public class DatasetVersionController { ...@@ -242,7 +266,11 @@ public class DatasetVersionController {
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST, errorMessage); return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST, errorMessage);
} }
DatasetVersion datasetVersion = this.datasetVersionService.getById(versionId); DatasetVersion datasetVersion = this.datasetVersionService.getById(versionId);
String fullName = this.saveDatasetFile(importFile, datasetVersion.getVersionName(),versionId); String versionName = datasetVersion.getVersionName();
//先存储文件
String fullName = this.saveDatasetFile(importFile, versionName);
//再存储数据集配置文件
this.saveDatasetInfo(versionName);
datasetVersion.setFileUrl(fullName); datasetVersion.setFileUrl(fullName);
datasetVersion.setInputStatus(1); datasetVersion.setInputStatus(1);
datasetVersion.setDataVolume(Long.valueOf(JSON.parseArray(new String(importFile.getBytes(), StandardCharsets.UTF_8)).size())); datasetVersion.setDataVolume(Long.valueOf(JSON.parseArray(new String(importFile.getBytes(), StandardCharsets.UTF_8)).size()));
...@@ -250,17 +278,35 @@ public class DatasetVersionController { ...@@ -250,17 +278,35 @@ public class DatasetVersionController {
return ResponseResult.success(); return ResponseResult.success();
} }
private void saveDatasetInfo(String versionName) throws IOException {
File file = new File(pythonConfig.getDatasetFileBaseDir(), pythonConfig.getDatasetInfo());
if (!file.exists()) {
file.createNewFile();
}
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.enable(SerializationFeature.INDENT_OUTPUT);
JsonNode rootNode = objectMapper.readTree(file);
if (rootNode == null || rootNode.isNull() || rootNode.size() < 1) {
rootNode = objectMapper.createObjectNode();
}
//此处应该要做键值映射关系,目前没做,后面需要修改
JSONObject jsonObject = new JSONObject();
jsonObject.put("file_name", versionName + ".json");
jsonObject.put("file_sha1", Sha1Util.getSha1(versionName));
((ObjectNode) rootNode).set(versionName, objectMapper.readTree(jsonObject.toJSONString()));
objectMapper.writeValue(new File(pythonConfig.getDatasetFileBaseDir(), pythonConfig.getDatasetInfo()), rootNode);
}
/** /**
* 保存导入文件。 * 保存导入文件。
* *
* @param importFile 导入的文件。 * @param importFile 导入的文件。
* @return 保存的本地文件名。 * @return 保存的本地文件名。
*/ */
private String saveDatasetFile(MultipartFile importFile, String versionName, Long versionId) throws IOException { private String saveDatasetFile(MultipartFile importFile, String versionName) throws IOException {
String fullName = pythonConfig.getDatasetFileBaseDir() + versionName + ".json"; String fullName = pythonConfig.getDatasetFileBaseDir() + versionName + ".json";
byte[] bytes = null;
try { try {
bytes = importFile.getBytes(); byte[] bytes = importFile.getBytes();
Path path = Paths.get(fullName); Path path = Paths.get(fullName);
// 如果没有files文件夹,则创建 // 如果没有files文件夹,则创建
if (!Files.isWritable(path)) { if (!Files.isWritable(path)) {
...@@ -272,35 +318,6 @@ public class DatasetVersionController { ...@@ -272,35 +318,6 @@ public class DatasetVersionController {
log.error("Failed to write imported file [" + importFile.getOriginalFilename() + " ].", e); log.error("Failed to write imported file [" + importFile.getOriginalFilename() + " ].", e);
throw e; throw e;
} }
try {
// 或者指定字符集进行转换,替换"UTF-8"为你想要使用的字符集
String result = new String(bytes, "UTF-8");
//先删除数据集
datasetMongoService.delete(versionId);
//保存到mongodb中
datasetMongoService.save(new DatasetData(null, versionId, result, new Date()));
}catch (Exception ex) {
log.error("Failed to write mongodb database [" + importFile.getOriginalFilename() + " ].", ex);
throw ex;
}
File file = new File(pythonConfig.getDatasetFileBaseDir(), pythonConfig.getDatasetInfo());
if (!file.exists()){
file.createNewFile();
}
ObjectMapper objectMapper = new ObjectMapper();
JsonNode rootNode = objectMapper.readTree(file);
if (rootNode == null || rootNode.isNull() || rootNode.size() < 1) {
rootNode = objectMapper.createObjectNode();
}
//此处应该要做键值映射关系,目前没做,后面需要修改
String fieldValue = "{\"file_name\":\"" + versionName + ".json\",\"file_sha1\":\"" + Sha1Util.getSha1(versionName) + "\"}";
((ObjectNode) rootNode).put(versionName, objectMapper.readTree(fieldValue));
objectMapper.writeValue(new File(pythonConfig.getDatasetFileBaseDir(), pythonConfig.getDatasetInfo()), rootNode);
return fullName; return fullName;
} }
......
...@@ -66,7 +66,7 @@ public class KnowledgeManageController { ...@@ -66,7 +66,7 @@ public class KnowledgeManageController {
String requestBody = "{\n" + " \"knowledge_base_name\": \"" + knowledgeManage.getKnowledgeName() + "\",\n" + " \"vector_store_type\": \"faiss\",\n" + " \"embed_model\": \"m3e-base\"\n" + "}"; String requestBody = "{\n" + " \"knowledge_base_name\": \"" + knowledgeManage.getKnowledgeName() + "\",\n" + " \"vector_store_type\": \"faiss\",\n" + " \"embed_model\": \"m3e-base\"\n" + "}";
try { try {
String result = proxyPythonService.predictPost(knowledgeConfig.getKnowledgeInterface() + knowledgeConfig.getCreate(), requestBody); String result = proxyPythonService.predictPost(knowledgeConfig.getKnowledgeInterface() + knowledgeConfig.getCreate(), requestBody);
JSONObject jo = (JSONObject) JSON.parse(result); JSONObject jo = JSON.parseObject(result);
Integer code = jo.getIntValue("code"); Integer code = jo.getIntValue("code");
String msg = jo.getString("msg"); String msg = jo.getString("msg");
String data = jo.getString("data"); String data = jo.getString("data");
...@@ -172,7 +172,7 @@ public class KnowledgeManageController { ...@@ -172,7 +172,7 @@ public class KnowledgeManageController {
String result = null; String result = null;
try { try {
result = this.proxyPythonService.predictPost(this.knowledgeConfig.getKnowledgeInterface() + knowledgeConfig.getDeleteDocs(), requestBody); result = this.proxyPythonService.predictPost(this.knowledgeConfig.getKnowledgeInterface() + knowledgeConfig.getDeleteDocs(), requestBody);
JSONObject jo = (JSONObject) JSON.parse(result); JSONObject jo = JSON.parseObject(result);
Integer code = jo.getIntValue("code"); Integer code = jo.getIntValue("code");
String msg = jo.getString("msg"); String msg = jo.getString("msg");
String data = jo.getString("data"); String data = jo.getString("data");
...@@ -200,7 +200,7 @@ public class KnowledgeManageController { ...@@ -200,7 +200,7 @@ public class KnowledgeManageController {
String result = null; String result = null;
try { try {
result = this.proxyPythonService.predictPost(this.knowledgeConfig.getKnowledgeInterface() + knowledgeConfig.getUpdateDocs(), requestBody); result = this.proxyPythonService.predictPost(this.knowledgeConfig.getKnowledgeInterface() + knowledgeConfig.getUpdateDocs(), requestBody);
JSONObject jo = (JSONObject) JSON.parse(result); JSONObject jo = JSON.parseObject(result);
Integer code = jo.getIntValue("code"); Integer code = jo.getIntValue("code");
String msg = jo.getString("msg"); String msg = jo.getString("msg");
String data = jo.getString("data"); String data = jo.getString("data");
...@@ -228,7 +228,7 @@ public class KnowledgeManageController { ...@@ -228,7 +228,7 @@ public class KnowledgeManageController {
String result = null; String result = null;
try { try {
result = this.proxyPythonService.predictPostForFile(this.knowledgeConfig.getKnowledgeInterface() + knowledgeConfig.getUploadDocs(), requestBody); result = this.proxyPythonService.predictPostForFile(this.knowledgeConfig.getKnowledgeInterface() + knowledgeConfig.getUploadDocs(), requestBody);
JSONObject jo = (JSONObject) JSON.parse(result); JSONObject jo = JSON.parseObject(result);
Integer code = jo.getIntValue("code"); Integer code = jo.getIntValue("code");
String msg = jo.getString("msg"); String msg = jo.getString("msg");
String data = jo.getString("data"); String data = jo.getString("data");
...@@ -265,7 +265,7 @@ public class KnowledgeManageController { ...@@ -265,7 +265,7 @@ public class KnowledgeManageController {
private ResponseResult<String> doDeleteByName(String knowledgeName) { private ResponseResult<String> doDeleteByName(String knowledgeName) {
try { try {
String result = this.proxyPythonService.predictPost(this.knowledgeConfig.getKnowledgeInterface() + this.knowledgeConfig.getDelete(), "\"" + knowledgeName + "\""); String result = this.proxyPythonService.predictPost(this.knowledgeConfig.getKnowledgeInterface() + this.knowledgeConfig.getDelete(), "\"" + knowledgeName + "\"");
JSONObject jo = (JSONObject) JSON.parse(result); JSONObject jo = JSON.parseObject(result);
Integer code = jo.getIntValue("code"); Integer code = jo.getIntValue("code");
String msg = jo.getString("msg"); String msg = jo.getString("msg");
String data = jo.getString("data"); String data = jo.getString("data");
...@@ -298,7 +298,7 @@ public class KnowledgeManageController { ...@@ -298,7 +298,7 @@ public class KnowledgeManageController {
List<KnowledgeManage> reKnowledgeManageList = new ArrayList<>(); List<KnowledgeManage> reKnowledgeManageList = new ArrayList<>();
try { try {
String result = this.proxyPythonService.predictGet(this.knowledgeConfig.getKnowledgeInterface() + this.knowledgeConfig.getList(), ""); String result = this.proxyPythonService.predictGet(this.knowledgeConfig.getKnowledgeInterface() + this.knowledgeConfig.getList(), "");
JSONObject jo = (JSONObject) JSON.parse(result); JSONObject jo = JSON.parseObject(result);
Integer code = jo.getIntValue("code"); Integer code = jo.getIntValue("code");
JSONArray jsonArray = jo.getJSONArray("data"); JSONArray jsonArray = jo.getJSONArray("data");
if (code != null && code == 200) { if (code != null && code == 200) {
...@@ -329,7 +329,7 @@ public class KnowledgeManageController { ...@@ -329,7 +329,7 @@ public class KnowledgeManageController {
List<KnowledgeManage> reKnowledgeManageList = new ArrayList<>(); List<KnowledgeManage> reKnowledgeManageList = new ArrayList<>();
try { try {
String result = this.proxyPythonService.predictGet(this.knowledgeConfig.getKnowledgeInterface() + this.knowledgeConfig.getList(), ""); String result = this.proxyPythonService.predictGet(this.knowledgeConfig.getKnowledgeInterface() + this.knowledgeConfig.getList(), "");
JSONObject jo = (JSONObject) JSON.parse(result); JSONObject jo = JSON.parseObject(result);
Integer code = jo.getIntValue("code"); Integer code = jo.getIntValue("code");
JSONArray jsonArray = jo.getJSONArray("data"); JSONArray jsonArray = jo.getJSONArray("data");
if (code != null && code == 200) { if (code != null && code == 200) {
...@@ -377,7 +377,7 @@ public class KnowledgeManageController { ...@@ -377,7 +377,7 @@ public class KnowledgeManageController {
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
JSONObject jo = (JSONObject) JSON.parse(result); JSONObject jo = JSON.parseObject(result);
Integer code = jo.getIntValue("code"); Integer code = jo.getIntValue("code");
String msg = jo.getString("msg"); String msg = jo.getString("msg");
JSONArray jsonArray = jo.getJSONArray("data"); JSONArray jsonArray = jo.getJSONArray("data");
......
...@@ -16,7 +16,6 @@ import com.yice.webadmin.app.dto.ModelCompressDto; ...@@ -16,7 +16,6 @@ import com.yice.webadmin.app.dto.ModelCompressDto;
import com.yice.webadmin.app.dto.ModelTaskDto; import com.yice.webadmin.app.dto.ModelTaskDto;
import com.yice.webadmin.app.model.ModelCompress; import com.yice.webadmin.app.model.ModelCompress;
import com.yice.webadmin.app.model.ModelTask; import com.yice.webadmin.app.model.ModelTask;
import com.yice.webadmin.app.model.ModelVersion;
import com.yice.webadmin.app.service.ModelCompressService; import com.yice.webadmin.app.service.ModelCompressService;
import com.yice.webadmin.app.service.ModelTaskService; import com.yice.webadmin.app.service.ModelTaskService;
import com.yice.webadmin.app.service.ModelVersionService; import com.yice.webadmin.app.service.ModelVersionService;
...@@ -52,30 +51,19 @@ public class ModelCompressController { ...@@ -52,30 +51,19 @@ public class ModelCompressController {
* 新增模型压缩数据,及其关联的从表数据。 * 新增模型压缩数据,及其关联的从表数据。
* *
* @param modelCompressDto 新增主表对象。 * @param modelCompressDto 新增主表对象。
* @param modelTaskDto 一对一模型任务从表Dto。
* @return 应答结果对象,包含新增对象主键Id。 * @return 应答结果对象,包含新增对象主键Id。
*/ */
@ApiOperationSupport(ignoreParameters = {"modelCompressDto.taskId", "modelCompressDto.searchString"}) @ApiOperationSupport(ignoreParameters = {"modelCompressDto.taskId", "modelCompressDto.searchString"})
@OperationLog(type = SysOperationLogType.ADD) @OperationLog(type = SysOperationLogType.ADD)
@PostMapping("/add") @PostMapping("/add")
public ResponseResult<Long> add( public ResponseResult<Long> add(
@MyRequestBody ModelCompressDto modelCompressDto, @MyRequestBody ModelCompressDto modelCompressDto) {
@MyRequestBody ModelTaskDto modelTaskDto) { String errorMessage = MyCommonUtil.getModelValidationError(modelCompressDto, false);
Long modelVersionId = modelCompressDto.getSourceVersionId(); if (errorMessage != null) {
ModelVersion modelVersion = this.modelVersionService.getById(modelVersionId); return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
modelTaskDto.setVersionId(modelVersion.getVersionId());
modelTaskDto.setTaskType(2);
modelTaskDto.setModelId(modelVersion.getModelId());
modelTaskDto.setModelVersion(modelVersion.getModelVersion());
modelTaskDto.setVersionName(modelVersion.getVersionName());
ResponseResult<Tuple2<ModelCompress, JSONObject>> verifyResult =
this.doBusinessDataVerifyAndConvert(modelCompressDto, false, modelTaskDto);
if (!verifyResult.isSuccess()) {
return ResponseResult.errorFrom(verifyResult);
} }
Tuple2<ModelCompress, JSONObject> bizData = verifyResult.getData(); ModelCompress modelCompress = MyModelUtil.copyTo(modelCompressDto, ModelCompress.class);
ModelCompress modelCompress = bizData.getFirst(); modelCompress = modelCompressService.saveNew(modelCompress);
modelCompress = modelCompressService.saveNewWithRelation(modelCompress, bizData.getSecond());
return ResponseResult.success(modelCompress.getTaskId()); return ResponseResult.success(modelCompress.getTaskId());
} }
......
...@@ -75,23 +75,12 @@ public class ModelEstimateController { ...@@ -75,23 +75,12 @@ public class ModelEstimateController {
@PostMapping("/add") @PostMapping("/add")
public ResponseResult<Long> add( public ResponseResult<Long> add(
@MyRequestBody ModelEstimateDto modelEstimateDto) { @MyRequestBody ModelEstimateDto modelEstimateDto) {
modelEstimateDto.setTaskStatus(0); String errorMessage = MyCommonUtil.getModelValidationError(modelEstimateDto, false);
Long modelVersionId = modelEstimateDto.getModelVersionId(); if (errorMessage != null) {
ModelVersion modelVersion = this.modelVersionService.getById(modelVersionId); return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
ModelTaskDto modelTaskDto = new ModelTaskDto();
modelTaskDto.setVersionId(modelVersion.getVersionId());
modelTaskDto.setTaskType(1);
modelTaskDto.setModelId(modelVersion.getModelId());
modelTaskDto.setModelVersion(modelVersion.getModelVersion());
modelTaskDto.setVersionName(modelVersion.getVersionName());
ResponseResult<Tuple2<ModelEstimate, JSONObject>> verifyResult =
this.doBusinessDataVerifyAndConvert(modelEstimateDto, false, modelTaskDto);
if (!verifyResult.isSuccess()) {
return ResponseResult.errorFrom(verifyResult);
} }
Tuple2<ModelEstimate, JSONObject> bizData = verifyResult.getData(); ModelEstimate modelEstimate = MyModelUtil.copyTo(modelEstimateDto, ModelEstimate.class);
ModelEstimate modelEstimate = bizData.getFirst(); modelEstimate = modelEstimateService.saveNew(modelEstimate);
modelEstimate = modelEstimateService.saveNewWithRelation(modelEstimate, bizData.getSecond());
return ResponseResult.success(modelEstimate.getTaskId()); return ResponseResult.success(modelEstimate.getTaskId());
} }
...@@ -102,7 +91,7 @@ public class ModelEstimateController { ...@@ -102,7 +91,7 @@ public class ModelEstimateController {
* @return 应答结果对象。 * @return 应答结果对象。
*/ */
@GetMapping("/getPreviewCommand") @GetMapping("/getPreviewCommand")
public ResponseResult<String> getPreviewCommand(@RequestParam Long taskId) { public ResponseResult<JSONArray> getPreviewCommand(@RequestParam Long taskId) {
ModelEstimate modelEstimate = this.modelEstimateService.getById(taskId); ModelEstimate modelEstimate = this.modelEstimateService.getById(taskId);
ModelVersion modelVersion = this.modelVersionService.getById(modelEstimate.getModelVersionId()); ModelVersion modelVersion = this.modelVersionService.getById(modelEstimate.getModelVersionId());
DatasetVersion datasetVersion = this.datasetVersionService.getById(modelEstimate.getDatasetVersionId()); DatasetVersion datasetVersion = this.datasetVersionService.getById(modelEstimate.getDatasetVersionId());
...@@ -132,8 +121,8 @@ public class ModelEstimateController { ...@@ -132,8 +121,8 @@ public class ModelEstimateController {
array.add(jsonObject.get("ToppSamplingValue")); array.add(jsonObject.get("ToppSamplingValue"));
array.add(jsonObject.get("temperatureCoefficient")); array.add(jsonObject.get("temperatureCoefficient"));
array.add(this.pythonConfig.getModelEstimateFileBaseDir() + modelVersion.getVersionName() + File.separator + "evl_" + taskId); array.add(this.pythonConfig.getModelEstimateFileBaseDir() + modelVersion.getVersionName() + File.separator + "evl_" + taskId);
System.out.println(array.toJSONString()); System.out.println(array);
return ResponseResult.success(array.toJSONString()); return ResponseResult.success(array);
} }
/** /**
...@@ -155,7 +144,7 @@ public class ModelEstimateController { ...@@ -155,7 +144,7 @@ public class ModelEstimateController {
} }
modelEstimate.setTaskStatus(taskStatus); modelEstimate.setTaskStatus(taskStatus);
modelEstimate.setUpdateTime(new Date()); modelEstimate.setUpdateTime(new Date());
if (!modelEstimateService.updateById(modelEstimate)) { if (!modelEstimateService.updateStatusById(modelEstimate)) {
errorMessage = "任务状态信息提交错误!"; errorMessage = "任务状态信息提交错误!";
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage); return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
} }
......
package com.yice.webadmin.app.controller; package com.yice.webadmin.app.controller;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.page.PageMethod; import com.github.pagehelper.page.PageMethod;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.yice.common.core.annotation.MyRequestBody; import com.yice.common.core.annotation.MyRequestBody;
...@@ -20,7 +19,7 @@ import com.yice.webadmin.app.model.ModelManage; ...@@ -20,7 +19,7 @@ import com.yice.webadmin.app.model.ModelManage;
import com.yice.webadmin.app.model.ModelTask; import com.yice.webadmin.app.model.ModelTask;
import com.yice.webadmin.app.model.ModelVersion; import com.yice.webadmin.app.model.ModelVersion;
import com.yice.webadmin.app.service.ModelManageService; import com.yice.webadmin.app.service.ModelManageService;
import com.yice.webadmin.app.service.ModelVersionService; import com.yice.webadmin.app.service.TuningRunService;
import com.yice.webadmin.app.vo.ModelManageVo; import com.yice.webadmin.app.vo.ModelManageVo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -44,7 +43,8 @@ public class ModelManageController { ...@@ -44,7 +43,8 @@ public class ModelManageController {
@Autowired @Autowired
private ModelManageService modelManageService; private ModelManageService modelManageService;
@Autowired @Autowired
private ModelVersionService modelVersionService; private TuningRunService tuningRunService;
/** /**
* 新增模型管理数据,及其关联的从表数据。 * 新增模型管理数据,及其关联的从表数据。
...@@ -64,7 +64,7 @@ public class ModelManageController { ...@@ -64,7 +64,7 @@ public class ModelManageController {
} }
ModelManage modelManage = MyModelUtil.copyTo(modelManageDto, ModelManage.class); ModelManage modelManage = MyModelUtil.copyTo(modelManageDto, ModelManage.class);
ModelVersion modelVersion = MyModelUtil.copyTo(modelVersionDto, ModelVersion.class); ModelVersion modelVersion = MyModelUtil.copyTo(modelVersionDto, ModelVersion.class);
modelManage = modelManageService.saveAndCreateVersion(modelManage, modelVersion); modelManage = this.tuningRunService.createToModel(modelManage, modelVersion);
return ResponseResult.success(modelManage.getModelId()); return ResponseResult.success(modelManage.getModelId());
} }
...@@ -108,6 +108,7 @@ public class ModelManageController { ...@@ -108,6 +108,7 @@ public class ModelManageController {
return ResponseResult.success(ModelManage.INSTANCE.fromModelList(modelManageList)); return ResponseResult.success(ModelManage.INSTANCE.fromModelList(modelManageList));
} }
/** /**
* 删除模型管理数据。 * 删除模型管理数据。
* *
......
package com.yice.webadmin.app.controller; package com.yice.webadmin.app.controller;
import cn.hutool.core.io.FileUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.page.PageMethod; import com.github.pagehelper.page.PageMethod;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.yice.common.core.annotation.MyRequestBody; import com.yice.common.core.annotation.MyRequestBody;
...@@ -10,15 +14,19 @@ import com.yice.common.core.util.MyModelUtil; ...@@ -10,15 +14,19 @@ import com.yice.common.core.util.MyModelUtil;
import com.yice.common.core.util.MyPageUtil; import com.yice.common.core.util.MyPageUtil;
import com.yice.common.log.annotation.OperationLog; import com.yice.common.log.annotation.OperationLog;
import com.yice.common.log.model.constant.SysOperationLogType; import com.yice.common.log.model.constant.SysOperationLogType;
import com.yice.webadmin.app.config.PythonConfig;
import com.yice.webadmin.app.dto.ModelVersionDto; import com.yice.webadmin.app.dto.ModelVersionDto;
import com.yice.webadmin.app.model.ModelVersion; import com.yice.webadmin.app.model.ModelVersion;
import com.yice.webadmin.app.service.ModelVersionService; import com.yice.webadmin.app.service.ModelVersionService;
import com.yice.webadmin.app.service.ProxyPythonService;
import com.yice.webadmin.app.service.TuningRunService;
import com.yice.webadmin.app.vo.ModelVersionVo; import com.yice.webadmin.app.vo.ModelVersionVo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.util.List; import java.util.List;
/** /**
...@@ -35,6 +43,13 @@ public class ModelVersionController { ...@@ -35,6 +43,13 @@ public class ModelVersionController {
@Autowired @Autowired
private ModelVersionService modelVersionService; private ModelVersionService modelVersionService;
@Autowired
private PythonConfig pythonConfig;
@Autowired
private ProxyPythonService proxyPythonService;
@Autowired
private TuningRunService tuningRunService;
/** /**
* 新增模型版本数据。 * 新增模型版本数据。
...@@ -56,7 +71,7 @@ public class ModelVersionController { ...@@ -56,7 +71,7 @@ public class ModelVersionController {
if (!callResult.isSuccess()) { if (!callResult.isSuccess()) {
return ResponseResult.errorFrom(callResult); return ResponseResult.errorFrom(callResult);
} }
modelVersion = modelVersionService.saveNew(modelVersion); modelVersion = this.tuningRunService.createToModelVersion(modelVersion);
return ResponseResult.success(modelVersion.getVersionId()); return ResponseResult.success(modelVersion.getVersionId());
} }
...@@ -106,6 +121,72 @@ public class ModelVersionController { ...@@ -106,6 +121,72 @@ public class ModelVersionController {
return this.doDelete(versionId); return this.doDelete(versionId);
} }
/**
* 列出符合过滤条件的模型管理列表。
*
* @return 应答结果对象,包含查询结果集。
*/
@PostMapping("/change")
public ResponseResult<String> change(@MyRequestBody Long versionId) throws IOException {
ModelVersion modelVersion = this.modelVersionService.getById(versionId);
JSONObject jsonObject = new JSONObject();
jsonObject.put("new_model_name", modelVersion.getVersionName());
jsonObject.put("new_model_path", modelVersion.getModelUrl());
jsonObject.put("template", modelVersion.getBasePromptTemplate());
jsonObject.put("finetuning_type", modelVersion.getModelTrainingMethod());
String url = this.pythonConfig.getChatAddress() + "llm_model/change";
String result = proxyPythonService.predictPost(url, jsonObject.toJSONString());
JSONObject jo = JSON.parseObject(result);
Integer code = jo.getIntValue("code");
String msg = jo.getString("msg");
String data = jo.getString("data");
if (code != null && code == 200) {
return ResponseResult.success(msg);
} else {
return ResponseResult.create(ErrorCodeEnum.SERVER_INTERNAL_ERROR, msg, data);
}
}
/**
* 停止指定的LLM模型(Model Worker)
*
* @return 应答结果对象,包含查询结果集。
*/
@PostMapping("/stop")
public ResponseResult<String> stop() throws IOException {
String url = this.pythonConfig.getChatAddress() + "llm_model/stop";
String result = proxyPythonService.predictPost(url, "");
JSONObject jo = JSON.parseObject(result);
Integer code = jo.getIntValue("code");
String msg = jo.getString("msg");
String data = jo.getString("data");
if (code != null && code == 200) {
return ResponseResult.success(msg);
} else {
return ResponseResult.create(ErrorCodeEnum.SERVER_INTERNAL_ERROR, msg, data);
}
}
/**
* 列出当前已加载的模型。
*
* @return 应答结果对象,包含查询结果集。
*/
@PostMapping("/listModels")
public ResponseResult<JSONArray> listModels() throws IOException {
String url = this.pythonConfig.getChatAddress() + "llm_model/list_models";
String result = proxyPythonService.predictPost(url, "");
JSONObject jo = JSON.parseObject(result);
Integer code = jo.getIntValue("code");
String msg = jo.getString("msg");
if (code != null && code == 200) {
return ResponseResult.create(ErrorCodeEnum.NO_ERROR, msg, jo.getJSONArray("data"));
} else {
return ResponseResult.create(ErrorCodeEnum.SERVER_INTERNAL_ERROR, msg, null);
}
}
/** /**
* 列出符合过滤条件的模型版本列表。 * 列出符合过滤条件的模型版本列表。
* *
...@@ -170,6 +251,7 @@ public class ModelVersionController { ...@@ -170,6 +251,7 @@ public class ModelVersionController {
errorMessage = "数据操作失败,删除的对象不存在,请刷新后重试!"; errorMessage = "数据操作失败,删除的对象不存在,请刷新后重试!";
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage); return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
} }
FileUtil.del(originalModelVersion.getModelUrl());
return ResponseResult.success(); return ResponseResult.success();
} }
} }
...@@ -10,11 +10,15 @@ import com.yice.common.core.util.MyModelUtil; ...@@ -10,11 +10,15 @@ import com.yice.common.core.util.MyModelUtil;
import com.yice.common.core.util.MyPageUtil; import com.yice.common.core.util.MyPageUtil;
import com.yice.common.log.annotation.OperationLog; import com.yice.common.log.annotation.OperationLog;
import com.yice.common.log.model.constant.SysOperationLogType; import com.yice.common.log.model.constant.SysOperationLogType;
import com.yice.webadmin.app.dto.ModelManageDto;
import com.yice.webadmin.app.dto.PromptTemplateDto; import com.yice.webadmin.app.dto.PromptTemplateDto;
import com.yice.webadmin.app.model.ModelManage;
import com.yice.webadmin.app.model.ModelVersion;
import com.yice.webadmin.app.model.PromptTemplate; import com.yice.webadmin.app.model.PromptTemplate;
import com.yice.webadmin.app.model.PromptTemplateCollect; import com.yice.webadmin.app.model.PromptTemplateCollect;
import com.yice.webadmin.app.service.PromptTemplateCollectService; import com.yice.webadmin.app.service.PromptTemplateCollectService;
import com.yice.webadmin.app.service.PromptTemplateService; import com.yice.webadmin.app.service.PromptTemplateService;
import com.yice.webadmin.app.vo.ModelManageVo;
import com.yice.webadmin.app.vo.PromptTemplateVo; import com.yice.webadmin.app.vo.PromptTemplateVo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -135,6 +139,19 @@ public class PromptTemplateController { ...@@ -135,6 +139,19 @@ public class PromptTemplateController {
return ResponseResult.success(MyPageUtil.makeResponseData(promptTemplateList, PromptTemplate.INSTANCE)); return ResponseResult.success(MyPageUtil.makeResponseData(promptTemplateList, PromptTemplate.INSTANCE));
} }
/**
* 列出符合过滤条件的模型管理列表。
*
* @return 应答结果对象,包含查询结果集。
*/
@PostMapping("/listForTree")
public ResponseResult<List<PromptTemplateVo>> listForTree(@MyRequestBody PromptTemplateDto promptTemplateDtoFilter) {
PromptTemplate promptTemplateFilter = MyModelUtil.copyTo(promptTemplateDtoFilter, PromptTemplate.class);
List<PromptTemplate> promptTemplateList =
promptTemplateService.getPromptTemplateList(promptTemplateFilter, "");
return ResponseResult.success(PromptTemplate.INSTANCE.fromModelList(promptTemplateList));
}
/** /**
* 列出符合过滤条件的提示词模板列表。 * 列出符合过滤条件的提示词模板列表。
* *
......
...@@ -49,6 +49,6 @@ public class ProxyPythonController { ...@@ -49,6 +49,6 @@ public class ProxyPythonController {
@OperationLog(type = SysOperationLogType.OTHER) @OperationLog(type = SysOperationLogType.OTHER)
@PostMapping("/predict") @PostMapping("/predict")
public ResponseResult<String> predict(@RequestBody String requestBody) throws IOException { public ResponseResult<String> predict(@RequestBody String requestBody) throws IOException {
return ResponseResult.success(this.proxyPythonService.predictPost(pythonConfig.getFactoryInterface(),requestBody)); return ResponseResult.success(this.proxyPythonService.predictPost(pythonConfig.getFactoryInterface(), requestBody));
} }
} }
...@@ -49,6 +49,6 @@ public class ReceivePythonController { ...@@ -49,6 +49,6 @@ public class ReceivePythonController {
@OperationLog(type = SysOperationLogType.OTHER) @OperationLog(type = SysOperationLogType.OTHER)
@PostMapping("/predict") @PostMapping("/predict")
public ResponseResult<String> predict(@RequestBody String requestBody) throws IOException { public ResponseResult<String> predict(@RequestBody String requestBody) throws IOException {
return ResponseResult.success(this.proxyPythonService.predictPost(pythonConfig.getFactoryInterface(),requestBody)); return ResponseResult.success(this.proxyPythonService.predictPost(pythonConfig.getFactoryInterface(), requestBody));
} }
} }
...@@ -55,12 +55,10 @@ public class TuningRunController { ...@@ -55,12 +55,10 @@ public class TuningRunController {
@Autowired @Autowired
private ModelVersionService modelVersionService; private ModelVersionService modelVersionService;
@Autowired @Autowired
private ModelManageService modelManageService; private ModelTaskService modelTaskService;
@Autowired @Autowired
private DatasetVersionService datasetVersionService; private DatasetVersionService datasetVersionService;
@Autowired @Autowired
private DatasetManageService datasetManageService;
@Autowired
private PythonConfig pythonConfig; private PythonConfig pythonConfig;
/** /**
...@@ -144,7 +142,7 @@ public class TuningRunController { ...@@ -144,7 +142,7 @@ public class TuningRunController {
* @return 应答结果对象。 * @return 应答结果对象。
*/ */
@GetMapping("/getPreviewCommand") @GetMapping("/getPreviewCommand")
public ResponseResult<String> getPreviewCommand(@RequestParam Long runId) { public ResponseResult<JSONArray> getPreviewCommand(@RequestParam Long runId) {
TuningRun tuningRun = this.tuningRunService.getById(runId); TuningRun tuningRun = this.tuningRunService.getById(runId);
ModelVersion modelVersion = this.modelVersionService.getById(tuningRun.getModelVersionId()); ModelVersion modelVersion = this.modelVersionService.getById(tuningRun.getModelVersionId());
DatasetVersion datasetVersion = this.datasetVersionService.getById(tuningRun.getDatasetVersionId()); DatasetVersion datasetVersion = this.datasetVersionService.getById(tuningRun.getDatasetVersionId());
...@@ -190,8 +188,8 @@ public class TuningRunController { ...@@ -190,8 +188,8 @@ public class TuningRunController {
array.add(jsonObject.get("dpoBetaData")); array.add(jsonObject.get("dpoBetaData"));
array.add(new JSONArray()); array.add(new JSONArray());
array.add("train_" + runId); array.add("train_" + runId);
System.out.println(array.toJSONString()); System.out.println(array);
return ResponseResult.success(array.toJSONString()); return ResponseResult.success(array);
} }
/** /**
...@@ -283,7 +281,7 @@ public class TuningRunController { ...@@ -283,7 +281,7 @@ public class TuningRunController {
tuningRun.setRunStatus(runStatus); tuningRun.setRunStatus(runStatus);
tuningRun.setRunTime(runTime); tuningRun.setRunTime(runTime);
tuningRun.setUpdateTime(new Date()); tuningRun.setUpdateTime(new Date());
if (!tuningRunService.updateById(tuningRun)) { if (!tuningRunService.updateStatusById(tuningRun)) {
errorMessage = "运行状态信息提交错误!"; errorMessage = "运行状态信息提交错误!";
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage); return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
} }
......
...@@ -4,7 +4,7 @@ import com.yice.common.core.base.dao.BaseDaoMapper; ...@@ -4,7 +4,7 @@ import com.yice.common.core.base.dao.BaseDaoMapper;
import com.yice.webadmin.app.model.KnowledgeManage; import com.yice.webadmin.app.model.KnowledgeManage;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.*; import java.util.List;
/** /**
* 知识库管理数据操作访问接口。 * 知识库管理数据操作访问接口。
...@@ -25,7 +25,7 @@ public interface KnowledgeManageMapper extends BaseDaoMapper<KnowledgeManage> { ...@@ -25,7 +25,7 @@ public interface KnowledgeManageMapper extends BaseDaoMapper<KnowledgeManage> {
* 获取过滤后的对象列表。 * 获取过滤后的对象列表。
* *
* @param knowledgeManageFilter 主表过滤对象。 * @param knowledgeManageFilter 主表过滤对象。
* @param orderBy 排序字符串,order by从句的参数。 * @param orderBy 排序字符串,order by从句的参数。
* @return 对象列表。 * @return 对象列表。
*/ */
List<KnowledgeManage> getKnowledgeManageList( List<KnowledgeManage> getKnowledgeManageList(
......
...@@ -13,15 +13,15 @@ ...@@ -13,15 +13,15 @@
<insert id="insertList"> <insert id="insertList">
INSERT INTO lmp_knowledge_manage INSERT INTO lmp_knowledge_manage
(knowledge_id, (knowledge_id,
create_user_id, create_user_id,
create_time, create_time,
update_user_id, update_user_id,
update_time, update_time,
knowledge_name, knowledge_name,
knowledge_describe) knowledge_describe)
VALUES VALUES
<foreach collection="list" index="index" item="item" separator="," > <foreach collection="list" index="index" item="item" separator=",">
(#{item.knowledgeId}, (#{item.knowledgeId},
#{item.createUserId}, #{item.createUserId},
#{item.createTime}, #{item.createTime},
...@@ -51,13 +51,14 @@ ...@@ -51,13 +51,14 @@
AND lmp_knowledge_manage.knowledge_name = #{knowledgeManageFilter.knowledgeName} AND lmp_knowledge_manage.knowledge_name = #{knowledgeManageFilter.knowledgeName}
</if> </if>
<if test="knowledgeManageFilter.searchString != null and knowledgeManageFilter.searchString != ''"> <if test="knowledgeManageFilter.searchString != null and knowledgeManageFilter.searchString != ''">
<bind name = "safeKnowledgeManageSearchString" value = "'%' + knowledgeManageFilter.searchString + '%'" /> <bind name="safeKnowledgeManageSearchString" value="'%' + knowledgeManageFilter.searchString + '%'"/>
AND IFNULL(lmp_knowledge_manage.knowledge_name,'') LIKE #{safeKnowledgeManageSearchString} AND IFNULL(lmp_knowledge_manage.knowledge_name,'') LIKE #{safeKnowledgeManageSearchString}
</if> </if>
</if> </if>
</sql> </sql>
<select id="getKnowledgeManageList" resultMap="BaseResultMap" parameterType="com.yice.webadmin.app.model.KnowledgeManage"> <select id="getKnowledgeManageList" resultMap="BaseResultMap"
parameterType="com.yice.webadmin.app.model.KnowledgeManage">
SELECT * FROM lmp_knowledge_manage SELECT * FROM lmp_knowledge_manage
<where> <where>
<include refid="filterRef"/> <include refid="filterRef"/>
......
...@@ -9,9 +9,9 @@ ...@@ -9,9 +9,9 @@
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="task_name" jdbcType="VARCHAR" property="taskName"/> <result column="task_name" jdbcType="VARCHAR" property="taskName"/>
<result column="task_describe" jdbcType="VARCHAR" property="taskDescribe"/> <result column="task_describe" jdbcType="VARCHAR" property="taskDescribe"/>
<result column="source_model_id" jdbcType="BIGINT" property="sourceModelId"/> <result column="source_version_id" jdbcType="BIGINT" property="sourceVersionId"/>
<result column="create_method" jdbcType="TINYINT" property="createMethod"/> <result column="create_method" jdbcType="TINYINT" property="createMethod"/>
<result column="target_model_id" jdbcType="BIGINT" property="targetModelId"/> <result column="target_version_id" jdbcType="BIGINT" property="targetVersionId"/>
</resultMap> </resultMap>
<insert id="insertList"> <insert id="insertList">
...@@ -23,9 +23,9 @@ ...@@ -23,9 +23,9 @@
update_time, update_time,
task_name, task_name,
task_describe, task_describe,
source_model_id, source_version_id,
create_method, create_method,
target_model_id) target_version_id)
VALUES VALUES
<foreach collection="list" index="index" item="item" separator=","> <foreach collection="list" index="index" item="item" separator=",">
(#{item.taskId}, (#{item.taskId},
...@@ -35,9 +35,9 @@ ...@@ -35,9 +35,9 @@
#{item.updateTime}, #{item.updateTime},
#{item.taskName}, #{item.taskName},
#{item.taskDescribe}, #{item.taskDescribe},
#{item.sourceModelId}, #{item.sourceVersionId},
#{item.createMethod}, #{item.createMethod},
#{item.targetModelId}) #{item.targetVersionId})
</foreach> </foreach>
</insert> </insert>
......
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
#{item.taskId}, #{item.taskId},
#{item.runId}, #{item.runId},
#{item.basePromptTemplate} #{item.basePromptTemplate}
) )
</foreach> </foreach>
</insert> </insert>
......
package com.yice.webadmin.app.dto; package com.yice.webadmin.app.dto;
import com.yice.common.core.validator.UpdateGroup; import com.yice.common.core.validator.UpdateGroup;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.*; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/** /**
* KnowledgeManageDto对象。 * KnowledgeManageDto对象。
......
...@@ -3,11 +3,13 @@ package com.yice.webadmin.app.model; ...@@ -3,11 +3,13 @@ package com.yice.webadmin.app.model;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.yice.common.core.annotation.RelationDict;
import com.yice.common.core.annotation.RelationOneToMany; import com.yice.common.core.annotation.RelationOneToMany;
import com.yice.common.core.base.mapper.BaseModelMapper; import com.yice.common.core.base.mapper.BaseModelMapper;
import com.yice.common.core.base.model.BaseModel; import com.yice.common.core.base.model.BaseModel;
import com.yice.common.core.util.MyCommonUtil; import com.yice.common.core.util.MyCommonUtil;
import com.yice.webadmin.app.vo.DatasetManageVo; import com.yice.webadmin.app.vo.DatasetManageVo;
import com.yice.webadmin.upms.model.SysUser;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
...@@ -15,6 +17,7 @@ import org.mapstruct.Mapping; ...@@ -15,6 +17,7 @@ import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* DatasetManage实体对象。 * DatasetManage实体对象。
...@@ -60,6 +63,17 @@ public class DatasetManage extends BaseModel { ...@@ -60,6 +63,17 @@ public class DatasetManage extends BaseModel {
@TableField(exist = false) @TableField(exist = false)
private String searchString; private String searchString;
/**
* 创建人名称字典。
*/
@RelationDict(
masterIdField = "createUserId",
slaveModelClass = SysUser.class,
slaveIdField = "userId",
slaveNameField = "showName")
@TableField(exist = false)
private Map<String, Object> createUserIdDictMap;
public void setSearchString(String searchString) { public void setSearchString(String searchString) {
this.searchString = MyCommonUtil.replaceSqlWildcard(searchString); this.searchString = MyCommonUtil.replaceSqlWildcard(searchString);
} }
......
...@@ -3,16 +3,20 @@ package com.yice.webadmin.app.model; ...@@ -3,16 +3,20 @@ package com.yice.webadmin.app.model;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.yice.common.core.annotation.RelationDict;
import com.yice.common.core.annotation.RelationOneToOne; import com.yice.common.core.annotation.RelationOneToOne;
import com.yice.common.core.base.mapper.BaseModelMapper; import com.yice.common.core.base.mapper.BaseModelMapper;
import com.yice.common.core.base.model.BaseModel; import com.yice.common.core.base.model.BaseModel;
import com.yice.webadmin.app.vo.DatasetVersionVo; import com.yice.webadmin.app.vo.DatasetVersionVo;
import com.yice.webadmin.upms.model.SysUser;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.Mapping; import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;
import java.util.Map;
/** /**
* DatasetVersion实体对象。 * DatasetVersion实体对象。
* *
...@@ -111,6 +115,16 @@ public class DatasetVersion extends BaseModel { ...@@ -111,6 +115,16 @@ public class DatasetVersion extends BaseModel {
@TableField(exist = false) @TableField(exist = false)
private DatasetDetail datasetDetail; private DatasetDetail datasetDetail;
/**
* 创建人名称字典。
*/
@RelationDict(
masterIdField = "createUserId",
slaveModelClass = SysUser.class,
slaveIdField = "userId",
slaveNameField = "showName")
@TableField(exist = false)
private Map<String, Object> createUserIdDictMap;
@Mapper @Mapper
public interface DatasetVersionModelMapper extends BaseModelMapper<DatasetVersionVo, DatasetVersion> { public interface DatasetVersionModelMapper extends BaseModelMapper<DatasetVersionVo, DatasetVersion> {
/** /**
......
package com.yice.webadmin.app.model; package com.yice.webadmin.app.model;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.TableField;
import com.yice.common.core.util.MyCommonUtil; import com.baomidou.mybatisplus.annotation.TableId;
import com.yice.common.core.base.model.BaseModel; import com.baomidou.mybatisplus.annotation.TableName;
import com.yice.common.core.annotation.RelationDict;
import com.yice.common.core.base.mapper.BaseModelMapper; import com.yice.common.core.base.mapper.BaseModelMapper;
import com.yice.common.core.base.model.BaseModel;
import com.yice.common.core.util.MyCommonUtil;
import com.yice.webadmin.app.vo.KnowledgeManageVo; import com.yice.webadmin.app.vo.KnowledgeManageVo;
import com.yice.webadmin.upms.model.SysUser;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.mapstruct.*; import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;
import java.util.Map;
/** /**
* KnowledgeManage实体对象。 * KnowledgeManage实体对象。
* *
...@@ -43,6 +49,17 @@ public class KnowledgeManage extends BaseModel { ...@@ -43,6 +49,17 @@ public class KnowledgeManage extends BaseModel {
@TableField(exist = false) @TableField(exist = false)
private String searchString; private String searchString;
/**
* 创建人名称字典。
*/
@RelationDict(
masterIdField = "createUserId",
slaveModelClass = SysUser.class,
slaveIdField = "userId",
slaveNameField = "showName")
@TableField(exist = false)
private Map<String, Object> createUserIdDictMap;
public void setSearchString(String searchString) { public void setSearchString(String searchString) {
this.searchString = MyCommonUtil.replaceSqlWildcard(searchString); this.searchString = MyCommonUtil.replaceSqlWildcard(searchString);
} }
...@@ -50,5 +67,6 @@ public class KnowledgeManage extends BaseModel { ...@@ -50,5 +67,6 @@ public class KnowledgeManage extends BaseModel {
@Mapper @Mapper
public interface KnowledgeManageModelMapper extends BaseModelMapper<KnowledgeManageVo, KnowledgeManage> { public interface KnowledgeManageModelMapper extends BaseModelMapper<KnowledgeManageVo, KnowledgeManage> {
} }
public static final KnowledgeManageModelMapper INSTANCE = Mappers.getMapper(KnowledgeManageModelMapper.class); public static final KnowledgeManageModelMapper INSTANCE = Mappers.getMapper(KnowledgeManageModelMapper.class);
} }
...@@ -3,18 +3,21 @@ package com.yice.webadmin.app.model; ...@@ -3,18 +3,21 @@ package com.yice.webadmin.app.model;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.yice.common.core.annotation.RelationDict;
import com.yice.common.core.annotation.RelationOneToOne; import com.yice.common.core.annotation.RelationOneToOne;
import com.yice.common.core.base.mapper.BaseModelMapper; import com.yice.common.core.base.mapper.BaseModelMapper;
import com.yice.common.core.base.model.BaseModel; import com.yice.common.core.base.model.BaseModel;
import com.yice.common.core.util.MyCommonUtil; import com.yice.common.core.util.MyCommonUtil;
import com.yice.webadmin.app.vo.ModelCompressVo; import com.yice.webadmin.app.vo.ModelCompressVo;
import io.swagger.annotations.ApiModelProperty; import com.yice.webadmin.upms.model.SysUser;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.Mapping; import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;
import java.util.Map;
/** /**
* ModelCompress实体对象。 * ModelCompress实体对象。
* *
...@@ -47,6 +50,17 @@ public class ModelCompress extends BaseModel { ...@@ -47,6 +50,17 @@ public class ModelCompress extends BaseModel {
*/ */
private Long sourceVersionId; private Long sourceVersionId;
/**
* 源模型字典。
*/
@RelationDict(
masterIdField = "sourceVersionId",
slaveModelClass = ModelVersion.class,
slaveIdField = "versionId",
slaveNameField = "versionName")
@TableField(exist = false)
private Map<String, Object> sourceVersionIdDictMap;
/** /**
* 创建方式。 * 创建方式。
*/ */
...@@ -57,6 +71,17 @@ public class ModelCompress extends BaseModel { ...@@ -57,6 +71,17 @@ public class ModelCompress extends BaseModel {
*/ */
private Long targetVersionId; private Long targetVersionId;
/**
* 目标模型字典。
*/
@RelationDict(
masterIdField = "targetVersionId",
slaveModelClass = ModelVersion.class,
slaveIdField = "versionId",
slaveNameField = "versionName")
@TableField(exist = false)
private Map<String, Object> targetVersionIdDictMap;
/** /**
* 目标模型。 * 目标模型。
*/ */
...@@ -79,6 +104,17 @@ public class ModelCompress extends BaseModel { ...@@ -79,6 +104,17 @@ public class ModelCompress extends BaseModel {
@TableField(exist = false) @TableField(exist = false)
private String searchString; private String searchString;
/**
* 创建人名称字典。
*/
@RelationDict(
masterIdField = "createUserId",
slaveModelClass = SysUser.class,
slaveIdField = "userId",
slaveNameField = "showName")
@TableField(exist = false)
private Map<String, Object> createUserIdDictMap;
public void setSearchString(String searchString) { public void setSearchString(String searchString) {
this.searchString = MyCommonUtil.replaceSqlWildcard(searchString); this.searchString = MyCommonUtil.replaceSqlWildcard(searchString);
} }
......
...@@ -3,17 +3,21 @@ package com.yice.webadmin.app.model; ...@@ -3,17 +3,21 @@ package com.yice.webadmin.app.model;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.yice.common.core.annotation.RelationDict;
import com.yice.common.core.annotation.RelationOneToOne; import com.yice.common.core.annotation.RelationOneToOne;
import com.yice.common.core.base.mapper.BaseModelMapper; import com.yice.common.core.base.mapper.BaseModelMapper;
import com.yice.common.core.base.model.BaseModel; import com.yice.common.core.base.model.BaseModel;
import com.yice.common.core.util.MyCommonUtil; import com.yice.common.core.util.MyCommonUtil;
import com.yice.webadmin.app.vo.ModelEstimateVo; import com.yice.webadmin.app.vo.ModelEstimateVo;
import com.yice.webadmin.upms.model.SysUser;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.Mapping; import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;
import java.util.Map;
/** /**
* ModelEstimate实体对象。 * ModelEstimate实体对象。
* *
...@@ -45,12 +49,33 @@ public class ModelEstimate extends BaseModel { ...@@ -45,12 +49,33 @@ public class ModelEstimate extends BaseModel {
* 待评估模型版本ID。 * 待评估模型版本ID。
*/ */
private Long modelVersionId; private Long modelVersionId;
/**
* 评估模型版本字典。
*/
@RelationDict(
masterIdField = "modelVersionId",
slaveModelClass = ModelVersion.class,
slaveIdField = "versionId",
slaveNameField = "versionName")
@TableField(exist = false)
private Map<String, Object> modelVersionIdDictMap;
/** /**
* 评估数据集版本ID。 * 评估数据集版本ID。
*/ */
private Long datasetVersionId; private Long datasetVersionId;
/**
* 评估数据集版本字典。
*/
@RelationDict(
masterIdField = "datasetVersionId",
slaveModelClass = DatasetVersion.class,
slaveIdField = "versionId",
slaveNameField = "versionName")
@TableField(exist = false)
private Map<String, Object> datasetVersionIdDictMap;
/** /**
* 打分模式。 * 打分模式。
*/ */
...@@ -69,6 +94,17 @@ public class ModelEstimate extends BaseModel { ...@@ -69,6 +94,17 @@ public class ModelEstimate extends BaseModel {
@TableField(exist = false) @TableField(exist = false)
private String searchString; private String searchString;
/**
* 创建人名称字典。
*/
@RelationDict(
masterIdField = "createUserId",
slaveModelClass = SysUser.class,
slaveIdField = "userId",
slaveNameField = "showName")
@TableField(exist = false)
private Map<String, Object> createUserIdDictMap;
public void setSearchString(String searchString) { public void setSearchString(String searchString) {
this.searchString = MyCommonUtil.replaceSqlWildcard(searchString); this.searchString = MyCommonUtil.replaceSqlWildcard(searchString);
} }
......
...@@ -3,6 +3,7 @@ package com.yice.webadmin.app.model; ...@@ -3,6 +3,7 @@ package com.yice.webadmin.app.model;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.yice.common.core.annotation.RelationDict;
import com.yice.common.core.annotation.RelationOneToMany; import com.yice.common.core.annotation.RelationOneToMany;
import com.yice.common.core.annotation.RelationOneToManyAggregation; import com.yice.common.core.annotation.RelationOneToManyAggregation;
import com.yice.common.core.base.mapper.BaseModelMapper; import com.yice.common.core.base.mapper.BaseModelMapper;
...@@ -10,6 +11,7 @@ import com.yice.common.core.base.model.BaseModel; ...@@ -10,6 +11,7 @@ import com.yice.common.core.base.model.BaseModel;
import com.yice.common.core.constant.AggregationType; import com.yice.common.core.constant.AggregationType;
import com.yice.common.core.util.MyCommonUtil; import com.yice.common.core.util.MyCommonUtil;
import com.yice.webadmin.app.vo.ModelManageVo; import com.yice.webadmin.app.vo.ModelManageVo;
import com.yice.webadmin.upms.model.SysUser;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
...@@ -17,6 +19,7 @@ import org.mapstruct.Mapping; ...@@ -17,6 +19,7 @@ import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* ModelManage实体对象。 * ModelManage实体对象。
...@@ -86,6 +89,17 @@ public class ModelManage extends BaseModel { ...@@ -86,6 +89,17 @@ public class ModelManage extends BaseModel {
@TableField(exist = false) @TableField(exist = false)
private String searchString; private String searchString;
/**
* 创建人名称字典。
*/
@RelationDict(
masterIdField = "createUserId",
slaveModelClass = SysUser.class,
slaveIdField = "userId",
slaveNameField = "showName")
@TableField(exist = false)
private Map<String, Object> createUserIdDictMap;
public void setSearchString(String searchString) { public void setSearchString(String searchString) {
this.searchString = MyCommonUtil.replaceSqlWildcard(searchString); this.searchString = MyCommonUtil.replaceSqlWildcard(searchString);
} }
......
...@@ -3,10 +3,12 @@ package com.yice.webadmin.app.model; ...@@ -3,10 +3,12 @@ package com.yice.webadmin.app.model;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.yice.common.core.annotation.RelationDict;
import com.yice.common.core.annotation.RelationOneToOne; import com.yice.common.core.annotation.RelationOneToOne;
import com.yice.common.core.base.mapper.BaseModelMapper; import com.yice.common.core.base.mapper.BaseModelMapper;
import com.yice.common.core.base.model.BaseModel; import com.yice.common.core.base.model.BaseModel;
import com.yice.webadmin.app.vo.ModelTaskVo; import com.yice.webadmin.app.vo.ModelTaskVo;
import com.yice.webadmin.upms.model.SysUser;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
...@@ -14,6 +16,7 @@ import org.mapstruct.Mapping; ...@@ -14,6 +16,7 @@ import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;
import java.util.Date; import java.util.Date;
import java.util.Map;
/** /**
* ModelTask实体对象。 * ModelTask实体对象。
...@@ -81,6 +84,17 @@ public class ModelTask extends BaseModel { ...@@ -81,6 +84,17 @@ public class ModelTask extends BaseModel {
@TableField(exist = false) @TableField(exist = false)
private ModelCompress modelCompress; private ModelCompress modelCompress;
/**
* 创建人名称字典。
*/
@RelationDict(
masterIdField = "createUserId",
slaveModelClass = SysUser.class,
slaveIdField = "userId",
slaveNameField = "showName")
@TableField(exist = false)
private Map<String, Object> createUserIdDictMap;
@Mapper @Mapper
public interface ModelTaskModelMapper extends BaseModelMapper<ModelTaskVo, ModelTask> { public interface ModelTaskModelMapper extends BaseModelMapper<ModelTaskVo, ModelTask> {
/** /**
......
...@@ -3,16 +3,20 @@ package com.yice.webadmin.app.model; ...@@ -3,16 +3,20 @@ package com.yice.webadmin.app.model;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.yice.common.core.annotation.RelationDict;
import com.yice.common.core.annotation.RelationOneToOne; import com.yice.common.core.annotation.RelationOneToOne;
import com.yice.common.core.base.mapper.BaseModelMapper; import com.yice.common.core.base.mapper.BaseModelMapper;
import com.yice.common.core.base.model.BaseModel; import com.yice.common.core.base.model.BaseModel;
import com.yice.webadmin.app.vo.ModelVersionVo; import com.yice.webadmin.app.vo.ModelVersionVo;
import com.yice.webadmin.upms.model.SysUser;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.Mapping; import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;
import java.util.Map;
/** /**
* ModelVersion实体对象。 * ModelVersion实体对象。
* *
...@@ -134,6 +138,17 @@ public class ModelVersion extends BaseModel { ...@@ -134,6 +138,17 @@ public class ModelVersion extends BaseModel {
*/ */
private String basePromptTemplate; private String basePromptTemplate;
/**
* 创建人名称字典。
*/
@RelationDict(
masterIdField = "createUserId",
slaveModelClass = SysUser.class,
slaveIdField = "userId",
slaveNameField = "showName")
@TableField(exist = false)
private Map<String, Object> createUserIdDictMap;
@RelationOneToOne( @RelationOneToOne(
masterIdField = "modelId", masterIdField = "modelId",
......
...@@ -3,11 +3,13 @@ package com.yice.webadmin.app.model; ...@@ -3,11 +3,13 @@ package com.yice.webadmin.app.model;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.yice.common.core.annotation.RelationDict;
import com.yice.common.core.annotation.RelationGlobalDict; import com.yice.common.core.annotation.RelationGlobalDict;
import com.yice.common.core.base.mapper.BaseModelMapper; import com.yice.common.core.base.mapper.BaseModelMapper;
import com.yice.common.core.base.model.BaseModel; import com.yice.common.core.base.model.BaseModel;
import com.yice.common.core.util.MyCommonUtil; import com.yice.common.core.util.MyCommonUtil;
import com.yice.webadmin.app.vo.PromptTemplateVo; import com.yice.webadmin.app.vo.PromptTemplateVo;
import com.yice.webadmin.upms.model.SysUser;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
...@@ -114,6 +116,17 @@ public class PromptTemplate extends BaseModel { ...@@ -114,6 +116,17 @@ public class PromptTemplate extends BaseModel {
this.searchString = MyCommonUtil.replaceSqlWildcard(searchString); this.searchString = MyCommonUtil.replaceSqlWildcard(searchString);
} }
/**
* 创建人名称字典。
*/
@RelationDict(
masterIdField = "createUserId",
slaveModelClass = SysUser.class,
slaveIdField = "userId",
slaveNameField = "showName")
@TableField(exist = false)
private Map<String, Object> createUserIdDictMap;
@RelationGlobalDict( @RelationGlobalDict(
masterIdField = "templateSource", masterIdField = "templateSource",
dictCode = "TemplateSourceLabel") dictCode = "TemplateSourceLabel")
......
package com.yice.webadmin.app.model; package com.yice.webadmin.app.model;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.yice.common.core.annotation.RelationDict;
import com.yice.common.core.base.mapper.BaseModelMapper; import com.yice.common.core.base.mapper.BaseModelMapper;
import com.yice.common.core.base.model.BaseModel; import com.yice.common.core.base.model.BaseModel;
import com.yice.webadmin.app.vo.TuningRunVo; import com.yice.webadmin.app.vo.TuningRunVo;
import com.yice.webadmin.upms.model.SysUser;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;
import java.util.Map;
/** /**
* TuningRun实体对象。 * TuningRun实体对象。
* *
...@@ -92,6 +97,17 @@ public class TuningRun extends BaseModel { ...@@ -92,6 +97,17 @@ public class TuningRun extends BaseModel {
*/ */
private Integer publishStatus; private Integer publishStatus;
/**
* 创建人名称字典。
*/
@RelationDict(
masterIdField = "createUserId",
slaveModelClass = SysUser.class,
slaveIdField = "userId",
slaveNameField = "showName")
@TableField(exist = false)
private Map<String, Object> createUserIdDictMap;
@Mapper @Mapper
public interface TuningRunModelMapper extends BaseModelMapper<TuningRunVo, TuningRun> { public interface TuningRunModelMapper extends BaseModelMapper<TuningRunVo, TuningRun> {
} }
......
package com.yice.webadmin.app.service; package com.yice.webadmin.app.service;
import com.yice.webadmin.app.model.*;
import com.yice.common.core.base.service.IBaseService; import com.yice.common.core.base.service.IBaseService;
import com.yice.webadmin.app.model.KnowledgeManage;
import java.util.*; import java.util.List;
/** /**
* 知识库管理数据操作服务接口。 * 知识库管理数据操作服务接口。
...@@ -60,7 +60,7 @@ public interface KnowledgeManageService extends IBaseService<KnowledgeManage, Lo ...@@ -60,7 +60,7 @@ public interface KnowledgeManageService extends IBaseService<KnowledgeManage, Lo
* 该查询会涉及到一对一从表的关联过滤,或一对多从表的嵌套关联过滤,因此性能不如单表过滤。 * 该查询会涉及到一对一从表的关联过滤,或一对多从表的嵌套关联过滤,因此性能不如单表过滤。
* 如果仅仅需要获取主表数据,请移步(getKnowledgeManageList),以便获取更好的查询性能。 * 如果仅仅需要获取主表数据,请移步(getKnowledgeManageList),以便获取更好的查询性能。
* *
* @param filter 主表过滤对象。 * @param filter 主表过滤对象。
* @param orderBy 排序参数。 * @param orderBy 排序参数。
* @return 查询结果集。 * @return 查询结果集。
*/ */
......
...@@ -5,7 +5,6 @@ import com.yice.common.core.base.service.IBaseService; ...@@ -5,7 +5,6 @@ import com.yice.common.core.base.service.IBaseService;
import com.yice.webadmin.app.model.ModelCompress; import com.yice.webadmin.app.model.ModelCompress;
import com.yice.webadmin.app.model.ModelTask; import com.yice.webadmin.app.model.ModelTask;
import java.net.URISyntaxException;
import java.util.List; import java.util.List;
/** /**
...@@ -31,15 +30,6 @@ public interface ModelCompressService extends IBaseService<ModelCompress, Long> ...@@ -31,15 +30,6 @@ public interface ModelCompressService extends IBaseService<ModelCompress, Long>
*/ */
void saveNewBatch(List<ModelCompress> modelCompressList); void saveNewBatch(List<ModelCompress> modelCompressList);
/**
* 保存新增主表对象及关联对象。
*
* @param modelCompress 新增主表对象。
* @param relationData 全部关联从表数据。
* @return 返回新增主表对象。
*/
ModelCompress saveNewWithRelation(ModelCompress modelCompress, JSONObject relationData);
/** /**
* 更新数据对象。 * 更新数据对象。
* *
......
...@@ -87,4 +87,6 @@ public interface ModelEstimateService extends IBaseService<ModelEstimate, Long> ...@@ -87,4 +87,6 @@ public interface ModelEstimateService extends IBaseService<ModelEstimate, Long>
* @return 查询结果集。 * @return 查询结果集。
*/ */
List<ModelEstimate> getModelEstimateListWithRelation(ModelEstimate filter, ModelTask modelTaskFilter, String orderBy); List<ModelEstimate> getModelEstimateListWithRelation(ModelEstimate filter, ModelTask modelTaskFilter, String orderBy);
boolean updateStatusById(ModelEstimate modelEstimate);
} }
...@@ -83,4 +83,7 @@ public interface ModelManageService extends IBaseService<ModelManage, Long> { ...@@ -83,4 +83,7 @@ public interface ModelManageService extends IBaseService<ModelManage, Long> {
List<ModelManage> getModelManageListWithRelation(ModelManage filter, ModelVersion modelVersionFilter, ModelTask modelTaskFilter, ModelDeploy modelDeployFilter, String orderBy); List<ModelManage> getModelManageListWithRelation(ModelManage filter, ModelVersion modelVersionFilter, ModelTask modelTaskFilter, ModelDeploy modelDeployFilter, String orderBy);
ModelManage saveAndCreateVersion(ModelManage modelManage, ModelVersion modelVersion); ModelManage saveAndCreateVersion(ModelManage modelManage, ModelVersion modelVersion);
ModelVersion saveAndCreateVersionV(ModelManage modelManage, ModelVersion modelVersion);
} }
...@@ -8,9 +8,11 @@ import java.io.IOException; ...@@ -8,9 +8,11 @@ import java.io.IOException;
* @author linking * @author linking
* @date 2023-04-13 * @date 2023-04-13
*/ */
public interface ProxyPythonService{ public interface ProxyPythonService {
public String predictPost(String url, String requestBody) throws IOException; public String predictPost(String url, String requestBody) throws IOException;
public String predictGet(String url, String requestBody) throws IOException; public String predictGet(String url, String requestBody) throws IOException;
public String predictPostForFile(String url, String requestBody) throws IOException; public String predictPostForFile(String url, String requestBody) throws IOException;
} }
...@@ -2,6 +2,8 @@ package com.yice.webadmin.app.service; ...@@ -2,6 +2,8 @@ package com.yice.webadmin.app.service;
import com.yice.common.core.base.service.IBaseService; import com.yice.common.core.base.service.IBaseService;
import com.yice.webadmin.app.dto.RunPublishDto; import com.yice.webadmin.app.dto.RunPublishDto;
import com.yice.webadmin.app.model.ModelManage;
import com.yice.webadmin.app.model.ModelVersion;
import com.yice.webadmin.app.model.TuningRun; import com.yice.webadmin.app.model.TuningRun;
import java.util.List; import java.util.List;
...@@ -76,4 +78,10 @@ public interface TuningRunService extends IBaseService<TuningRun, Long> { ...@@ -76,4 +78,10 @@ public interface TuningRunService extends IBaseService<TuningRun, Long> {
List<TuningRun> getTuningRunListWithRelation(TuningRun filter, String orderBy); List<TuningRun> getTuningRunListWithRelation(TuningRun filter, String orderBy);
boolean publishToModelVersion(RunPublishDto runPublishDto); boolean publishToModelVersion(RunPublishDto runPublishDto);
ModelManage createToModel(ModelManage modelManage, ModelVersion modelVersion);
ModelVersion createToModelVersion(ModelVersion modelVersion);
boolean updateStatusById(TuningRun tuningRun);
} }
...@@ -10,12 +10,10 @@ import com.yice.common.core.object.CallResult; ...@@ -10,12 +10,10 @@ import com.yice.common.core.object.CallResult;
import com.yice.common.core.object.MyRelationParam; import com.yice.common.core.object.MyRelationParam;
import com.yice.common.core.util.MyModelUtil; import com.yice.common.core.util.MyModelUtil;
import com.yice.common.sequence.wrapper.IdGeneratorWrapper; import com.yice.common.sequence.wrapper.IdGeneratorWrapper;
import com.yice.webadmin.app.controller.DatasetManageController;
import com.yice.webadmin.app.dao.DatasetVersionMapper; import com.yice.webadmin.app.dao.DatasetVersionMapper;
import com.yice.webadmin.app.model.DatasetDetail; import com.yice.webadmin.app.model.DatasetDetail;
import com.yice.webadmin.app.model.DatasetManage; import com.yice.webadmin.app.model.DatasetManage;
import com.yice.webadmin.app.model.DatasetVersion; import com.yice.webadmin.app.model.DatasetVersion;
import com.yice.webadmin.app.model.ModelVersion;
import com.yice.webadmin.app.service.DatasetDetailService; import com.yice.webadmin.app.service.DatasetDetailService;
import com.yice.webadmin.app.service.DatasetManageService; import com.yice.webadmin.app.service.DatasetManageService;
import com.yice.webadmin.app.service.DatasetVersionService; import com.yice.webadmin.app.service.DatasetVersionService;
...@@ -67,13 +65,13 @@ public class DatasetVersionServiceImpl extends BaseService<DatasetVersion, Long> ...@@ -67,13 +65,13 @@ public class DatasetVersionServiceImpl extends BaseService<DatasetVersion, Long>
DatasetManage reDatasetManage = this.datasetManageService.getById(datasetVersion.getDatasetId()); DatasetManage reDatasetManage = this.datasetManageService.getById(datasetVersion.getDatasetId());
DatasetVersion datasetVersionFilter = new DatasetVersion(); DatasetVersion datasetVersionFilter = new DatasetVersion();
datasetVersionFilter.setDatasetId(datasetVersion.getDatasetId()); datasetVersionFilter.setDatasetId(datasetVersion.getDatasetId());
List<DatasetVersion> datasetVersionList = this.getDatasetVersionList(datasetVersionFilter,"dataset_version"); List<DatasetVersion> datasetVersionList = this.getDatasetVersionList(datasetVersionFilter, "dataset_version");
Integer version = 1; Integer version = 1;
if (datasetVersionList != null && datasetVersionList.size() != 0) { if (datasetVersionList != null && datasetVersionList.size() != 0) {
version = datasetVersionList.get(datasetVersionList.size() - 1).getDatasetVersion() + 1; version = datasetVersionList.get(datasetVersionList.size() - 1).getDatasetVersion() + 1;
} }
datasetVersion.setDatasetVersion(version); datasetVersion.setDatasetVersion(version);
datasetVersion.setVersionName(reDatasetManage.getDatasetName()+"_V"+datasetVersion.getDatasetVersion()); datasetVersion.setVersionName(reDatasetManage.getDatasetName() + "_V" + datasetVersion.getDatasetVersion());
datasetVersion.setDatasetId(reDatasetManage.getDatasetId()); datasetVersion.setDatasetId(reDatasetManage.getDatasetId());
datasetVersion.setCleanStatus(0); datasetVersion.setCleanStatus(0);
datasetVersion.setDataVolume(0L); datasetVersion.setDataVolume(0L);
......
...@@ -8,17 +8,14 @@ import com.yice.common.core.base.service.BaseService; ...@@ -8,17 +8,14 @@ import com.yice.common.core.base.service.BaseService;
import com.yice.common.core.object.MyRelationParam; import com.yice.common.core.object.MyRelationParam;
import com.yice.common.core.util.MyModelUtil; import com.yice.common.core.util.MyModelUtil;
import com.yice.common.sequence.wrapper.IdGeneratorWrapper; import com.yice.common.sequence.wrapper.IdGeneratorWrapper;
import com.yice.webadmin.app.config.KnowledgeConfig;
import com.yice.webadmin.app.dao.KnowledgeManageMapper; import com.yice.webadmin.app.dao.KnowledgeManageMapper;
import com.yice.webadmin.app.model.KnowledgeManage; import com.yice.webadmin.app.model.KnowledgeManage;
import com.yice.webadmin.app.service.KnowledgeManageService; import com.yice.webadmin.app.service.KnowledgeManageService;
import com.yice.webadmin.app.service.ProxyPythonService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.io.IOException;
import java.util.List; import java.util.List;
/** /**
......
...@@ -12,13 +12,16 @@ import com.yice.common.sequence.wrapper.IdGeneratorWrapper; ...@@ -12,13 +12,16 @@ import com.yice.common.sequence.wrapper.IdGeneratorWrapper;
import com.yice.webadmin.app.dao.ModelEstimateMapper; import com.yice.webadmin.app.dao.ModelEstimateMapper;
import com.yice.webadmin.app.model.ModelEstimate; import com.yice.webadmin.app.model.ModelEstimate;
import com.yice.webadmin.app.model.ModelTask; import com.yice.webadmin.app.model.ModelTask;
import com.yice.webadmin.app.model.ModelVersion;
import com.yice.webadmin.app.service.ModelEstimateService; import com.yice.webadmin.app.service.ModelEstimateService;
import com.yice.webadmin.app.service.ModelTaskService; import com.yice.webadmin.app.service.ModelTaskService;
import com.yice.webadmin.app.service.ModelVersionService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -37,6 +40,8 @@ public class ModelEstimateServiceImpl extends BaseService<ModelEstimate, Long> i ...@@ -37,6 +40,8 @@ public class ModelEstimateServiceImpl extends BaseService<ModelEstimate, Long> i
private ModelTaskService modelTaskService; private ModelTaskService modelTaskService;
@Autowired @Autowired
private IdGeneratorWrapper idGenerator; private IdGeneratorWrapper idGenerator;
@Autowired
private ModelVersionService modelVersionService;
/** /**
* 返回当前Service的主表Mapper对象。 * 返回当前Service的主表Mapper对象。
...@@ -57,7 +62,18 @@ public class ModelEstimateServiceImpl extends BaseService<ModelEstimate, Long> i ...@@ -57,7 +62,18 @@ public class ModelEstimateServiceImpl extends BaseService<ModelEstimate, Long> i
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public ModelEstimate saveNew(ModelEstimate modelEstimate) { public ModelEstimate saveNew(ModelEstimate modelEstimate) {
modelEstimate.setTaskStatus(0);
modelEstimateMapper.insert(this.buildDefaultValue(modelEstimate)); modelEstimateMapper.insert(this.buildDefaultValue(modelEstimate));
ModelVersion modelVersion = this.modelVersionService.getById(modelEstimate.getModelVersionId());
ModelTask modelTask = new ModelTask();
modelTask.setVersionId(modelVersion.getVersionId());
modelTask.setTaskType(1);
modelTask.setTaskStatus(0);
modelTask.setModelId(modelVersion.getModelId());
modelTask.setModelVersion(modelVersion.getModelVersion());
modelTask.setVersionName(modelVersion.getVersionName());
modelTask.setTaskId(modelEstimate.getTaskId());
this.modelTaskService.saveNew(modelTask);
return modelEstimate; return modelEstimate;
} }
...@@ -172,6 +188,16 @@ public class ModelEstimateServiceImpl extends BaseService<ModelEstimate, Long> i ...@@ -172,6 +188,16 @@ public class ModelEstimateServiceImpl extends BaseService<ModelEstimate, Long> i
return resultList; return resultList;
} }
@Transactional(rollbackFor = Exception.class)
@Override
public boolean updateStatusById(ModelEstimate modelEstimate) {
ModelTask modelTask = this.modelTaskService.getById(modelEstimate.getTaskId());
modelTask.setTaskStatus(modelEstimate.getTaskStatus());
modelTask.setCompleteTime(new Date());
modelTaskService.updateById(modelTask);
return this.updateById(modelEstimate);
}
private ModelEstimate buildDefaultValue(ModelEstimate modelEstimate) { private ModelEstimate buildDefaultValue(ModelEstimate modelEstimate) {
if (modelEstimate.getTaskId() == null) { if (modelEstimate.getTaskId() == null) {
modelEstimate.setTaskId(idGenerator.nextLongId()); modelEstimate.setTaskId(idGenerator.nextLongId());
......
...@@ -65,7 +65,6 @@ public class ModelManageServiceImpl extends BaseService<ModelManage, Long> imple ...@@ -65,7 +65,6 @@ public class ModelManageServiceImpl extends BaseService<ModelManage, Long> imple
* @param modelManage 新增对象。 * @param modelManage 新增对象。
* @return 返回新增对象。 * @return 返回新增对象。
*/ */
@Transactional(rollbackFor = Exception.class)
@Override @Override
public ModelManage saveNew(ModelManage modelManage) { public ModelManage saveNew(ModelManage modelManage) {
modelManageMapper.insert(this.buildDefaultValue(modelManage)); modelManageMapper.insert(this.buildDefaultValue(modelManage));
...@@ -180,7 +179,7 @@ public class ModelManageServiceImpl extends BaseService<ModelManage, Long> imple ...@@ -180,7 +179,7 @@ public class ModelManageServiceImpl extends BaseService<ModelManage, Long> imple
return resultList; return resultList;
} }
@Transactional @Transactional(rollbackFor = Exception.class)
@Override @Override
public ModelManage saveAndCreateVersion(ModelManage modelManage, ModelVersion modelVersion) { public ModelManage saveAndCreateVersion(ModelManage modelManage, ModelVersion modelVersion) {
ModelManage reModelManage = this.saveNew(modelManage); ModelManage reModelManage = this.saveNew(modelManage);
...@@ -192,6 +191,16 @@ public class ModelManageServiceImpl extends BaseService<ModelManage, Long> imple ...@@ -192,6 +191,16 @@ public class ModelManageServiceImpl extends BaseService<ModelManage, Long> imple
return reModelManage; return reModelManage;
} }
@Override
public ModelVersion saveAndCreateVersionV(ModelManage modelManage, ModelVersion modelVersion) {
ModelManage reModelManage = this.saveNew(modelManage);
modelVersion.setModelId(reModelManage.getModelId());
if (modelVersion.getBusinessLabel() == null && modelManage.getBusinessLabel() != null) {
modelVersion.setBusinessLabel(modelManage.getBusinessLabel());
}
return this.modelVersionService.saveNew(modelVersion);
}
private ModelManage buildDefaultValue(ModelManage modelManage) { private ModelManage buildDefaultValue(ModelManage modelManage) {
if (modelManage.getModelId() == null) { if (modelManage.getModelId() == null) {
modelManage.setModelId(idGenerator.nextLongId()); modelManage.setModelId(idGenerator.nextLongId());
......
...@@ -63,7 +63,6 @@ public class ModelTaskServiceImpl extends BaseService<ModelTask, Long> implement ...@@ -63,7 +63,6 @@ public class ModelTaskServiceImpl extends BaseService<ModelTask, Long> implement
* @param modelTask 新增对象。 * @param modelTask 新增对象。
* @return 返回新增对象。 * @return 返回新增对象。
*/ */
@Transactional(rollbackFor = Exception.class)
@Override @Override
public ModelTask saveNew(ModelTask modelTask) { public ModelTask saveNew(ModelTask modelTask) {
modelTaskMapper.insert(this.buildDefaultValue(modelTask)); modelTaskMapper.insert(this.buildDefaultValue(modelTask));
......
...@@ -6,14 +6,11 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; ...@@ -6,14 +6,11 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.yice.common.core.base.dao.BaseDaoMapper; import com.yice.common.core.base.dao.BaseDaoMapper;
import com.yice.common.core.base.service.BaseService; import com.yice.common.core.base.service.BaseService;
import com.yice.common.core.constant.ErrorCodeEnum;
import com.yice.common.core.object.CallResult; import com.yice.common.core.object.CallResult;
import com.yice.common.core.object.MyRelationParam; import com.yice.common.core.object.MyRelationParam;
import com.yice.common.core.object.ResponseResult;
import com.yice.common.core.util.MyModelUtil; import com.yice.common.core.util.MyModelUtil;
import com.yice.common.sequence.wrapper.IdGeneratorWrapper; import com.yice.common.sequence.wrapper.IdGeneratorWrapper;
import com.yice.webadmin.app.dao.ModelVersionMapper; import com.yice.webadmin.app.dao.ModelVersionMapper;
import com.yice.webadmin.app.model.ModelTask;
import com.yice.webadmin.app.model.ModelVersion; import com.yice.webadmin.app.model.ModelVersion;
import com.yice.webadmin.app.service.ModelManageService; import com.yice.webadmin.app.service.ModelManageService;
import com.yice.webadmin.app.service.ModelTaskService; import com.yice.webadmin.app.service.ModelTaskService;
...@@ -60,29 +57,22 @@ public class ModelVersionServiceImpl extends BaseService<ModelVersion, Long> imp ...@@ -60,29 +57,22 @@ public class ModelVersionServiceImpl extends BaseService<ModelVersion, Long> imp
* @param modelVersion 新增对象。 * @param modelVersion 新增对象。
* @return 返回新增对象。 * @return 返回新增对象。
*/ */
@Transactional(rollbackFor = Exception.class)
@Override @Override
public ModelVersion saveNew(ModelVersion modelVersion) { public ModelVersion saveNew(ModelVersion modelVersion) {
String modelName = this.modelManageService.getById(modelVersion.getModelId()).getModelName(); String modelName = this.modelManageService.getById(modelVersion.getModelId()).getModelName();
ModelVersion modelVersionFilter = new ModelVersion(); ModelVersion modelVersionFilter = new ModelVersion();
modelVersionFilter.setModelId(modelVersion.getModelId()); modelVersionFilter.setModelId(modelVersion.getModelId());
List<ModelVersion> modelVersionList = this.getModelVersionList(modelVersionFilter,"model_Version"); List<ModelVersion> modelVersionList = this.getModelVersionList(modelVersionFilter, "model_Version");
Integer version = 1; Integer version = 1;
if (modelVersionList != null && modelVersionList.size() != 0) { if (modelVersionList != null && modelVersionList.size() != 0) {
version = modelVersionList.get(modelVersionList.size() - 1).getModelVersion() + 1; version = modelVersionList.get(modelVersionList.size() - 1).getModelVersion() + 1;
} }
modelVersion.setModelVersion(version); modelVersion.setModelVersion(version);
modelVersion.setIsCompress(0); if (modelVersion.getIsCompress() == null) {
modelVersion.setIsCompress(0);
}
modelVersion.setVersionName(modelName + "_V" + modelVersion.getModelVersion()); modelVersion.setVersionName(modelName + "_V" + modelVersion.getModelVersion());
modelVersionMapper.insert(this.buildDefaultValue(modelVersion)); modelVersionMapper.insert(this.buildDefaultValue(modelVersion));
//此处应该调用精调运行发布的方法生成模型任务,不应该直接生成!!!!!!!!!!!!!!!!!
ModelTask modelTask = new ModelTask();
modelTask.setModelVersion(modelVersion.getModelVersion());
modelTask.setModelId(modelVersion.getModelId());
modelTask.setTaskType(0);
modelTask.setVersionId(modelVersion.getVersionId());
modelTask.setVersionName(modelVersion.getVersionName());
this.modelTaskService.saveNew(modelTask);
return modelVersion; return modelVersion;
} }
......
package com.yice.webadmin.app.service.impl; package com.yice.webadmin.app.service.impl;
import com.yice.webadmin.app.config.PythonConfig;
import com.yice.webadmin.app.service.ProxyPythonService; import com.yice.webadmin.app.service.ProxyPythonService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpEntity; import org.apache.http.HttpEntity;
...@@ -12,7 +11,6 @@ import org.apache.http.entity.StringEntity; ...@@ -12,7 +11,6 @@ import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils; import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.io.IOException; import java.io.IOException;
...@@ -51,6 +49,7 @@ public class ProxyPythonServiceImpl implements ProxyPythonService { ...@@ -51,6 +49,7 @@ public class ProxyPythonServiceImpl implements ProxyPythonService {
} }
return null; return null;
} }
public String predictPostForFile(String url, String requestBody) throws IOException { public String predictPostForFile(String url, String requestBody) throws IOException {
CloseableHttpClient httpClient = HttpClients.createDefault(); CloseableHttpClient httpClient = HttpClients.createDefault();
try { try {
...@@ -76,6 +75,7 @@ public class ProxyPythonServiceImpl implements ProxyPythonService { ...@@ -76,6 +75,7 @@ public class ProxyPythonServiceImpl implements ProxyPythonService {
} }
return null; return null;
} }
public String predictGet(String url, String requestBody) throws IOException { public String predictGet(String url, String requestBody) throws IOException {
CloseableHttpClient httpClient = HttpClients.createDefault(); CloseableHttpClient httpClient = HttpClients.createDefault();
try { try {
......
...@@ -26,6 +26,4 @@ public class FileUtil { ...@@ -26,6 +26,4 @@ public class FileUtil {
return ResponseEntity.notFound().build(); // 如果文件不存在,返回404 Not Found状态码 return ResponseEntity.notFound().build(); // 如果文件不存在,返回404 Not Found状态码
} }
} }
} }
...@@ -56,4 +56,10 @@ public class DatasetManageVo extends BaseVo { ...@@ -56,4 +56,10 @@ public class DatasetManageVo extends BaseVo {
*/ */
@ApiModelProperty(value = "DatasetVersion 的一对多关联表数据对象。数据对应类型为DatasetVersion") @ApiModelProperty(value = "DatasetVersion 的一对多关联表数据对象。数据对应类型为DatasetVersion")
private List<Map<String, Object>> datasetVersionList; private List<Map<String, Object>> datasetVersionList;
/**
* 创建人名称。
*/
@ApiModelProperty(value = "创建人名称")
private Map<String, Object> createUserIdDictMap;
} }
...@@ -121,4 +121,10 @@ public class DatasetVersionVo extends BaseVo { ...@@ -121,4 +121,10 @@ public class DatasetVersionVo extends BaseVo {
*/ */
@ApiModelProperty(value = "versionId 的一对一关联数据对象,数据对应类型为DatasetDetailVo") @ApiModelProperty(value = "versionId 的一对一关联数据对象,数据对应类型为DatasetDetailVo")
private Map<String, Object> datasetDetail; private Map<String, Object> datasetDetail;
/**
* 创建人名称。
*/
@ApiModelProperty(value = "创建人名称")
private Map<String, Object> createUserIdDictMap;
} }
...@@ -6,7 +6,7 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -6,7 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.util.Date; import java.util.Map;
/** /**
* KnowledgeManageVO视图对象。 * KnowledgeManageVO视图对象。
...@@ -36,4 +36,10 @@ public class KnowledgeManageVo extends BaseVo { ...@@ -36,4 +36,10 @@ public class KnowledgeManageVo extends BaseVo {
*/ */
@ApiModelProperty(value = "知识库描述") @ApiModelProperty(value = "知识库描述")
private String knowledgeDescribe; private String knowledgeDescribe;
/**
* 创建人名称。
*/
@ApiModelProperty(value = "创建人名称")
private Map<String, Object> createUserIdDictMap;
} }
package com.yice.webadmin.app.vo; package com.yice.webadmin.app.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.yice.common.core.annotation.RelationDict;
import com.yice.common.core.base.vo.BaseVo; import com.yice.common.core.base.vo.BaseVo;
import com.yice.webadmin.app.model.ModelVersion;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
...@@ -67,4 +70,22 @@ public class ModelCompressVo extends BaseVo { ...@@ -67,4 +70,22 @@ public class ModelCompressVo extends BaseVo {
*/ */
@ApiModelProperty(value = "taskId 的一对一关联数据对象,数据对应类型为ModelTaskVo") @ApiModelProperty(value = "taskId 的一对一关联数据对象,数据对应类型为ModelTaskVo")
private Map<String, Object> modelTask; private Map<String, Object> modelTask;
/**
* 创建人名称。
*/
@ApiModelProperty(value = "创建人名称")
private Map<String, Object> createUserIdDictMap;
/**
* 目标模型字典。
*/
@ApiModelProperty(value = "目标模型字典")
private Map<String, Object> targetVersionIdDictMap;
/**
* 源模型字典。
*/
@ApiModelProperty(value = "源模型字典")
private Map<String, Object> sourceVersionIdDictMap;
} }
...@@ -71,4 +71,14 @@ public class ModelEstimateVo extends BaseVo { ...@@ -71,4 +71,14 @@ public class ModelEstimateVo extends BaseVo {
*/ */
@ApiModelProperty(value = "taskId 的一对一关联数据对象,数据对应类型为ModelTaskVo") @ApiModelProperty(value = "taskId 的一对一关联数据对象,数据对应类型为ModelTaskVo")
private Map<String, Object> modelTask; private Map<String, Object> modelTask;
@ApiModelProperty(value = "数据集版本")
private Map<String, Object> datasetVersionIdDictMap;
@ApiModelProperty(value = "模型版本")
private Map<String, Object> modelVersionIdDictMap;
/**
* 创建人名称。
*/
@ApiModelProperty(value = "创建人名称")
private Map<String, Object> createUserIdDictMap;
} }
...@@ -85,4 +85,10 @@ public class ModelManageVo extends BaseVo { ...@@ -85,4 +85,10 @@ public class ModelManageVo extends BaseVo {
*/ */
@ApiModelProperty(value = "ModelDeploy 的一对多关联表数据对象。数据对应类型为ModelDeploy") @ApiModelProperty(value = "ModelDeploy 的一对多关联表数据对象。数据对应类型为ModelDeploy")
private List<Map<String, Object>> modelDeployList; private List<Map<String, Object>> modelDeployList;
/**
* 创建人名称。
*/
@ApiModelProperty(value = "创建人名称")
private Map<String, Object> createUserIdDictMap;
} }
...@@ -79,4 +79,10 @@ public class ModelTaskVo extends BaseVo { ...@@ -79,4 +79,10 @@ public class ModelTaskVo extends BaseVo {
*/ */
@ApiModelProperty(value = "taskId 的一对一关联数据对象,数据对应类型为ModelCompressVo") @ApiModelProperty(value = "taskId 的一对一关联数据对象,数据对应类型为ModelCompressVo")
private Map<String, Object> modelCompress; private Map<String, Object> modelCompress;
/**
* 创建人名称。
*/
@ApiModelProperty(value = "创建人名称")
private Map<String, Object> createUserIdDictMap;
} }
...@@ -157,4 +157,10 @@ public class ModelVersionVo extends BaseVo { ...@@ -157,4 +157,10 @@ public class ModelVersionVo extends BaseVo {
*/ */
@ApiModelProperty(value = "默认的提示词模板") @ApiModelProperty(value = "默认的提示词模板")
private String basePromptTemplate; private String basePromptTemplate;
/**
* 创建人名称。
*/
@ApiModelProperty(value = "创建人名称")
private Map<String, Object> createUserIdDictMap;
} }
...@@ -110,6 +110,12 @@ public class PromptTemplateVo extends BaseVo { ...@@ -110,6 +110,12 @@ public class PromptTemplateVo extends BaseVo {
@ApiModelProperty(value = "逆向模板变量") @ApiModelProperty(value = "逆向模板变量")
private String negativeTemplateVariables; private String negativeTemplateVariables;
/**
* 创建人名称。
*/
@ApiModelProperty(value = "创建人名称")
private Map<String, Object> createUserIdDictMap;
/** /**
* templateSource 全局字典关联数据。 * templateSource 全局字典关联数据。
*/ */
......
...@@ -6,6 +6,8 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -6,6 +6,8 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.util.Map;
/** /**
* TuningRunVO视图对象。 * TuningRunVO视图对象。
* *
...@@ -100,4 +102,10 @@ public class TuningRunVo extends BaseVo { ...@@ -100,4 +102,10 @@ public class TuningRunVo extends BaseVo {
*/ */
@ApiModelProperty(value = "发布状态") @ApiModelProperty(value = "发布状态")
private Integer publishStatus; private Integer publishStatus;
/**
* 创建人名称。
*/
@ApiModelProperty(value = "创建人名称")
private Map<String, Object> createUserIdDictMap;
} }
...@@ -77,6 +77,10 @@ python: ...@@ -77,6 +77,10 @@ python:
factoryInterface: http://192.168.0.36:7860/run/predict factoryInterface: http://192.168.0.36:7860/run/predict
#python websocket 服务地址 #python websocket 服务地址
pythonWebsocketUri: ws://192.168.0.36:7860/queue/join pythonWebsocketUri: ws://192.168.0.36:7860/queue/join
#输出控制地址
controllerAddress: http://0.0.0.0:20001
#对话基础路径
chatAddress: http://192.168.0.36:8000/
knowledge: knowledge:
#知识库通用接口地址 #知识库通用接口地址
......
...@@ -739,7 +739,8 @@ public class MyModelUtil { ...@@ -739,7 +739,8 @@ public class MyModelUtil {
*/ */
public static <M> void fillCommonsForInsert(M data) { public static <M> void fillCommonsForInsert(M data) {
Field createdByField = ReflectUtil.getField(data.getClass(), CREATE_USER_ID_FIELD_NAME); Field createdByField = ReflectUtil.getField(data.getClass(), CREATE_USER_ID_FIELD_NAME);
if (createdByField != null) { Object createdByFieldValue = ReflectUtil.getFieldValue(data, createdByField);
if (createdByField != null && createdByFieldValue == null) {
ReflectUtil.setFieldValue(data, createdByField, TokenData.takeFromRequest().getUserId()); ReflectUtil.setFieldValue(data, createdByField, TokenData.takeFromRequest().getUserId());
} }
Field createTimeField = ReflectUtil.getField(data.getClass(), CREATE_TIME_FIELD_NAME); Field createTimeField = ReflectUtil.getField(data.getClass(), CREATE_TIME_FIELD_NAME);
...@@ -747,7 +748,8 @@ public class MyModelUtil { ...@@ -747,7 +748,8 @@ public class MyModelUtil {
ReflectUtil.setFieldValue(data, createTimeField, new Date()); ReflectUtil.setFieldValue(data, createTimeField, new Date());
} }
Field updatedByField = ReflectUtil.getField(data.getClass(), UPDATE_USER_ID_FIELD_NAME); Field updatedByField = ReflectUtil.getField(data.getClass(), UPDATE_USER_ID_FIELD_NAME);
if (updatedByField != null) { Object updatedByFieldValue = ReflectUtil.getFieldValue(data, updatedByField);
if (updatedByField != null && updatedByFieldValue == null) {
ReflectUtil.setFieldValue(data, updatedByField, TokenData.takeFromRequest().getUserId()); ReflectUtil.setFieldValue(data, updatedByField, TokenData.takeFromRequest().getUserId());
} }
Field updateTimeField = ReflectUtil.getField(data.getClass(), UPDATE_TIME_FIELD_NAME); Field updateTimeField = ReflectUtil.getField(data.getClass(), UPDATE_TIME_FIELD_NAME);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment