feat(phase1): 支持上传时指定文档类别
功能增强: - DocumentController 新增 category 参数 POST /api/documents/upload?category=api - DocumentUploadRequest 新增 category 字段 - 支持用户指定:api、domain、troubleshoot 等 - 默认值:upload(未指定时) - VectorIndexService.indexDocumentChunks 接收 category - 将用户指定的类别存入 Milvus metadata - metadata.category = 用户指定值 或 "upload" 使用示例: ```bash # 上传 API 文档 curl -X POST /api/documents/upload \ -F "file=@redis-api.md" \ -F "category=api" # 上传领域知识文档 curl -X POST /api/documents/upload \ -F "file=@cache-theory.md" \ -F "category=domain" # 检索时按类别过滤 searchSimilarDocuments("Redis接口", 5, "api") ``` 完整流程: 1. 文件索引:自动从路径提取(aiops-docs/api/ → "api") 2. 用户上传:从接口参数获取(category=api) 3. 检索时:可按类别过滤(category 参数) 编译验证:BUILD SUCCESS
This commit is contained in:
@@ -20,6 +20,11 @@ public class DocumentUploadRequest {
|
||||
*/
|
||||
private MultipartFile file;
|
||||
|
||||
/**
|
||||
* 文档类别(api、domain、troubleshoot 等,默认 upload)
|
||||
*/
|
||||
private String category;
|
||||
|
||||
/**
|
||||
* 故障类别(默认 EXTERNAL_API)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user