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
112 lines
1.8 KiB
Markdown
112 lines
1.8 KiB
Markdown
# RAG引擎
|
||
|
||
> **能力定位:** 通用能力层
|
||
> **复用率:** 43% (3个模块依赖)
|
||
> **优先级:** P1
|
||
> **状态:** ✅ 已实现(基于Dify)
|
||
|
||
---
|
||
|
||
## 📋 能力概述
|
||
|
||
RAG引擎负责:
|
||
- 向量化存储(Embedding)
|
||
- 语义检索(Semantic Search)
|
||
- 检索增强生成(RAG)
|
||
- Rerank重排序
|
||
|
||
---
|
||
|
||
## 📊 依赖模块
|
||
|
||
**3个模块依赖(43%复用率):**
|
||
1. **AIA** - AI智能问答(@知识库问答)
|
||
2. **ASL** - AI智能文献(文献内容检索)
|
||
3. **PKB** - 个人知识库(RAG问答)
|
||
|
||
---
|
||
|
||
## 💡 核心功能
|
||
|
||
### 1. 向量化存储
|
||
- 基于Dify平台
|
||
- Qdrant向量数据库(Dify内置)
|
||
|
||
### 2. 语义检索
|
||
- Top-K检索
|
||
- 相关度评分
|
||
- 多知识库联合检索
|
||
|
||
### 3. RAG问答
|
||
- 检索 + 生成
|
||
- 智能引用系统(100%准确溯源)
|
||
|
||
---
|
||
|
||
## 🏗️ 技术架构
|
||
|
||
**基于Dify平台:**
|
||
```typescript
|
||
// DifyClient封装
|
||
interface RAGEngine {
|
||
// 创建知识库
|
||
createDataset(name: string): Promise<string>;
|
||
|
||
// 上传文档
|
||
uploadDocument(datasetId: string, file: File): Promise<string>;
|
||
|
||
// 语义检索
|
||
search(datasetId: string, query: string, topK?: number): Promise<SearchResult[]>;
|
||
|
||
// RAG问答
|
||
chatWithRAG(datasetId: string, query: string): Promise<string>;
|
||
}
|
||
```
|
||
|
||
---
|
||
|
||
## 📈 优化成果
|
||
|
||
**检索参数优化:**
|
||
| 指标 | 优化前 | 优化后 | 提升 |
|
||
|------|--------|--------|------|
|
||
| 检索数量 | 3 chunks | 15 chunks | 5倍 |
|
||
| Chunk大小 | 500 tokens | 1500 tokens | 3倍 |
|
||
| 总覆盖 | 1,500 tokens | 22,500 tokens | 15倍 |
|
||
| 覆盖率 | ~5% | ~40-50% | 8-10倍 |
|
||
|
||
---
|
||
|
||
## 🔗 相关文档
|
||
|
||
- [通用能力层总览](../README.md)
|
||
- [Dify集成文档](../../00-系统总体设计/03-数据库架构说明.md)
|
||
|
||
---
|
||
|
||
**最后更新:** 2025-11-06
|
||
**维护人:** 技术架构师
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|