From 972eab3262feb401a851d802aee0194cc5b80db6 Mon Sep 17 00:00:00 2001 From: Liuyang <2746366019@qq.com> Date: Sat, 8 Feb 2025 17:43:27 +0800 Subject: [PATCH] =?UTF-8?q?perf(llm):=20=E4=BC=98=E5=8C=96=E7=9F=A5?= =?UTF-8?q?=E8=AF=86=E5=BA=93=E6=9B=B4=E6=96=B0=E5=8A=9F=E8=83=BD=E5=92=8C?= =?UTF-8?q?=20HTTP=20=E8=AF=B7=E6=B1=82=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 更新知识库时增加了 HTTP 请求配置,提高请求超时时间和并发处理能力 - 设置默认的 Accept头为 application/json,提高与外部服务的兼容性 --- .../service/knowledgebase/KnowledgeBaseServiceImpl.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/knowledgebase/KnowledgeBaseServiceImpl.java b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/knowledgebase/KnowledgeBaseServiceImpl.java index 152216b96..d13c8b20c 100644 --- a/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/knowledgebase/KnowledgeBaseServiceImpl.java +++ b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/knowledgebase/KnowledgeBaseServiceImpl.java @@ -17,6 +17,7 @@ import cn.iocoder.yudao.module.llm.dal.mysql.knowledgedocuments.KnowledgeDocumen import cn.iocoder.yudao.module.llm.service.application.ApplicationService; import cn.iocoder.yudao.module.llm.service.async.AsyncKnowledgeBase; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import kong.unirest.Unirest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; @@ -71,6 +72,13 @@ public class KnowledgeBaseServiceImpl implements KnowledgeBaseService { KnowledgeBaseDO updateObj = BeanUtils.toBean(updateReqVO, KnowledgeBaseDO.class); knowledgeBaseMapper.updateById(updateObj); + Unirest.config() + .socketTimeout(50000) + .connectTimeout(100000) + .concurrency(10, 5) + .setDefaultHeader("Accept", "application/json") + ; + // 4. 处理附表(知识文档)数据 if (!CollectionUtils.isAnyEmpty(updateReqVO.getKnowledgeDocuments())) { // 4.1 获取需要保留的文档 ID