Core Components: - PDFStorageService with Dify/OSS adapters - LLM12FieldsService with Nougat-first + dual-model + 3-layer JSON parsing - PromptBuilder for dynamic prompt assembly - MedicalLogicValidator with 5 rules + fault tolerance - EvidenceChainValidator for citation integrity - ConflictDetectionService for dual-model comparison Prompt Engineering: - System Prompt (6601 chars, Section-Aware strategy) - User Prompt template (PICOS context injection) - JSON Schema (12 fields constraints) - Cochrane standards (not loaded in MVP) Key Innovations: - 3-layer JSON parsing (JSON.parse + json-repair + code block extraction) - Promise.allSettled for dual-model fault tolerance - safeGetFieldValue for robust field extraction - Mixed CN/EN token calculation Integration Tests: - integration-test.ts (full test) - quick-test.ts (quick test) - cached-result-test.ts (fault tolerance test) Documentation Updates: - Development record (Day 2-3 summary) - Quality assurance strategy (full-text screening) - Development plan (progress update) - Module status (v1.1 update) - Technical debt (10 new items) Test Results: - JSON parsing success rate: 100% - Medical logic validation: 5/5 passed - Dual-model parallel processing: OK - Cost per PDF: CNY 0.10 Files: 238 changed, 14383 insertions(+), 32 deletions(-) Docs: docs/03-涓氬姟妯″潡/ASL-AI鏅鸿兘鏂囩尞/05-寮€鍙戣褰?2025-11-22_Day2-Day3_LLM鏈嶅姟涓庨獙璇佺郴缁熷紑鍙?md
107 lines
1.5 KiB
Markdown
107 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` 表,应该能看到两个用户记录。
|
||
|
||
## 下一步
|
||
|
||
初始化完成后,就可以正常创建知识库了!🎉
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|