refactor(llm): 重构模型服务和数据集同步功能
- 更新了 RAG 服务的请求地址配置 - 优化了数据集上传的逻辑,使用配置的请求地址 - 调整了数据集同步任务的执行频率 - 修复了模型服务相关的一些小问题
This commit is contained in:
parent
ddde5e5925
commit
5b889eec3c
@ -11,6 +11,11 @@ import javax.validation.constraints.NotNull;
|
||||
@Data
|
||||
public class LLMBackendProperties {
|
||||
|
||||
/**
|
||||
* 请求地址
|
||||
*/
|
||||
private String requestAddress;
|
||||
|
||||
/**
|
||||
* 过期时间
|
||||
*/
|
||||
|
@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||
import cn.iocoder.yudao.module.llm.controller.admin.dataset.vo.DatasetQuestionRespVO;
|
||||
import cn.iocoder.yudao.module.llm.dal.dataobject.dataset.DatasetDO;
|
||||
import cn.iocoder.yudao.module.llm.dal.mysql.dataset.DatasetMapper;
|
||||
import cn.iocoder.yudao.module.llm.framework.backend.config.LLMBackendProperties;
|
||||
import cn.iocoder.yudao.module.llm.service.dataset.vo.AigcDatasetVo;
|
||||
import cn.iocoder.yudao.module.llm.service.http.TrainHttpService;
|
||||
import cn.iocoder.yudao.module.llm.service.http.vo.AigcDatasetFileRespV0;
|
||||
@ -28,6 +29,9 @@ public class AsyncDataSetService {
|
||||
private TrainHttpService trainHttpService;
|
||||
@Resource
|
||||
private DatasetMapper datasetMapper;
|
||||
|
||||
@Resource
|
||||
private LLMBackendProperties llmBackendProperties;
|
||||
private static final Logger log = LoggerFactory.getLogger(AsyncKnowledgeBase.class);
|
||||
|
||||
@Async
|
||||
@ -52,7 +56,7 @@ public class AsyncDataSetService {
|
||||
sb.append(json).append("\n"); // 每个 JSON 对象后换行
|
||||
}
|
||||
InputStream inputStream = new ByteArrayInputStream(sb.toString().getBytes());
|
||||
AigcDatasetFileRespV0 aigcDatasetFileRespV0 = trainHttpService.AigcUploadFile(new HashMap<>(), "http://36.103.199.104:5123", inputStream, datasetDO.getDatasetName() + "new" + datasetDO.getId() + ".json");
|
||||
AigcDatasetFileRespV0 aigcDatasetFileRespV0 = trainHttpService.AigcUploadFile(new HashMap<>(), llmBackendProperties.getRequestAddress(), inputStream, datasetDO.getDatasetName() + "new" + datasetDO.getId() + ".json");
|
||||
if (aigcDatasetFileRespV0 != null) {
|
||||
datasetMapper.setJobid(datasetDO.getId(), aigcDatasetFileRespV0.getFileId());
|
||||
|
||||
|
@ -23,7 +23,7 @@ public class DatasetTaskSyncService {
|
||||
@Resource
|
||||
private AsyncDataSetService dataSetService;
|
||||
|
||||
@Scheduled(cron ="0/15 * * * * ?")
|
||||
@Scheduled(cron ="0/20 * * * * ?")
|
||||
public void syncDatasetAigcTask() {
|
||||
log.info("[syncDatasetAigcTask][开始同步任务]");
|
||||
// 查询已经标注完成的数据集
|
||||
|
@ -462,7 +462,9 @@ public class ModelServiceServiceImpl implements ModelServiceService {
|
||||
BaseModelDO byAigcId = baseModelService.getById(fineTuningTask);
|
||||
Map<String,String> map = new HashMap<>();
|
||||
map.put("model",byAigcId.getModelName());
|
||||
log.info("开始请求", llmBackendProperties.getDeployModel());
|
||||
String resStr = HttpUtils.post(llmBackendProperties.getDeployModel(), null,JSON.toJSONString(map));
|
||||
log.info(" unActive:{}", resStr);
|
||||
ModelServiceDO updateObj = BeanUtils.toBean(updateReqVO, ModelServiceDO.class);
|
||||
updateObj.setStatus(1);
|
||||
updateObj.setNumber(1);
|
||||
|
@ -248,6 +248,7 @@ llm:
|
||||
backend:
|
||||
#################### 8123: RAG服务、训练集和标注相关API。 ###################
|
||||
### RAG服务
|
||||
request_address: http://127.0.0.1:5123
|
||||
#RAG健康检查 GET
|
||||
rag_health: http://127.0.0.1:8123/health
|
||||
#上传并向量化 POST
|
||||
|
Loading…
x
Reference in New Issue
Block a user