fix(llm): 修复知识库文件上传成功后异常处理
- 修复了文件上传成功后,解析响应数据时可能出现的空指针异常 - 优化了错误处理逻辑,当响应中不包含 "status" 字段时,直接抛出异常 - 移除了 handleFailure 方法中冗余的异常信息
This commit is contained in:
parent
14a5e3fd3a
commit
cee050c56a
@ -337,9 +337,10 @@ public class RagHttpService {
|
||||
log.info("解析后的JSON响应: {}", parseObject);
|
||||
|
||||
// 如果状态为true,则更新文件状态为上传成功,否则更新为上传失败
|
||||
if (parseObject.getBooleanValue("status")) {
|
||||
if (parseObject.containsKey("status") && parseObject.getBoolean("status")) {
|
||||
// 修改状态为 上传成功
|
||||
updateFileState(documents, KnowledgeStatusEnum.UPLOAD_SUCCESS);
|
||||
} else {
|
||||
} else {
|
||||
String errorMsg = parseObject.getString("error");
|
||||
updateFileState(documents, KnowledgeStatusEnum.UPLOAD_FAILED);
|
||||
throw exception(new ErrorCode(10047, errorMsg));
|
||||
@ -356,7 +357,7 @@ public class RagHttpService {
|
||||
private void handleFailure (KnowledgeDocumentsDO documents, String errorMsg, Exception e) {
|
||||
updateFileState(documents, KnowledgeStatusEnum.UPLOAD_FAILED);
|
||||
log.error("handleFailure {}: {}", errorMsg, e.getMessage());
|
||||
throw new RuntimeException(errorMsg, e);
|
||||
throw new RuntimeException(errorMsg);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user