Phase 7: Hoàn thiện Modular RAG Backend với FastAPI và Đa LLM Provider

This commit is contained in:
2026-05-08 07:30:30 +00:00
commit 26d1298cf6
51 changed files with 5360 additions and 0 deletions

View File

@@ -0,0 +1,130 @@
# 8.EndToEnd-Processing-Flows-Bullets.md
> File này liệt kê **TOÀN BỘ các luồng xử lý cần thiết** để triển khai và mở rộng hệ thống.
> Dạng **gạch đầu dòng**, dùng như **bản đồ tư duy kỹ thuật**, hoặc checklist khi mở rộng.
---
## A. Luồng Ingestion
- Load config site / library
- Authenticate Graph (app-only)
- First full delta snapshot
- Persist delta token
- Poll delta định kỳ
- Detect create / update / delete
- Fetch metadata
- Fetch & flatten permissions
- Decide eligible file
- Emit job downstream
---
## B. Luồng Permission
- Resolve direct users
- Resolve AAD groups
- Expand nested groups
- Cache membership
- Attach ACL to file/chunk
---
## C. Luồng Extraction
- Receive file job
- Detect file type
- Detect scan vs text PDF
- OCR per page (if needed)
- Convert to Markdown
- Insert page markers
- Normalize text
- Remove noise
---
## D. Luồng Chunking
- Split by heading
- Split by page
- Validate token length
- Attach page range
- Attach source URL
---
## E. Luồng Indexing
- Validate mapping version
- Generate embedding
- Attach ACL
- Index chunk
- Remove old chunks (on update)
---
## F. Luồng Search
- Receive query
- Resolve user identity
- Resolve user groups
- Hybrid search
- Apply ACL filter
- Score & rank
- Highlight text
- Return results
---
## G. Luồng RAG Chat
- Receive question
- Decide Search vs Chat
- Retrieve top K chunks
- Build context
- Enforce token budget
- Generate answer
- Attach citations
- Return answer
---
## H. Luồng Feedback
- Collect user feedback
- Store feedback
- Aggregate metrics
- Feed prompt tuning
- Feed ranking tuning
---
## I. Luồng Ops & Monitoring
- Health check all services
- Collect metrics
- Trigger alerts
- Incident handling
- Post-mortem
---
## J. Luồng Governance & Change
- Prompt version change
- Model version change
- Embedding change
- Re-index strategy
- Rollback
---
## Cách sử dụng file này
- Dùng làm checklist triển khai
- Dùng để chia task cho AI agent
- Dùng làm reference mở rộng hệ thống
---
*File này intentionally không chi tiết nó là xương sống logic cho mọi mở rộng sau này.*