Просмотр исходного кода

fix:【AI 大模型】RedisVectorStore 支持 username、password

YunaiV месяцев назад: 11
Родитель
Сommit
ea5b12f21e

+ 2 - 3
yudao-module-ai/src/main/java/cn/iocoder/yudao/module/ai/framework/ai/core/AiModelFactoryImpl.java

@@ -690,10 +690,9 @@ public class AiModelFactoryImpl implements AiModelFactory {
                                                    Map<String, Class<?>> metadataFields) {
         // 创建 JedisPooled 对象
         RedisProperties redisProperties = SpringUtils.getBean(RedisProperties.class);
-        JedisPooled jedisPooled = new JedisPooled(redisProperties.getHost(), redisProperties.getPort());
+        JedisPooled jedisPooled = new JedisPooled(redisProperties.getHost(), redisProperties.getPort(),
+                redisProperties.getUsername(), redisProperties.getPassword());
         // 创建 RedisVectorStoreProperties 对象
-        // TODO @芋艿:index-name 可能影响索引名;
-        RedisVectorStoreAutoConfiguration configuration = new RedisVectorStoreAutoConfiguration();
         RedisVectorStoreProperties properties = SpringUtil.getBean(RedisVectorStoreProperties.class);
         RedisVectorStore redisVectorStore = RedisVectorStore.builder(jedisPooled, embeddingModel)
                 .indexName(properties.getIndexName()).prefix(properties.getPrefix())

+ 1 - 1
yudao-server/src/main/resources/application.yaml

@@ -150,7 +150,7 @@ spring:
     vectorstore: # 向量存储
       redis:
         initialize-schema: true
-        index: knowledge_index # Redis 中向量索引的名称:用于存储和检索向量数据的索引标识符,所有相关的向量搜索操作都会基于这个索引进行
+        index-name: knowledge_index # Redis 中向量索引的名称:用于存储和检索向量数据的索引标识符,所有相关的向量搜索操作都会基于这个索引进行
         prefix: "knowledge_segment:" # Redis 中存储向量数据的键名前缀:这个前缀会添加到每个存储在 Redis 中的向量数据键名前,每个 document 都是一个 hash 结构
       qdrant:
         initialize-schema: true