From f73b197422ed484c69c460a40db2efe45c79acd1 Mon Sep 17 00:00:00 2001 From: Liuyang <2746366019@qq.com> Date: Mon, 3 Mar 2025 13:43:38 +0800 Subject: [PATCH] =?UTF-8?q?refactor(llm):=20=E7=A7=BB=E9=99=A4=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E6=89=93=E5=8D=B0=E8=AF=AD=E5=8F=A5=E7=9A=84=E6=B3=A8?= =?UTF-8?q?=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 移除了多处日志打印语句的注释,包括 login、account、finetuningDetail、finetuningDelete、finetuningFileList、autoEvaluation、modelDeploy、modelUndeploy、createModel 和 uploadFile 方法中的日志语句。这些日志语句现在将正常输出信息。 --- .../llm/service/http/TrainHttpService.java | 68 +++++++++---------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/http/TrainHttpService.java b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/http/TrainHttpService.java index 749658933..80100a343 100644 --- a/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/http/TrainHttpService.java +++ b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/http/TrainHttpService.java @@ -116,7 +116,7 @@ public class TrainHttpService { String login = llmBackendProperties.getLogin(); AigcLoginReqVO req = new AigcLoginReqVO(llmBackendProperties.getLoginUsername(), llmBackendProperties.getLoginPassword()); String res = HttpUtils.post(login, headers, JSON.toJSONString(req)); - // log.info("登录接口返回:{}", res); + log.info("登录接口返回:{}", res); AigcRespVO aigcRespVO = JSON.parseObject(res, AigcRespVO.class); if (aigcRespVO.isSuccess() && aigcRespVO.getData() != null) { AigcLoginRespVO aigcLoginRespVO = JSON.parseObject(aigcRespVO.getData().toString(), AigcLoginRespVO.class); @@ -125,7 +125,7 @@ public class TrainHttpService { if (aigcAccountRespVO != null && CollUtil.isNotEmpty(aigcAccountRespVO.getTenants())) { aigcLoginRespVO.setTenantId(aigcAccountRespVO.getTenants().get(0).getId()); headers.put("X-Tenant-Id", aigcLoginRespVO.getTenantId()); - // log.info(" login:{}", aigcAccountRespVO); + log.info(" login:{}", aigcAccountRespVO); return aigcLoginRespVO; } } @@ -135,11 +135,11 @@ public class TrainHttpService { public AigcAccountRespVO account (Map headers) { String account = llmBackendProperties.getAccount(); String res = HttpUtils.get(account, headers); - // log.info(" account:{}", res); + log.info(" account:{}", res); AigcRespVO aigcRespVO = JSON.parseObject(res, AigcRespVO.class); if (aigcRespVO.isSuccess() && aigcRespVO.getData() != null) { AigcAccountRespVO aigcAccountRespVO = JSON.parseObject(aigcRespVO.getData().toString(), AigcAccountRespVO.class); - // log.info(" account:{}", aigcAccountRespVO); + log.info(" account:{}", aigcAccountRespVO); return aigcAccountRespVO; } return null; @@ -149,16 +149,16 @@ public class TrainHttpService { login(headers); String finetuningDetail = llmBackendProperties.getFinetuningDetail(); String res = HttpUtils.get(finetuningDetail + "/" + jobId, headers); - // log.info(" finetuningDetail:{}", res); + log.info(" finetuningDetail:{}", res); try { AigcRespVO aigcRespVO = JSON.parseObject(res, AigcRespVO.class); if (aigcRespVO.isSuccess() && aigcRespVO.getData() != null) { AigcFineTuningDetailRespVO aigcFineTuningDetailRespVO = JSON.parseObject(aigcRespVO.getData().toString(), AigcFineTuningDetailRespVO.class); - // log.info(" finetuningDetail:{}", aigcFineTuningDetailRespVO); + log.info(" finetuningDetail:{}", aigcFineTuningDetailRespVO); return aigcFineTuningDetailRespVO; } } catch (Exception e) { - // log.error(" finetuningDetail:{}", e.getMessage()); + log.error(" finetuningDetail:{}", e.getMessage()); } return null; @@ -168,16 +168,16 @@ public class TrainHttpService { login(headers); String finetuningDetail = llmBackendProperties.getFinetuningDetail(); String res = HttpUtils.del(finetuningDetail + "/" + jobId, headers); - // log.info(" finetuningDelete:{}", res); + log.info(" finetuningDelete:{}", res); AigcRespVO aigcRespVO = JSON.parseObject(res, AigcRespVO.class); - // log.info(" finetuningDelete:{}", aigcRespVO); + log.info(" finetuningDelete:{}", aigcRespVO); return aigcRespVO; } public String finetuningFileList (Map headers) { String finetuningFileList = llmBackendProperties.getFinetuningFileList(); String res = HttpUtils.get(finetuningFileList, headers); - // log.info(" finetuningFileList:{}", res); + log.info(" finetuningFileList:{}", res); return res; } @@ -194,10 +194,10 @@ public class TrainHttpService { List dimension = Stream.of("事实性错误", "情感倾向性", "语义连贯性").collect(Collectors.toList()); jsonObject.put("dimension", dimension); String body = JSONObject.toJSONString(jsonObject); - // log.info(" autoEvaluation body :{}", body); - // log.info(" autoEvaluation url :{}", url + autoEvaluation); + log.info(" autoEvaluation body :{}", body); + log.info(" autoEvaluation url :{}", url + autoEvaluation); String res = HttpUtils.post(url + autoEvaluation, map, body); - // log.info(" autoEvaluation:{}", res); + log.info(" autoEvaluation:{}", res); JSONObject resJson = JSONObject.parseObject(res); JSONObject response = resJson.getJSONObject("response"); String content = response.getString("content"); @@ -216,36 +216,36 @@ public class TrainHttpService { public ModelDeployRespVO modelDeploy (Map headers, String url, AigcModelDeploySaveReq req) { try { - // log.info("开始部署模型,请求URL: {}", url + llmBackendProperties.getModelDeploy()); + log.info("开始部署模型,请求URL: {}", url + llmBackendProperties.getModelDeploy()); // 记录请求参数 - // log.info("请求参数: {}", JSON.toJSONString(req)); + log.info("请求参数: {}", JSON.toJSONString(req)); // 发起 HTTP POST 请求 String res = HttpUtils.post(url + llmBackendProperties.getModelDeploy(), headers, JSON.toJSONString(req)); - // log.info("HTTP 请求完成。响应内容: {}", res); + log.info("HTTP 请求完成。响应内容: {}", res); // 解析响应内容 - // log.debug("正在解析响应内容..."); + log.debug("正在解析响应内容..."); JSONObject parseObject = JSON.parseObject(res); ModelDeployRespVO modelDeployRespVO = new ModelDeployRespVO(); // 检查响应是否包含错误 if (parseObject.containsKey("error")) { - // log.error("模型部署失败。响应中包含错误信息: {}", parseObject.getString("error")); + log.error("模型部署失败。响应中包含错误信息: {}", parseObject.getString("error")); modelDeployRespVO.setMessage("error"); return modelDeployRespVO; } // 解析响应为 ModelDeployRespVO 对象 modelDeployRespVO = JSON.parseObject(res.getBytes(), ModelDeployRespVO.class); - // log.info("模型部署成功。部署结果: {}", JSON.toJSONString(modelDeployRespVO)); + log.info("模型部署成功。部署结果: {}", JSON.toJSONString(modelDeployRespVO)); // 返回结果 return modelDeployRespVO; } catch (Exception e) { - // log.error("部署模型时发生异常。请求URL: {}", url + llmBackendProperties.getModelDeploy(), e); + log.error("部署模型时发生异常。请求URL: {}", url + llmBackendProperties.getModelDeploy(), e); ModelDeployRespVO errorResp = new ModelDeployRespVO(); errorResp.setMessage("error"); return errorResp; @@ -254,28 +254,28 @@ public class TrainHttpService { public AigcModelDeployVO modelUndeploy (Map headers, String url, Long deployId) { try { - // log.info("开始卸载模型部署,部署ID: {}", deployId); + log.info("开始卸载模型部署,部署ID: {}", deployId); // 构建请求 URL String modelDeploy = llmBackendProperties.getModelUndeploy(); String requestUrl = url + modelDeploy + deployId; - // log.info("构建请求 URL: {}", requestUrl); + log.info("构建请求 URL: {}", requestUrl); // 发起 HTTP POST 请求 - // log.info("正在发起 HTTP POST 请求..."); + log.info("正在发起 HTTP POST 请求..."); String res = HttpUtils.post(requestUrl, headers, ""); - // log.info("HTTP 请求完成。响应内容: {}", res); + log.info("HTTP 请求完成。响应内容: {}", res); // 解析响应内容 - // log.info("正在解析响应内容..."); + log.info("正在解析响应内容..."); AigcModelDeployVO modelDeployRespVO = JSON.parseObject(res, AigcModelDeployVO.class); - // log.info("响应解析完成。模型卸载结果: {}", JSON.toJSONString(modelDeployRespVO)); + log.info("响应解析完成。模型卸载结果: {}", JSON.toJSONString(modelDeployRespVO)); // 返回结果 return modelDeployRespVO; } catch (Exception e) { - // log.error("卸载模型部署时发生异常。部署ID: {}", deployId, e); + log.error("卸载模型部署时发生异常。部署ID: {}", deployId, e); throw new RuntimeException("模型卸载失败", e); } @@ -288,14 +288,14 @@ public class TrainHttpService { // login(headers); String modelDeploy = llmBackendProperties.getModelCreate(); String res = HttpUtils.post(modelDeploy, headers, JSON.toJSONString(req)); - // log.info(" modelDeploy:{}", res); + log.info(" modelDeploy:{}", res); AigcRespVO aigcRespVO = JSON.parseObject(res, AigcRespVO.class); if (aigcRespVO.isSuccess() && aigcRespVO.getData() != null) { AigcModelCreateRespVO aigcModelCreateRespVO = JSON.parseObject(aigcRespVO.getData().toString(), AigcModelCreateRespVO.class); - // log.info(" modelDeploy:{}", aigcModelCreateRespVO); + log.info(" modelDeploy:{}", aigcModelCreateRespVO); return aigcModelCreateRespVO; } - // log.info(" modelDeploy:{}", aigcRespVO); + log.info(" modelDeploy:{}", aigcRespVO); return null; } @@ -320,11 +320,11 @@ public class TrainHttpService { .field("file", inputStream, fileName) .field("purpose", "fine-tune") .asString(); - // log.info("Response Body: " + uploadResponse.getBody()); + log.info("Response Body: " + uploadResponse.getBody()); AigcRespVO aigcRespVO = JSON.parseObject(uploadResponse.getBody(), AigcRespVO.class); if (aigcRespVO.isSuccess()) { AigcDatasetFileRespV0 aigcDatasetFileRespV0 = JSON.parseObject(aigcRespVO.getData().toString(), AigcDatasetFileRespV0.class); - // log.info("模型工厂上传文件 aigcDatasetFileRespV0:{}", aigcDatasetFileRespV0); + log.info("模型工厂上传文件 aigcDatasetFileRespV0:{}", aigcDatasetFileRespV0); return aigcDatasetFileRespV0; } return null; @@ -339,9 +339,9 @@ public class TrainHttpService { String finetuningCancel = llmBackendProperties.getFinetuningCancel(); String url = String.format(finetuningCancel, jobId); String res = HttpUtils.del(url, headers); - // log.info(" finetuningDelete:{}", res); + log.info(" finetuningDelete:{}", res); AigcRespVO aigcRespVO = JSON.parseObject(res, AigcRespVO.class); - // log.info(" finetuningDelete:{}", aigcRespVO); + log.info(" finetuningDelete:{}", aigcRespVO); return aigcRespVO; }