Commit Graph
2 Commits
Author SHA1 Message Date
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
zhuyongxin 360e4febae feat(phase1): 完成分层结构优化和 DTO 创建
Task 4.2: 分层结构优化
- 创建 exception 包
  - SessionNotFoundException: 会话未找到异常
  - DocumentProcessException: 文档处理异常
- 已有分层结构验证
  - controller: 控制器层 ✅
  - service: 业务逻辑层 ✅
  - repository: 数据访问层 ✅
  - domain: 领域模型层 (entity/model/enums) ✅
  - config: 配置层 ✅
  - tool: 工具类 ✅

Task 4.3: 创建 DTO 类
- DiagnosisRequest: 诊断请求 DTO (10 个字段)
- DiagnosisResponse: 诊断响应 DTO (12 个字段 + 内部类)
- DocumentUploadRequest: 文档上传请求 DTO (7 个字段)
- DocumentQueryResponse: 文档查询响应 DTO (11 个字段 + 内部类)
- Result<T>: 统一响应结果 DTO (泛型包装)

功能特性:
- 异常类支持自定义错误信息和原因链
- DTO 使用 Lombok 简化代码
- Result 提供静态工厂方法(success/error)
- DocumentUploadRequest 支持 MultipartFile
- Response DTO 支持嵌套数据结构

编译验证:BUILD SUCCESS

Progress: 23/33 tasks completed (70%)
2026-06-23 15:02:38 +08:00