mirror of
https://gitcode.com/ageerle/ruoyi-ai.git
synced 2026-04-14 12:23:39 +00:00
feat: 代码优化
This commit is contained in:
@@ -47,36 +47,40 @@ public class VectorStoreServiceImpl implements VectorStoreService {
|
|||||||
@Override
|
@Override
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void createSchema(String kid,String modelName) {
|
public void createSchema(String kid,String modelName) {
|
||||||
if(modelName.equals("weaviate")){
|
switch (modelName) {
|
||||||
String protocol = configService.getConfigValue("weaviate", "protocol");
|
case "weaviate" -> {
|
||||||
String host = configService.getConfigValue("weaviate", "host");
|
String protocol = configService.getConfigValue("weaviate", "protocol");
|
||||||
String className = configService.getConfigValue("weaviate", "classname");
|
String host = configService.getConfigValue("weaviate", "host");
|
||||||
this.embeddingStore = WeaviateEmbeddingStore.builder()
|
String className = configService.getConfigValue("weaviate", "classname");
|
||||||
.scheme(protocol)
|
this.embeddingStore = WeaviateEmbeddingStore.builder()
|
||||||
.host(host)
|
.scheme(protocol)
|
||||||
.objectClass(className+kid)
|
.host(host)
|
||||||
.scheme(protocol)
|
.objectClass(className + kid)
|
||||||
.avoidDups(true)
|
.scheme(protocol)
|
||||||
.consistencyLevel("ALL")
|
.avoidDups(true)
|
||||||
.build();
|
.consistencyLevel("ALL")
|
||||||
}else if(modelName.equals("milvus")){
|
.build();
|
||||||
String uri = configService.getConfigValue("milvus", "host");
|
}
|
||||||
String collection = configService.getConfigValue("milvus", "collection");
|
case "milvus" -> {
|
||||||
String dimension = configService.getConfigValue("milvus", "dimension");
|
String uri = configService.getConfigValue("milvus", "host");
|
||||||
this.embeddingStore = MilvusEmbeddingStore.builder()
|
String collection = configService.getConfigValue("milvus", "collection");
|
||||||
.uri(uri)
|
String dimension = configService.getConfigValue("milvus", "dimension");
|
||||||
.collectionName(collection+kid)
|
this.embeddingStore = MilvusEmbeddingStore.builder()
|
||||||
.dimension(Integer.parseInt(dimension))
|
.uri(uri)
|
||||||
.build();
|
.collectionName(collection + kid)
|
||||||
}else if(modelName.equals("qdrant")){
|
.dimension(Integer.parseInt(dimension))
|
||||||
String host = configService.getConfigValue("qdrant", "host");
|
.build();
|
||||||
String port = configService.getConfigValue("qdrant", "port");
|
}
|
||||||
String collectionName = configService.getConfigValue("qdrant", "collectionName");
|
case "qdrant" -> {
|
||||||
this.embeddingStore = QdrantEmbeddingStore.builder()
|
String host = configService.getConfigValue("qdrant", "host");
|
||||||
.host(host)
|
String port = configService.getConfigValue("qdrant", "port");
|
||||||
.port(Integer.parseInt(port))
|
String collectionName = configService.getConfigValue("qdrant", "collectionName");
|
||||||
.collectionName(collectionName)
|
this.embeddingStore = QdrantEmbeddingStore.builder()
|
||||||
.build();
|
.host(host)
|
||||||
|
.port(Integer.parseInt(port))
|
||||||
|
.collectionName(collectionName)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user