docs:更新架构文档以反映当前代码实际状态

AGENT.md、README.md、ARCHITECTURE.md、ROADMAP.md 已根据最新代码更新:
- 补充 DTO 层、统一返回体、全局异常处理、审计自动填充等已完成项
- 更新前端控制台架构描述与页面实现状态
- 调整 RAG 模块状态描述(元数据层已完成,业务闭环待建设)
- 移除 docs 目录的 .gitignore 排除规则

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
zhiye.sun
2026-05-21 13:46:57 +08:00
parent 088853b098
commit 67cfbeb572
7 changed files with 511 additions and 510 deletions

116
README.md
View File

@@ -3,8 +3,8 @@
Common Agent 是一个规划中的通用 Agent 平台,技术路线基于 Java、Spring Boot 和 Spring AI。
项目目标是建设一套完整的前后端系统,支持 Agent 编排、工具调用、会话管理、RAG 知识库和平台管理能力。
当前项目处于基础工程阶段。后端骨架、PostgreSQL 配置、MyBatis-Plus、Lombok、多环境配置文件和前端控制台基础页面已经完成
Agent 运行时、RAG 索引和更多管理功能会在后续阶段逐步实现。
当前项目处于基础工程阶段。后端骨架(含 DTO、统一返回体、全局异常处理、审计自动填充、PostgreSQL 配置、MyBatis-Plus、Lombok、多环境配置文件和前端控制台基础页面已经完成
Agent 运行时、RAG 文档解析与向量化和更多管理功能会在后续阶段逐步实现。
## 项目愿景
@@ -18,33 +18,63 @@ Common Agent 希望成为一个可复用的企业级 AI 应用基础平台:
## 当前技术栈
- Java 21
- Spring Boot 4.0.6
- Spring AI规划接入
- MyBatis-Plus 3.5.16
- PostgreSQL JDBC Driver
- Lombok
- Maven Wrapper
- PostgreSQL 数据库:`common_agent`
| 类别 | 技术 |
|------|------|
| 后端 | Java 21, Spring Boot 4.0.6, MyBatis-Plus 3.5.16 |
| 数据库 | PostgreSQL |
| 工具库 | Lombok, Springdoc OpenAPI 2.8.13, Jackson |
| 构建 | Maven Wrapper |
| 前端 | Vue 3, TypeScript 5.9, Vite, Element Plus, Pinia, Vue Router 4 |
| 前端测试 | Vitest, @vue/test-utils |
| 后端测试 | Spring Boot Test |
## 项目结构
```text
common_agent
├── frontend
│ ├── src/layouts
│ ├── src/pages
│ ├── src/router
└── src/styles
├── src/main/java/com/bruce
└── CommonAgentApplication.java
├── src/main/resources
├── application.yaml
── application-dev.yaml
│ └── application-template.yaml
├── docs
│ ├── ARCHITECTURE.md
└── ROADMAP.md
├── frontend/ # Vue 3 前端控制台
│ ├── src/
│ ├── api/ # Axios 封装与各模块 API
│ ├── layouts/ # AdminLayout 管理后台布局
│ ├── pages/ # 业务页面(工作台、枚举、附件、知识库、文档)
│ │ ├── router/ # Vue Router 配置
│ ├── stores/ # Pinia 状态管理
│ │ ├── styles/ # 全局样式
│ └── types/ # TypeScript 类型声明
── package.json
├── src/
│ ├── main/java/com/bruce/
│ ├── CommonAgentApplication.java
│ ├── common/ # 公共模块
│ │ │ ├── config/ # AttachmentProperties, EntityAuditMetaObjectHandler
│ │ │ ├── controller/ # SysAttachmentController, SysEnumController
│ │ │ ├── domain/
│ │ │ │ ├── entity/ # SysAttachment, SysEnum
│ │ │ │ └── model/ # BaseEntity, RequestResult
│ │ │ ├── dto/
│ │ │ │ ├── request/ # 各模块请求 DTO
│ │ │ │ └── response/ # 各模块响应 DTO
│ │ │ ├── enums/ # CommonStatusEnum, EnableStatusEnum
│ │ │ ├── handler/ # GlobalExceptionHandler
│ │ │ ├── mapper/ # SysAttachmentMapper, SysEnumMapper
│ │ │ └── service/ # 接口与实现
│ │ └── rag/ # RAG 知识库模块
│ │ ├── constant/ # RagSystemConstants
│ │ ├── controller/ # RagStoreController, RagDocumentController
│ │ ├── dto/ # 请求/响应 DTO
│ │ ├── entity/ # RagStore, RagDocument
│ │ ├── enums/ # RagParseStatusEnum, RagIndexStatusEnum
│ │ ├── mapper/ # RagDocumentMapper, RagStoreMapper
│ │ └── service/ # 接口与实现
│ ├── main/resources/
│ │ ├── application.yaml # 环境选择
│ │ ├── application-dev.yaml # 开发环境配置
│ │ └── application-template.yaml # 配置模板
│ └── test/java/ # 单元测试(结构稳定性测试 + 前端 API 测试)
├── docs/
│ ├── ARCHITECTURE.md # 架构说明
│ └── ROADMAP.md # 开发路线图
├── AGENT.md # 平台设计草案
├── pom.xml
└── README.md
```
@@ -80,21 +110,19 @@ spring:
运行测试:
```powershell
.\mvnw.cmd test
```bash
./mvnw test
```
启动应用:
```powershell
.\mvnw.cmd spring-boot:run
```bash
./mvnw spring-boot:run
```
当前阶段还没有加入 Web 服务依赖或常驻任务,所以应用可能启动成功后立即退出。
启动前端:
```powershell
```bash
cd frontend
npm install
npm run dev
@@ -102,7 +130,7 @@ npm run dev
前端检查:
```powershell
```bash
cd frontend
npm run test:unit
npm run type-check
@@ -115,11 +143,13 @@ npm run build
当前已有页面:
- 工作台
- 系统枚举
- 附件管理
- 知识库
- 知识文档
| 页面 | 状态 |
|------|------|
| 工作台 | 占位 |
| 系统枚举 | 完整 CRUD + 批量新增 |
| 附件管理 | 占位 |
| 知识库 | 完整 CRUD + 双栏详情 |
| 知识文档 | 占位 |
当前 UI 规范:
@@ -128,6 +158,15 @@ npm run build
- 全局样式集中在 `frontend/src/styles/global.css`,页面专属样式优先放在对应 `.vue` 文件的 scoped style 中。
- 后台页面以清晰、克制、便于扫描为优先目标,避免营销式大面积装饰。
## 接口规范
- 统一返回体:`RequestResult<T>``resultcode`, `message`, `data`
- 所有接口通过 DTO 交互,不直接暴露实体
- 查询条件封装为 `XxxQueryRequest`
- 响应 DTO 提供 `fromEntity()` 静态转换
- 大整数 ID 通过 `@JsonSerialize(ToStringSerializer.class)` 防止前端精度丢失
- 全局异常处理返回 HTTP 400/500 状态码
## 规划模块
- `agent-core`Agent 执行模型、工具注册、记忆和编排能力。
@@ -141,9 +180,10 @@ npm run build
- [架构说明](docs/ARCHITECTURE.md)
- [开发路线图](docs/ROADMAP.md)
- [平台设计草案](AGENT.md)
## 参考资料
- [Spring AI Reference](https://docs.spring.io/spring-ai/reference/)
- [Spring AI RAG Reference](https://docs.spring.io/spring-ai/reference/api/retrieval-augmented-generation.html)
- [MyBatis-Plus](https://baomidou.com/)
- [MyBatis-Plus](https://baomidou.com/)