Features: - Backend statistics API (cloud-native Prisma aggregation) - Results page with hybrid solution (AI consensus + human final decision) - Excel export (frontend generation, zero disk write, cloud-native) - PRISMA-style exclusion reason analysis with bar chart - Batch selection and export (3 export methods) - Fixed logic contradiction (inclusion does not show exclusion reason) - Optimized table width (870px, no horizontal scroll) Components: - Backend: screeningController.ts - add getProjectStatistics API - Frontend: ScreeningResults.tsx - complete results page (hybrid solution) - Frontend: excelExport.ts - Excel export utility (40 columns full info) - Frontend: ScreeningWorkbench.tsx - add navigation button - Utils: get-test-projects.mjs - quick test tool Architecture: - Cloud-native: backend aggregation reduces network transfer - Cloud-native: frontend Excel generation (zero file persistence) - Reuse platform: global prisma instance, logger - Performance: statistics API < 500ms, Excel export < 3s (1000 records) Documentation: - Update module status guide (add Week 4 features) - Update task breakdown (mark Week 4 completed) - Update API design spec (add statistics API) - Update database design (add field usage notes) - Create Week 4 development plan - Create Week 4 completion report - Create technical debt list Test: - End-to-end flow test passed - All features verified - Performance test passed - Cloud-native compliance verified Ref: Week 4 Development Plan Scope: ASL Module MVP - Title Abstract Screening Results Cloud-Native: Backend aggregation + Frontend Excel generation
106 lines
1.5 KiB
Markdown
106 lines
1.5 KiB
Markdown
# 测试用户初始化说明
|
||
|
||
## 问题
|
||
创建知识库时报错 "User not found",因为数据库中没有用户记录。
|
||
|
||
## 解决方案
|
||
|
||
### 方法1:运行批处理脚本(推荐)⭐
|
||
|
||
双击运行:**`初始化测试用户.bat`**
|
||
|
||
这个脚本会自动创建两个测试用户:
|
||
- 普通用户(user-mock-001)
|
||
- 管理员用户(user-admin-001)
|
||
|
||
### 方法2:手动运行命令
|
||
|
||
```bash
|
||
cd backend
|
||
npm run prisma:seed
|
||
```
|
||
|
||
## 测试账号信息
|
||
|
||
### 普通用户
|
||
- **用户ID**: `user-mock-001`
|
||
- **邮箱**: `test@example.com`
|
||
- **密码**: `password123`
|
||
- **知识库配额**: 3个
|
||
- **试用期**: 30天
|
||
|
||
### 管理员用户
|
||
- **用户ID**: `user-admin-001`
|
||
- **邮箱**: `admin@example.com`
|
||
- **密码**: `password123`
|
||
- **知识库配额**: 10个
|
||
|
||
## 说明
|
||
|
||
1. **当前系统使用硬编码的用户ID**
|
||
- 后端控制器使用 `MOCK_USER_ID = 'user-mock-001'`
|
||
- 所有API请求都使用这个固定ID
|
||
|
||
2. **用户认证系统未实现**
|
||
- 当前处于开发阶段
|
||
- 用户登录/注册功能在里程碑3实现
|
||
|
||
3. **重新初始化数据库后需要重新运行seed**
|
||
- 如果执行了 `prisma migrate reset`
|
||
- 或手动清空了数据库
|
||
- 需要重新运行 `初始化测试用户.bat`
|
||
|
||
## 验证
|
||
|
||
运行seed脚本后,可以通过Prisma Studio验证:
|
||
|
||
```bash
|
||
npm run prisma:studio
|
||
```
|
||
|
||
在浏览器中打开,查看 `users` 表,应该能看到两个用户记录。
|
||
|
||
## 下一步
|
||
|
||
初始化完成后,就可以正常创建知识库了!🎉
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|