refactor(yudao-module-llm): 调整上传文件的 socket 超时时间- 将 Unirest 配置中的 socketTimeout 从 60000 毫秒(1分钟)增加到 86400000毫秒(24小时)- 此修改可能是为了适应大文件上传或网络条件较差的场景,给予上传过程更多的时间完成
This commit is contained in:
parent
223966c285
commit
7013594161
@ -117,7 +117,7 @@ public class RagHttpService {
|
||||
|
||||
// 上传文件
|
||||
Unirest.config().reset();
|
||||
Unirest.config().socketTimeout(60000);
|
||||
Unirest.config().socketTimeout(86400000);
|
||||
HttpResponse<String> uploadResponse = Unirest.post(ragUploadReqVO.getUrl())
|
||||
.field("file_id", ragUploadReqVO.getFileId())
|
||||
.field("file", new ByteArrayInputStream(utf8Bytes), ragUploadReqVO.getFileName()) // 使用文件名 "file.txt" 作为示例
|
||||
@ -133,7 +133,7 @@ public class RagHttpService {
|
||||
} else {
|
||||
// 修改状态为 上传失败
|
||||
updateFileState(documents, KnowledgeStatusEnum.UPLOAD_FAILED);
|
||||
throw new RuntimeException("文件上传失败:"+ragEmbedRespVO.getMessage());
|
||||
throw new RuntimeException("文件上传失败:" + ragEmbedRespVO.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -273,7 +273,7 @@ public class RagHttpService {
|
||||
JSONObject parseObject = JSON.parseObject(responseBody);
|
||||
log.info(" ========= Response Body Result: {}", responseBody);
|
||||
|
||||
if (parseObject.getBoolean("status")) {
|
||||
if (parseObject.containsKey("status") && parseObject.getBoolean("status")) {
|
||||
// 修改状态为 上传成功
|
||||
updateFileState(documents, KnowledgeStatusEnum.UPLOAD_SUCCESS);
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user