Files
ai-safety-platform/docs/adr/ADR-003-architecture-patterns.md
T
baozaotumao2025 14722be770 first commit
2026-07-18 21:00:26 +08:00

19 lines
769 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ADR-003:分层架构与设计模式
## 状态
已接受
## 采用模式
- Application Factory`create_app`
- Strategy`ModelProvider`
- Factory`ProviderFactory`
- Repository:数据库访问
- Service Layer:能力探测、测试计划、执行、报告
- Dependency InjectionFastAPI Depends
- GatewayDatasetGateway
`ProviderFactory` 复用同一数据库会话读取持久化的 `target`/`judge` 配置;缺少对应记录时才读取 `Settings` 中的环境变量。连接检查和后台运行走同一工厂;能力探测只作为运行内部阶段,避免配置与执行分叉。
## 边界
不引入复杂领域事件、CQRS、事件溯源或微服务。当前规模下这些会增加维护成本,不能直接提升核心测试能力。