zhuyongxin
|
e76d4ce48f
|
feat(phase1): 完成文档查询和删除接口
Task 5.4: 文档查询接口
- DocumentManagementService 新增查询方法:
- queryDocumentById: 根据 docId 查询单个文档
- queryDocumentsByStatus: 根据状态查询(分页)
- queryDocumentsByFaultSource: 根据故障源查询
- convertToResponse: 实体转 DTO 工具方法
- DocumentController 新增 RESTful 接口:
- GET /api/documents/{docId}
- GET /api/documents/status/{status}?page=0&size=20
- GET /api/documents/faultSource/{faultSource}
Task 5.5: 文档删除接口
- DocumentManagementService 新增删除方法:
- deleteDocument: 删除文档元数据
- TODO: 向量索引删除待实现
- DocumentController 新增删除接口:
- DELETE /api/documents/{docId}
功能特性:
- 统一异常处理:DocumentProcessException
- 统一响应格式:Result<T>
- 分页支持:Page/PageRequest
- 事务支持:@Transactional
编译验证:BUILD SUCCESS
Progress: 28/33 tasks completed (85%)
|
2026-06-23 15:48:04 +08:00 |
|
zhuyongxin
|
f446290d0f
|
feat(phase1): 完成文档上传接口
Task 5.3: 文档上传接口
- 创建 DocumentManagementService:文档上传核心逻辑
- 文件格式验证(仅 .md/.txt)
- 文件 hash 计算与去重检查
- 文本提取与分块处理
- 文档元数据持久化(ApiDocument)
- 向量化索引标记为 TODO(待补充)
- 创建 DocumentController:RESTful 上传接口
- POST /api/documents/upload
- 支持参数:file, faultCategory, faultSource, apiName, version
- 返回:文档 docId
功能特性:
- MD5 hash 去重:防止重复上传
- 事务支持:元数据与索引状态一致性
- 异常处理:DocumentProcessException 统一封装
- 分块配置:使用 DocumentChunkConfig 默认配置
待补充:
- TODO: VectorIndexService.indexDocumentChunks() 实现
- 当前文档状态直接标记为 INDEXED
编译验证:BUILD SUCCESS
Progress: 26/33 tasks completed (79%)
|
2026-06-23 15:28:02 +08:00 |
|
zhuyongxin
|
ea77518880
|
feat(phase1): 完成文本提取和文档分块服务
Task 5.1: TextExtractor 服务
- 创建 TextExtractorService(仅支持 .md 和 .txt)
- 其他格式(.docx、.pdf)需通过外部转换服务先转为 Markdown
- 支持 UTF-8 编码的纯文本提取
- 提供文件格式验证方法
Task 5.2: 文档分块服务适配
- 修改 DocumentChunk DTO:添加 @Builder 支持
- 字段重命名:startIndex/endIndex → startOffset/endOffset
- 修复 DocumentChunkService 中的三处构造调用
- 使用 builder 模式替代构造函数
技术决策:
- 简化文本提取,只支持 Markdown 和纯文本
- 复杂格式转换由外部服务处理(分离关注点)
- 统一使用 Lombok @Builder 简化对象构建
编译验证:BUILD SUCCESS
Progress: 25/33 tasks completed (76%)
|
2026-06-23 15:15:10 +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 |
|
zhuyongxin
|
c3a232540a
|
refactor(phase1): 完成包名重构 (org.example → com.superbiz.agent)
Task 4.1: 包名统一重构
- 重命名 41 个 Java 文件的包名
- 更新所有 import 语句
- 恢复枚举类(FaultCategory、DiagnosisStatus、SourceType)
- 更新测试类的 import
重构范围:
- domain/entity: 3 个实体类
- domain/model: 2 个数据类
- domain/enums: 3 个枚举类
- repository: 3 个接口
- service/session: 2 个类(接口 + 实现)
- config: 9 个配置类
- controller: 2 个控制器
- agent/tool: 4 个工具类
- client: 1 个客户端
- Main.java: 主类
验证结果:
- 编译成功,无错误
- 所有测试通过 (27/27)
- ApiDocumentRepositoryTest: 7/7 ✅
- CaseLibraryRepositoryTest: 6/6 ✅
- DiagnosisRecordRepositoryTest: 6/6 ✅
- RedisSessionManagerTest: 8/8 ✅
Progress: 21/33 tasks completed (64%)
|
2026-06-23 14:56:04 +08:00 |
|
zhuyongxin
|
48132d297d
|
feat(phase1): 完成 Repository 测试和 Redis 会话管理
Task 2: 完成 Repository 层测试
- 实现 CaseLibraryRepositoryTest (6 个测试)
- 实现 ApiDocumentRepositoryTest (7 个测试)
- 所有 Repository 测试通过 (19/19)
Task 3: 完成 Redis 会话管理
- 创建 SessionContext 和 ToolCall 数据类
- 创建 SessionManager 接口
- 实现 RedisSessionManager (基于 Redis 的会话管理)
- 创建 SessionConfiguration (Redis 序列化配置)
- 实现 RedisSessionManagerTest (8 个测试全部通过)
测试结果:
- ApiDocumentRepositoryTest: 7/7 通过
- CaseLibraryRepositoryTest: 6/6 通过
- DiagnosisRecordRepositoryTest: 6/6 通过
- RedisSessionManagerTest: 8/8 通过
- 总计: 27/27 测试通过
功能特性:
- 会话创建、查询、更新、删除
- 会话过期时间管理
- 工具调用记录追踪
- 会话状态管理
- 基于 Redis 的分布式会话存储
Progress: 20/33 tasks completed (61%)
|
2026-06-23 14:38:17 +08:00 |
|
zhuyongxin
|
1de1e98ef8
|
feat(phase1): 完成 JPA 实体类和 Repository 层实现
- 创建 3 个 JPA 实体类:DiagnosisRecord、CaseLibrary、ApiDocument
- 创建 3 个 Repository 接口,实现基础 CRUD 和自定义查询方法
- 实现 DiagnosisRecordRepository 单元测试(6 个测试全部通过)
- 修复 Hibernate schema 验证问题(枚举类型使用 VARCHAR)
- 更新 application.yml,添加完整的数据库和 Redis 配置
- 更新 OpenSpec tasks.md,标记已完成任务(12/33)
测试结果:
- DiagnosisRecordRepositoryTest: 6/6 通过
- 编译成功,无错误
Progress: 12/33 tasks completed
|
2026-06-23 14:30:35 +08:00 |
|
zhuyongxin
|
60be51f4a5
|
docs: 重构文档结构,分离学习笔记和 MVP 架构设计
**变更概述:**
- 将 MVP 架构设计文档独立到项目根目录 `mvp/`
- 整理 `docs/` 为纯学习和分析文档目录
- 按类型分类:learning(学习)、analysis(分析)、reports(报告)、guides(指南)
**目录结构:**
```
mvp/ # MVP 架构设计(独立)
├── README.md # 数据库设计总览
├── architecture/ # 架构文档
│ ├── agent-architecture-mvp.md
│ ├── implementation-plan.md
│ └── ...
└── tables/ # 数据表设计
docs/ # 学习和分析文档
├── learning/ # 学习笔记(00-08 编号)
├── analysis/ # 分析笔记 + 重构计划
├── reports/ # 临时报告
└── guides/ # 指南文档
```
**详细变更:**
- docs/README.md → mvp/README.md(数据库设计入口)
- docs/architecture/ → mvp/architecture/(架构设计)
- docs/tables/ → mvp/tables/(数据表设计)
- docs/学习笔记-*.md → docs/learning/07-*.md, 08-*.md
- docs/项目学习路径.md → docs/learning/00-*.md
- docs/功能分析报告.md → docs/analysis/
- docs/修复报告-*.md → docs/reports/
- docs/日志配置*.md → docs/guides/ 或 docs/reports/
- docs/design/ → docs/analysis/(问题分析和重构计划)
|
2026-06-23 14:14:51 +08:00 |
|
zhuyongxin
|
3f15778b28
|
docs: 添加 Phase 1 完整实施计划和 OpenSpec
- 添加项目级 CLAUDE.md 和 AGENTS.md 配置
- 添加完整实施计划(docs/architecture/implementation-detail.md)
- 创建 OpenSpec phase-1-infrastructure:
- proposal.md: 需求和方案
- design.md: 架构设计
- specs/functional-specs.md: 功能规格
- tasks.md: 21 个任务清单
- decisions.md: grill 阶段决策记录
- .commit: 标记为 Committed OpenSpec
OpenSpec 已通过 sm-flow 完整流程(clarify → context → propose → grill → specify → audit → commit)
|
2026-06-23 10:58:11 +08:00 |
|