Skip to content

学习 API

学习会话 /api/learning

方法端点说明
POST/api/learning/session创建/恢复学习会话
POST/api/learning/study-words获取学习单词(基于 AMAS 策略)
POST/api/learning/next-words获取下一批单词
POST/api/learning/adjust-words动态调整策略
POST/api/learning/sync-progress同步会话进度

学习流程

POST /api/learning/session → 获取 sessionId

POST /api/learning/study-words → 获取带策略的学习单词

用户答题 → POST /api/records(自动更新状态)

需要补充 → POST /api/learning/next-words

完成 → SessionSummary

学习记录 /api/records

方法端点说明
GET/api/records获取学习记录(?limit=50&offset=0
POST/api/records提交答题记录 + AMAS 处理
POST/api/records/batch批量提交
GET/api/records/statistics基础统计
GET/api/records/statistics/enhanced增强统计(含每日分组 + 连续天数)

提交答题请求体

typescript
interface CreateRecordRequest {
  wordId: string;
  isCorrect: boolean;
  responseTimeMs: number;
  sessionId?: string;
  isQuit?: boolean;
  dwellTimeMs?: number;
  pauseCount?: number;
  hintUsed?: boolean;
}

POST /api/records 是学习流程的核心端点,后端同时完成:

  1. 创建学习记录
  2. 调用 AMAS 引擎处理,返回 amasResult
  3. 自动更新 word_learning_states
  4. 自动更新 learning_session 计数

学习配置 /api/study-config

方法端点说明
GET/api/study-config获取学习配置
PUT/api/study-config更新配置
GET/api/study-config/today-words今日学习单词
GET/api/study-config/progress学习进度

StudyConfig 模型

typescript
interface StudyConfig {
  userId: string;
  selectedWordbookIds: string[];
  dailyWordCount: number;       // 1-200,默认 20
  studyMode: "MASTERY" | "REVIEW" | "MIXED";
  dailyMasteryTarget: number;   // 1-100
}

AMAS API /api/amas

方法端点说明
GET/api/amas/state用户 AMAS 状态
GET/api/amas/strategy当前推荐策略
GET/api/amas/phase冷启动阶段
GET/api/amas/learning-curve学习曲线
GET/api/amas/intervention干预建议
POST/api/amas/reset重置 AMAS 状态
GET/api/amas/mastery/evaluate掌握度评估(?wordId=xxx

WordForge — 智能英语学习平台