refactor(llm): 优化知识库服务实现

- 添加日志记录
- 优化代码结构- 增加注释说明
This commit is contained in:
Liuyang 2025-02-12 15:43:29 +08:00
parent 90eef88e89
commit 223966c285

View File

@ -18,6 +18,7 @@ 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 lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -40,6 +41,7 @@ import static cn.iocoder.yudao.module.llm.enums.ErrorCodeConstants.KNOWLEDGE_BAS
*
* @author 华大大模型
*/
@Slf4j
@Service
@Validated
public class KnowledgeBaseServiceImpl implements KnowledgeBaseService {
@ -112,6 +114,7 @@ public class KnowledgeBaseServiceImpl implements KnowledgeBaseService {
// 4.4 异步处理新增文档和删除的文档
List<Long> deleteIds = knowledgeDocumentsMapper.selectDeleteIds(updateReqVO.getId());
log.info("注释..");
asyncKnowledgeBase.createKnowledgeBase(newDocuments, deleteIds);
} else {
// 5. 如果传入的文档列表为空则删除所有关联文档