- 新增 DocumentController 提供文档导入 API - 新增 DocumentService 实现文档读取、分割、向量化存储 - 新增 RagConfig 配置 TokenTextSplitter - 添加 doris_intro.md 作为示例 RAG 文档 - 启用 milvus-sdk-java 依赖 - 配置 SiliconFlow Embedding 服务 (BAAI/bge-large-zh-v1.5) - 配置 Milvus 向量数据库连接
32 lines
807 B
Java
32 lines
807 B
Java
package com.demo.controller;
|
|
|
|
import com.demo.service.DocumentService;
|
|
import lombok.RequiredArgsConstructor;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import java.io.IOException;
|
|
|
|
|
|
@RestController
|
|
@RequestMapping("api/documents")
|
|
@RequiredArgsConstructor
|
|
public class DocumentController {
|
|
|
|
@Autowired
|
|
public final DocumentService documentService;
|
|
|
|
@GetMapping("import")
|
|
public String importDocument() {
|
|
try {
|
|
documentService.importDocument();
|
|
} catch (IOException e) {
|
|
return "not ok" + e.getMessage();
|
|
}
|
|
return "ok";
|
|
}
|
|
}
|
|
|