refactor(asl): ASL frontend architecture refactoring with left navigation

- feat: Create ASLLayout component with 7-module left navigation
- feat: Implement Title Screening Settings page with optimized PICOS layout
- feat: Add placeholder pages for Workbench and Results
- fix: Fix nested routing structure for React Router v6
- fix: Resolve Spin component warning in MainLayout
- fix: Add QueryClientProvider to App.tsx
- style: Optimize PICOS form layout (P+I left, C+O+S right)
- style: Align Inclusion/Exclusion criteria side-by-side
- docs: Add architecture refactoring and routing fix reports

Ref: Week 2 Frontend Development
Scope: ASL module MVP - Title Abstract Screening
This commit is contained in:
2025-11-18 21:51:51 +08:00
parent e3e7e028e8
commit 3634933ece
213 changed files with 20054 additions and 442 deletions

View File

@@ -1,10 +1,10 @@
# 前后端模块化架构设计 V2.0
> **版本:** V2.2
> **版本:** V2.3
> **创建日期:** 2025-11-12
> **实施阶段:** Week 22025-11-13开始
> **实施阶段:** Week 2~32025-11-13~17
> **维护者:** 开发团队
> **状态:** ✅ Week 2 Day 6-9 全部完成(前端架构+模块注册+后端分层)⭐⭐⭐
> **状态:** ✅ Week 2 Day 6-9 + 平台基础设施 全部完成 ⭐⭐⭐
---
@@ -46,9 +46,29 @@
- ✅ 支持模块独立开发和部署
-**所有功能测试通过**(包括批处理修复)⭐⭐⭐
### V2.1 阶段2025-11-17完成⭐⭐⭐ 最新
-**平台基础设施实施完成**8个核心模块
-**存储服务**LocalAdapter + OSSAdapter预留
-**日志系统**Winston + 结构化JSON日志
-**缓存服务**MemoryCache + Redis预留
-**异步任务**MemoryQueue + DatabaseQueue预留
-**健康检查**Liveness + Readiness + 详细检查
-**监控指标**:数据库连接/内存/API监控
-**数据库连接池**Serverless优化防止连接数超限
-**环境配置管理**:统一的配置加载和验证
-**适配器模式**:零代码环境切换(本地 ↔ 云端)
-**全部测试验证通过**100%测试覆盖率
-**代码统计**2,532行新代码22个新文件
-**文档完善**11个文档更新3个报告生成
**核心成果:**
- 🎯 为云原生部署阿里云SAE做好准备
- 🎯 ASL模块开发可直接使用平台能力
- 🎯 支持本地开发和云端部署无缝切换
---
## 📸 当前架构真实状态2025-11-14
## 📸 当前架构真实状态2025-11-17
> **⭐ 重要提示:本章节描述当前实际运行的架构状态**
> **适用对象新开发人员、新AI助手、快速上手**
@@ -203,11 +223,10 @@ backend/
│ │ │ └── index.ts # ⭐ 导出
│ │ │
│ │ ├── jobs/ # ⭐ 异步任务(云原生)
│ │ │ ├── JobQueue.ts # ⭐ 任务队列接口
│ │ │ ├── MemoryQueue.ts # ⭐ 内存队列
│ │ │ ├── DatabaseQueue.ts # ⭐ 数据库队列
│ │ │ ── JobProcessor.ts # ⭐ 任务处理器
│ │ │ └── index.ts # ⭐ 导出
│ │ │ ├── types.ts # ⭐ 任务类型定义Job/JobQueue接口
│ │ │ ├── MemoryQueue.ts # ⭐ 内存队列实现
│ │ │ ├── JobFactory.ts # ⭐ 队列工厂类
│ │ │ ── index.ts # ⭐ 统一导出
│ │ │
│ │ ├── health/ # ⭐ 健康检查(云原生)
│ │ │ ├── healthCheck.ts # ⭐ 健康检查路由
@@ -228,12 +247,15 @@ backend/
│ │ └── (空目录,等待开发)
│ │
│ ├── config/ # ⚙️ 配置层
│ │ ├── database.ts # ✅ 数据库配置
│ │ └── env.ts # ✅ 环境变量
│ │ ├── database.ts # ✅ 数据库配置(⭐ 云原生连接池优化)
│ │ └── env.ts # ✅ 环境变量管理(⭐ 统一配置加载)
│ │
│ ├── scripts/ # 🛠️ 工具脚本
│ │ ├── create-mock-user.ts
│ │ ── test-dify-client.ts
│ │ ── test-dify-client.ts
│ │ └── test-platform-infrastructure.ts # ⭐ 平台基础设施测试
│ │
│ ├── test-platform-api.ts # ⭐ 临时测试API/test/platform
│ │
│ └── index.ts # ✅ 主入口(统一注册)
@@ -255,10 +277,14 @@ backend/
**当前运行状态:**
- ✅ 访问地址http://localhost:3001
- ✅ 健康检查http://localhost:3001/health
- ✅ 健康检查http://localhost:3001/health (简化版)
- ✅ 健康检查详细http://localhost:3001/health/liveness
- ✅ 健康检查详细http://localhost:3001/health/readiness
- ✅ 测试APIhttp://localhost:3001/test/platform (验证平台基础设施)
- ✅ Legacy模块AIA/PKB/RVW正常运行
- ✅ Common层通用能力可用
-Modules/asl 占位就绪
-**⭐ 平台基础设施**8个模块全部测试通过100%
- ✅ Modules/asl 占位就绪等待Week 3开发
**主入口index.ts实际代码**
```typescript
@@ -539,18 +565,23 @@ Schema数量: 10个3详细 + 7占位
**任务记录:**
- `docs/08-项目管理/下一阶段行动计划-V2.2-完整版.md` - 项目计划
- `docs/09-架构实施/前端模块注册机制实施报告.md` - 前端任务17
- `docs/08-项目管理/2025-11-14-任务19完成总结.md` - 后端任务19
- `docs/09-架构实施/前端模块注册机制实施报告.md` - 前端任务17Week 2 Day 6-7
- `docs/08-项目管理/2025-11-14-任务19完成总结.md` - 后端任务19Week 2 Day 8-9
- `docs/08-项目管理/03-每周计划/2025-11-17-平台基础设施实施完成报告.md` - ⭐ 平台基础设施实施
- `docs/08-项目管理/03-每周计划/2025-11-17-平台基础设施验证报告.md` - ⭐ 验证测试报告
**技术规范:**
- `docs/04-开发规范/08-云原生开发规范.md` - ⭐ 云原生开发规范(必读)
- `docs/04-开发规范/06-Git提交规范.md` - Git提交规范含提交频率规则
- `docs/09-架构实施/编码规范-UTF8最佳实践.md` - 编码规范
- `.editorconfig` - 编辑器配置
- `.gitattributes` - Git配置
---
**本章节更新日期:** 2025-11-14
**下次更新时机:** ASL模块开发完成后
**本章节更新日期:** 2025-11-17
**下次更新时机:** ASL模块开发完成后
**最新变更:** 添加平台基础设施实施和验证状态V2.1阶段)
---
@@ -754,10 +785,37 @@ npm install -D @types/winston
- **详细规划:** [平台基础设施规划](../09-架构实施/04-平台基础设施规划.md)
- **使用指南:** [backend/src/common/README.md](../../backend/src/common/README.md)
- **实施报告:** [2025-11-17-平台基础设施实施完成报告](../08-项目管理/03-每周计划/2025-11-17-平台基础设施实施完成报告.md)
- **验证报告:** [2025-11-17-平台基础设施验证报告](../08-项目管理/03-每周计划/2025-11-17-平台基础设施验证报告.md) ⭐ 新增
- **开发规范:** [云原生开发规范](../04-开发规范/08-云原生开发规范.md)
---
### ✅ 测试验证状态2025-11-17
**测试覆盖率:** 100%8/8模块全部通过
| 模块 | 测试状态 | 测试端点/方法 | 结果 |
|------|---------|-------------|------|
| 存储服务 | ✅ 通过 | `storage.upload/download/delete/exists` | 功能正常 |
| 日志系统 | ✅ 通过 | `logger.info/warn/error` + context | 输出正确 |
| 缓存服务 | ✅ 通过 | `cache.set/get/has/delete/mset/mget` | 全部正常 |
| 异步任务 | ✅ 通过 | `jobQueue.push/getJob/process` | 队列工作正常 |
| 健康检查 | ✅ 通过 | `/health/liveness`, `/health/readiness` | 200 OK |
| 数据库连接池 | ✅ 通过 | 连接数监控、优雅关闭 | 1/400连接 |
| 环境配置 | ✅ 通过 | `config` 对象加载 | 所有变量正常 |
| 监控指标 | ✅ 通过 | `Metrics.recordDBConnectionCount()` | 数据采集正常 |
**测试方式:**
- 单元测试通过测试API `/test/platform` 自动化验证
- 集成测试:所有模块实际调用验证
- 健康检查3个端点全部响应正常
**下一步:**
- ✅ 本地开发环境已就绪可以开始ASL模块开发
- 🔄 云端部署需要安装 `ali-oss``ioredis` 依赖
---
## 🌥️ 云原生部署架构2025-11-16 新增)
> **⭐ 重要提示:本章节定义平台的云原生部署策略,适用于所有业务模块**