refactor(module-llm):优化日志打印和异常处理- 修改了 AsyncKnowledgeBase 类中的日志打印格式

- 移除了 RagHttpService 类中不必要的 Unirest.shutDown()调用
- 增加了 JSON 解析前的字符串响应体日志打印
- 优化了异常处理,移除了多余的 finally 块
This commit is contained in:
Liuyang 2025-02-12 17:16:00 +08:00
parent b23daaa314
commit 671766700e
3 changed files with 3 additions and 7 deletions

View File

@ -119,7 +119,7 @@ public class AsyncKnowledgeBase {
ragHttpService.knowledgeEmbed(ragEmbedReqVo, id);
} catch (Exception e) {
log.error("the creation of the knowledge base error {}", e.getMessage(), e);
log.error("the creation of the knowledge base error : {}", e.getMessage(), e);
throw e;
}
}

View File

@ -157,8 +157,6 @@ public class RagHttpService {
} else {
throw new RuntimeException("文件上传失败: " + e.getMessage(), e);
}
} finally {
Unirest.shutDown();
}
}
@ -311,8 +309,9 @@ public class RagHttpService {
// 检查响应状态
String responseBody = response.getBody();
log.info(" ========= String Response Body Result: {}", responseBody);
JSONObject parseObject = JSON.parseObject(responseBody);
log.info(" ========= Response Body Result: {}", responseBody);
log.info(" ========= JSON Response Body Result: {}", responseBody);
if (parseObject.containsKey("status") && parseObject.getBoolean("status")) {
// 修改状态为 上传成功
@ -330,8 +329,6 @@ public class RagHttpService {
} else {
throw new RuntimeException("文件上传失败: " + e.getMessage(), e);
}
} finally {
Unirest.shutDown();
}
}

View File

@ -114,7 +114,6 @@ public class KnowledgeBaseServiceImpl implements KnowledgeBaseService {
// 4.4 异步处理新增文档和删除的文档
List<Long> deleteIds = knowledgeDocumentsMapper.selectDeleteIds(updateReqVO.getId());
log.info("注释..");
asyncKnowledgeBase.createKnowledgeBase(newDocuments, deleteIds);
} else {
// 5. 如果传入的文档列表为空则删除所有关联文档