Files
SuperBizAgent-java/src/main/java/com/superbiz/agent/dto/DocumentUploadRequest.java
T
zhuyongxin 24101a8d66 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
2026-06-23 16:43:47 +08:00

58 lines
1002 B
Java
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package com.superbiz.agent.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.web.multipart.MultipartFile;
/**
* 文档上传请求 DTO
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class DocumentUploadRequest {
/**
* 上传的文件
*/
private MultipartFile file;
/**
* 文档类别(api、domain、troubleshoot 等,默认 upload)
*/
private String category;
/**
* 故障类别(默认 EXTERNAL_API)
*/
private String faultCategory;
/**
* 故障源(省份/服务名)
*/
private String faultSource;
/**
* 接口名称
*/
private String apiName;
/**
* 文档版本
*/
private String version;
/**
* 分块大小(默认 500)
*/
private Integer chunkSize;
/**
* 重叠大小(默认 50)
*/
private Integer chunkOverlap;
}