Files
RAG/backend
YoVinchen f4ba5d5342
Some checks failed
verify / verify (push) Has been cancelled
Make the first RAG slice executable without risking production data
The Stage 1 foundation now proves provider contracts with mocks and validates PostgreSQL/pgvector ingestion, approval binding, retrieval, reranking, and idempotency using only synthetic data. Live Bailian validation remains gated on rotating the exposed key.

Constraint: The key shown in chat is compromised and cannot be used or committed

Rejected: Mark Stage 1 complete from mock and offline results | real three-model smoke is still required

Confidence: high

Scope-risk: moderate

Reversibility: clean

Directive: Do not enable real-data ingestion until Stage 3 cloud approval and outbound manifest controls are enforced end to end

Tested: make verify; 41 pytest tests; strict mypy; Ruff; Compose config; pinned image build; empty-volume migration; role denial; two idempotent 20-vector seeds; database restart persistence

Not-tested: Live Bailian calls require a newly rotated key; React product UI is not implemented
2026-07-12 15:41:58 +08:00
..

Backend

Python/FastAPI 后端代码位于本目录。实现阶段采用模块化单体,同一代码镜像分别运行 API 与持久化任务 Worker。

规划边界:

backend/
├── app/
│   ├── api/v1/            HTTP/SSE 接口
│   ├── core/              配置、安全、日志、遥测
│   ├── domain/            领域实体与状态机
│   ├── ports/             外部能力协议(依赖倒置边界)
│   ├── services/          入库、检索、生成、评测用例
│   ├── adapters/          百炼、解析器、文件存储等外部适配器
│   ├── persistence/       SQLAlchemy 模型与仓储
│   ├── workers/           PostgreSQL 任务队列消费者
│   ├── tools/             模型探测、seed 与离线运维入口
│   └── prompts/           版本化提示词
└── tests/
    ├── unit/
    ├── integration/
    └── contract/

前端不得直接访问百炼API Key 读取逻辑只允许存在于后端配置层。