feat(ai-knowledge-base): 实现AI知识库文档上传与管理功能
- 新增AiDocument实体类,映射数据库ai_document表结构 - 添加AiDocumentMapper接口,提供文档增删改查及状态更新等数据库操作 - 实现AiKnowledgeBaseService接口及其实现类AiKnowledgeBaseServiceImpl,支持文件上传、文档列表查询、删除和重新索引 - 在AiKnowledgeBaseController中提供REST接口支持文件上传、文档管理和异步重新索引操作 - 实现DocumentProcessor组件,负责文档解析、文本切片、摘要生成和向量化存储 - 集成MinioService实现文件的上传、下载和删除操作 - 设计KbDocumentVO作为知识库文档视图对象,方便接口数据传输和展示 - 增加文件类型支持和上传文件校验,限制最大50MB文件大小 - 使用异步机制处理文档解析和向量化,提高系统处理性能和响应速度 - 实现文档状态管理和错误处理,确保文档处理流程的正确性和稳定性
This commit is contained in:
@@ -13,7 +13,6 @@ import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* AI知识库控制器
|
||||
@@ -98,7 +97,7 @@ public class AiKnowledgeBaseController {
|
||||
*/
|
||||
@DeleteMapping("/document/{docId}")
|
||||
@Operation(summary = "删除文档", description = "删除指定的知识库文档")
|
||||
public BaseResponse<Void> deleteDocument(@PathVariable UUID docId) {
|
||||
public BaseResponse<Void> deleteDocument(@PathVariable String docId) {
|
||||
Long userId = SecurityUtils.getCurrentUserId();
|
||||
if (userId == null) {
|
||||
return ResultUtils.error("用户未登录");
|
||||
@@ -121,7 +120,7 @@ public class AiKnowledgeBaseController {
|
||||
*/
|
||||
@PostMapping("/document/{docId}/reindex")
|
||||
@Operation(summary = "重新索引文档", description = "重新解析并索引指定的文档")
|
||||
public BaseResponse<Void> reindexDocument(@PathVariable UUID docId) {
|
||||
public BaseResponse<Void> reindexDocument(@PathVariable String docId) {
|
||||
Long userId = SecurityUtils.getCurrentUserId();
|
||||
if (userId == null) {
|
||||
return ResultUtils.error("用户未登录");
|
||||
|
||||
Reference in New Issue
Block a user