新增作文区与 AI 解读开关,修复 CSV 导出。

系统设置可关闭成绩复盘 AI;学生详情增加作文区(OCR/手动题目、方案与范文、历史与 MD 下载);导出改用 UTF-8 文件名响应。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-28 17:42:17 +08:00
parent aaa08cdf38
commit 1cb3c7fad5
20 changed files with 1441 additions and 555 deletions
+5 -1
View File
@@ -6,7 +6,7 @@ from sqlalchemy.orm import Session, joinedload
from app.core.database import get_db
from app.core.deps import get_current_user
from app.models.user import ExamRecord, SubjectScore, User
from app.models.user import ExamRecord, SubjectScore, SystemSettings, User
from app.schemas import (
ExamCreate,
ExamOut,
@@ -322,6 +322,10 @@ async def review_insight(
current_user: User = Depends(get_current_user),
):
student = get_student_for_user(db, student_id, current_user.id)
settings_row = db.get(SystemSettings, 1)
if settings_row is not None and not getattr(settings_row, "ai_review_enabled", True):
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail="AI 复盘解读已在系统设置中关闭")
exams = (
db.query(ExamRecord)
.options(joinedload(ExamRecord.scores).joinedload(SubjectScore.subject))