Add AgentSessionService and refactor agent routes

Move session-related responsibilities into a new application-layer AgentSessionService (and AgentSessionFeedbackResult dataclass), provide a bootstrap factory (get_agent_session_service), and update agent API routes to call the service instead of accessing ConversationStore directly. Routes now translate ValueError into 404 responses and use service methods for get/list/history/delete/feedback. Also update package exports and docs/READMEs to declare the backend architecture authority, enforce api -> application -> domain ports -> infrastructure boundaries, and call out legacy services/workflows as migration-only. These changes centralize session logic in the application layer and tighten architecture guidance for future backend work.
This commit is contained in:
ash66
2026-05-22 09:50:30 +08:00
parent 37f7a60b0a
commit 091a02c522
8 changed files with 223 additions and 33 deletions

View File

@@ -22,7 +22,10 @@ AIRegulation-DocAnalysis-Demo/
│ │ ├── application/ # 用例编排层
│ │ ├── domain/ # 领域模型与稳定端口
│ │ ├── infrastructure/ # MinIO / Milvus / 阿里云 / embedding / session 适配
│ │ ├── shared/ # 组合根、配置无关 wiring 与横切支撑
│ │ ├── config/ # 配置与日志
│ │ ├── services/ # 迁移期 legacy façade不是新增业务逻辑默认落点
│ │ ├── workflows/ # 迁移期 legacy workflow不是新增业务逻辑默认落点
│ │ └── workers/
│ ├── requirements.txt
│ └── main.py
@@ -64,6 +67,13 @@ docker-compose logs -f milvus
## API接口
## Backend Architecture
- Backend 架构规范文档:`docs/architecture/backend-project-architecture.md`
- Backend 迁移 RFC`docs/rfc/backend-api-parsing-embedding-migration-requirements.md`
- 后续 backend 新增功能、重构和技术替换必须同时满足 RFC 与架构文档。
- `backend/app/services/*``backend/app/workflows/*` 当前属于迁移期遗留目录,除迁移或兼容修复外,不应继续承载新的业务编排。
### 上传文档
```bash