feat: 初始化考培练系统项目
- 从服务器拉取完整代码 - 按框架规范整理项目结构 - 配置 Drone CI 测试环境部署 - 包含后端(FastAPI)、前端(Vue3)、管理端 技术栈: Vue3 + TypeScript + FastAPI + MySQL
This commit is contained in:
104
docs/规划/后端开发拆分策略/子agent/04-Agent-Exam/api_contract.yaml
Normal file
104
docs/规划/后端开发拆分策略/子agent/04-Agent-Exam/api_contract.yaml
Normal file
@@ -0,0 +1,104 @@
|
||||
openapi: 3.0.0
|
||||
info:
|
||||
title: 考试模块API
|
||||
version: 1.0.0
|
||||
description: 动态考试与成绩的最小契约(骨架)
|
||||
|
||||
paths:
|
||||
/api/v1/exams/start:
|
||||
post:
|
||||
summary: 开始考试
|
||||
tags: [考试]
|
||||
security:
|
||||
- bearerAuth: []
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
required: [course_id]
|
||||
properties:
|
||||
course_id: { type: integer }
|
||||
count: { type: integer, minimum: 1, maximum: 100, default: 10 }
|
||||
responses:
|
||||
200:
|
||||
description: 成功
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
code: { type: integer, example: 200 }
|
||||
message: { type: string, example: success }
|
||||
data:
|
||||
type: object
|
||||
properties:
|
||||
exam_id: { type: integer }
|
||||
|
||||
/api/v1/exams/submit:
|
||||
post:
|
||||
summary: 提交答案
|
||||
tags: [考试]
|
||||
security:
|
||||
- bearerAuth: []
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
required: [exam_id, answers]
|
||||
properties:
|
||||
exam_id: { type: integer }
|
||||
answers:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
question_id: { type: string }
|
||||
answer: { type: string }
|
||||
responses:
|
||||
200:
|
||||
description: 成功
|
||||
|
||||
/api/v1/exams/{id}:
|
||||
get:
|
||||
summary: 获取考试详情
|
||||
tags: [考试]
|
||||
security:
|
||||
- bearerAuth: []
|
||||
parameters:
|
||||
- in: path
|
||||
name: id
|
||||
required: true
|
||||
schema: { type: integer }
|
||||
responses:
|
||||
200:
|
||||
description: 成功
|
||||
404:
|
||||
description: 未找到
|
||||
|
||||
/api/v1/exams/records:
|
||||
get:
|
||||
summary: 考试记录
|
||||
tags: [考试]
|
||||
security:
|
||||
- bearerAuth: []
|
||||
parameters:
|
||||
- in: query
|
||||
name: page
|
||||
schema: { type: integer, minimum: 1, default: 1 }
|
||||
- in: query
|
||||
name: size
|
||||
schema: { type: integer, minimum: 1, maximum: 100, default: 10 }
|
||||
responses:
|
||||
200:
|
||||
description: 成功
|
||||
|
||||
components:
|
||||
securitySchemes:
|
||||
bearerAuth:
|
||||
type: http
|
||||
scheme: bearer
|
||||
bearerFormat: JWT
|
||||
20
docs/规划/后端开发拆分策略/子agent/04-Agent-Exam/checklist.md
Normal file
20
docs/规划/后端开发拆分策略/子agent/04-Agent-Exam/checklist.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# Agent-Exam 开发检查清单(简版)
|
||||
|
||||
## 准备
|
||||
- [ ] 阅读通用规范与架构文档
|
||||
|
||||
## 最小功能
|
||||
- [ ] `POST /api/v1/exams/start` 动态组卷(Dify)
|
||||
- [ ] `POST /api/v1/exams/submit` 提交判题,生成成绩
|
||||
- [ ] `GET /api/v1/exams/{id}` 考试详情
|
||||
- [ ] `GET /api/v1/exams/records` 考试记录分页
|
||||
|
||||
## 安全与规范
|
||||
- [ ] 登录必需;题目与答案分离存储;防重放
|
||||
- [ ] 参数验证与统一异常
|
||||
- [ ] 结构化日志覆盖关键操作
|
||||
|
||||
## 质量
|
||||
- [ ] 单元测试覆盖率 ≥ 80%
|
||||
- [ ] 通过 Black/isort/flake8/mypy
|
||||
- [ ] API 与 `api_contract.yaml` 一致
|
||||
18
docs/规划/后端开发拆分策略/子agent/04-Agent-Exam/context.md
Normal file
18
docs/规划/后端开发拆分策略/子agent/04-Agent-Exam/context.md
Normal file
@@ -0,0 +1,18 @@
|
||||
# Agent-Exam 上下文(极简版)
|
||||
|
||||
## 位置
|
||||
- 项目根:`/Users/nongjun/Desktop/Ai公司/本地开发与测试/kaopeilian-backend/`
|
||||
- 工作目录:`app/api/v1/`、`app/services/`、`app/models/`、`app/schemas/`
|
||||
|
||||
## 依赖
|
||||
- 输入依赖:Auth(认证)、User(考生信息)、Course(课程/知识点)、Dify(动态组卷)
|
||||
- 输出接口:考试与成绩 API/服务,供 Analytics 消费
|
||||
|
||||
## 关键约束
|
||||
- 安全:登录必需;题目与答案分离存储;防重放
|
||||
- 性能:试题生成/提交 ≤ 500ms(本地);记录分页查询 ≤ 300ms
|
||||
- 观测:开始/提交/判题/报告生成记录结构化日志
|
||||
|
||||
## 最小运行信息
|
||||
- 环境变量:`DIFY_API_BASE`、`DIFY_API_KEY`、`DIFY_EXAM_WORKFLOW_ID`
|
||||
- 关联模型/表:`exam_sessions`、`exam_questions`、`exam_answers`、`exam_results`、`mistakes`
|
||||
17
docs/规划/后端开发拆分策略/子agent/04-Agent-Exam/examples/README.md
Normal file
17
docs/规划/后端开发拆分策略/子agent/04-Agent-Exam/examples/README.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# Agent-Exam 示例(最小)
|
||||
|
||||
- 开始考试:
|
||||
|
||||
```python
|
||||
# app/api/v1/exams.py 片段(示例)
|
||||
from fastapi import APIRouter, Depends
|
||||
from app.api.deps import get_current_user
|
||||
from app.schemas.base import ResponseModel
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@router.post("/start")
|
||||
async def start_exam():
|
||||
# 省略 Dify 动态组卷逻辑
|
||||
return ResponseModel(code=200, message="success", data={"exam_id": 1})
|
||||
```
|
||||
22
docs/规划/后端开发拆分策略/子agent/04-Agent-Exam/prompt.md
Normal file
22
docs/规划/后端开发拆分策略/子agent/04-Agent-Exam/prompt.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# Agent-Exam 提示词(极简版)
|
||||
|
||||
## 必读引用
|
||||
@子agent/00-通用基础/base_prompt.md
|
||||
@子agent/00-通用基础/essential_docs.md
|
||||
@考培练系统规划/后端开发拆分策略/模块分工指南.md
|
||||
@考培练系统规划/后端开发拆分策略/协作机制设计.md
|
||||
|
||||
## 你的角色
|
||||
- 本模块职责:考试(动态试题、流程管理、判题与成绩、错题管理、报告)
|
||||
- 依赖模块:Auth、User、Course、Dify
|
||||
- 对外输出:考试与成绩 API,供 Analytics 使用
|
||||
|
||||
## 交付内容
|
||||
- 代码:`app/api/v1/exams.py`、`app/services/exam_service.py`、相关 `app/models/`、`app/schemas/`
|
||||
- 契约:本目录 `api_contract.yaml`(OpenAPI 3.0)
|
||||
- 文档与测试:`checklist.md` 全通过,单元测试覆盖率 ≥ 80%
|
||||
|
||||
## 验收标准(最小集)
|
||||
- API 与 `api_contract.yaml` 一致并通过基本集成测试
|
||||
- 认证/权限依赖正常(读需登录,写需登录)
|
||||
- 输入校验、统一异常、结构化日志符合通用规范
|
||||
Reference in New Issue
Block a user