mirror of
https://gitcode.com/ageerle/ruoyi-ai.git
synced 2026-04-16 05:13:41 +00:00
feat: 代码优化
This commit is contained in:
@@ -47,28 +47,31 @@ 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) {
|
||||||
|
case "weaviate" -> {
|
||||||
String protocol = configService.getConfigValue("weaviate", "protocol");
|
String protocol = configService.getConfigValue("weaviate", "protocol");
|
||||||
String host = configService.getConfigValue("weaviate", "host");
|
String host = configService.getConfigValue("weaviate", "host");
|
||||||
String className = configService.getConfigValue("weaviate", "classname");
|
String className = configService.getConfigValue("weaviate", "classname");
|
||||||
this.embeddingStore = WeaviateEmbeddingStore.builder()
|
this.embeddingStore = WeaviateEmbeddingStore.builder()
|
||||||
.scheme(protocol)
|
.scheme(protocol)
|
||||||
.host(host)
|
.host(host)
|
||||||
.objectClass(className+kid)
|
.objectClass(className + kid)
|
||||||
.scheme(protocol)
|
.scheme(protocol)
|
||||||
.avoidDups(true)
|
.avoidDups(true)
|
||||||
.consistencyLevel("ALL")
|
.consistencyLevel("ALL")
|
||||||
.build();
|
.build();
|
||||||
}else if(modelName.equals("milvus")){
|
}
|
||||||
|
case "milvus" -> {
|
||||||
String uri = configService.getConfigValue("milvus", "host");
|
String uri = configService.getConfigValue("milvus", "host");
|
||||||
String collection = configService.getConfigValue("milvus", "collection");
|
String collection = configService.getConfigValue("milvus", "collection");
|
||||||
String dimension = configService.getConfigValue("milvus", "dimension");
|
String dimension = configService.getConfigValue("milvus", "dimension");
|
||||||
this.embeddingStore = MilvusEmbeddingStore.builder()
|
this.embeddingStore = MilvusEmbeddingStore.builder()
|
||||||
.uri(uri)
|
.uri(uri)
|
||||||
.collectionName(collection+kid)
|
.collectionName(collection + kid)
|
||||||
.dimension(Integer.parseInt(dimension))
|
.dimension(Integer.parseInt(dimension))
|
||||||
.build();
|
.build();
|
||||||
}else if(modelName.equals("qdrant")){
|
}
|
||||||
|
case "qdrant" -> {
|
||||||
String host = configService.getConfigValue("qdrant", "host");
|
String host = configService.getConfigValue("qdrant", "host");
|
||||||
String port = configService.getConfigValue("qdrant", "port");
|
String port = configService.getConfigValue("qdrant", "port");
|
||||||
String collectionName = configService.getConfigValue("qdrant", "collectionName");
|
String collectionName = configService.getConfigValue("qdrant", "collectionName");
|
||||||
@@ -79,6 +82,7 @@ public class VectorStoreServiceImpl implements VectorStoreService {
|
|||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void storeEmbeddings(StoreEmbeddingBo storeEmbeddingBo) {
|
public void storeEmbeddings(StoreEmbeddingBo storeEmbeddingBo) {
|
||||||
|
|||||||
Reference in New Issue
Block a user