2026-04-28 ebd79c8749eea0c4b3ca88b4eac0229cb11d1684
src/main/java/com/ruoyi/ai/config/XiaozhiAgentConfig.java
@@ -53,33 +53,33 @@
                .build();
    }
    @Bean
    ContentRetriever contentRetrieverXiaozhi() {
        //使用FileSystemDocumentLoader读取指定目录下的知识库文档
        //并使用默认的文档解析器对文档进行解析
        Document document1 = FileSystemDocumentLoader.loadDocument(one);
//        Document document2 = FileSystemDocumentLoader.loadDocument(two);
//        Document document3 = FileSystemDocumentLoader.loadDocument(three);
//        List<Document> documents = Arrays.asList(document1, document2, document3);
        List<Document> documents = Collections.singletonList(document1);
//         2. 将数据库数据转为LangChain4j的Document对象
//        List<Document> documents = new ArrayList<>();
        //使用内存向量存储
        InMemoryEmbeddingStore<TextSegment> inMemoryEmbeddingStore = new InMemoryEmbeddingStore<>();
        //使用默认的文档分割器
        EmbeddingStoreIngestor.builder()
                .embeddingModel(embeddingModel)
                .embeddingStore(inMemoryEmbeddingStore)
                .build()
                .ingest(documents);
        //从嵌入存储(EmbeddingStore)里检索和查询内容相关的信息
        return EmbeddingStoreContentRetriever.builder()
                .embeddingModel(embeddingModel)
                .embeddingStore(inMemoryEmbeddingStore)
                .build();
    }
//    @Bean
//    ContentRetriever contentRetrieverXiaozhi() {
//        //使用FileSystemDocumentLoader读取指定目录下的知识库文档
//        //并使用默认的文档解析器对文档进行解析
//        Document document1 = FileSystemDocumentLoader.loadDocument(one);
////        Document document2 = FileSystemDocumentLoader.loadDocument(two);
////        Document document3 = FileSystemDocumentLoader.loadDocument(three);
////        List<Document> documents = Arrays.asList(document1, document2, document3);
//
//        List<Document> documents = Collections.singletonList(document1);
////         2. 将数据库数据转为LangChain4j的Document对象
////        List<Document> documents = new ArrayList<>();
//
//        //使用内存向量存储
//        InMemoryEmbeddingStore<TextSegment> inMemoryEmbeddingStore = new InMemoryEmbeddingStore<>();
//        //使用默认的文档分割器
//        EmbeddingStoreIngestor.builder()
//                .embeddingModel(embeddingModel)
//                .embeddingStore(inMemoryEmbeddingStore)
//                .build()
//                .ingest(documents);
//        //从嵌入存储(EmbeddingStore)里检索和查询内容相关的信息
//        return EmbeddingStoreContentRetriever.builder()
//                .embeddingModel(embeddingModel)
//                .embeddingStore(inMemoryEmbeddingStore)
//                .build();
//    }
    @Bean
    ContentRetriever contentRetrieverXiaozhiPincone() {