知识库功能增强,支持Milvus,并优化相关逻辑

This commit is contained in:
2026-02-24 11:19:53 +08:00
parent 148a08a3f1
commit 094b185c49
10 changed files with 196 additions and 59 deletions

View File

@@ -4,6 +4,10 @@ import cn.dev33.satoken.annotation.SaCheckPermission;
import com.easyagents.core.document.Document;
import com.mybatisflex.core.query.QueryWrapper;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import tech.easyflow.ai.entity.BotDocumentCollection;
import tech.easyflow.ai.entity.DocumentCollection;
import tech.easyflow.ai.service.BotDocumentCollectionService;
@@ -12,10 +16,6 @@ import tech.easyflow.ai.service.DocumentCollectionService;
import tech.easyflow.ai.service.ModelService;
import tech.easyflow.common.domain.Result;
import tech.easyflow.common.web.controller.BaseCurdController;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import tech.easyflow.common.web.exceptions.BusinessException;
import javax.annotation.Resource;
@@ -70,11 +70,14 @@ public class DocumentCollectionController extends BaseCurdController<DocumentCol
if (isSave){
Map<String, Object> options = new HashMap<>();
Map<String, Object> options = entity.getOptions() == null
? new HashMap<>()
: new HashMap<>(entity.getOptions());
if (entity.getSearchEngineEnable() == null){
entity.setSearchEngineEnable(false);
}
options.put("canUpdateEmbeddingModel", true);
options.putIfAbsent(DocumentCollection.KEY_CAN_UPDATE_EMBEDDING_MODEL, true);
options.putIfAbsent(DocumentCollection.KEY_RERANK_ENABLE, entity.getRerankModelId() != null);
entity.setOptions(options);
}
return super.onSaveOrUpdateBefore(entity, isSave);