生成课程
发布于 2026/6/7
The user is asking "我要怎么生成课程" (How do I generate courses). This is about a feature in their project. I need to look at the codebase to understand how course generation works. Let me explore the codebase to find relevant code related to course generation.
The subagent has provided a comprehensive analysis. Let me summarize the findings for the user clearly. There are essentially three ways to "generate courses" in this project:
- 管理后台手动创建 - Admin creates courses/lessons through the SEO admin panel
- VOA 脚本批量抓取 - Developer runs scripts to pull content from VOA
- AI 辅助生成 - Planned but not fully implemented yet
I should present these three approaches clearly to the user.
根据代码分析,当前项目有三种生成课程的途径,取决于你的身份和目标:
方式一:管理后台手动录入(管理员操作)
这是最直接的方式,所有后端都在本地运行。
- 启动项目后,访问管理后台:
http://localhost:3002/admin - 左侧菜单点击 「📚 课程管理」
- 点击 「+ 新建课程」,填写课程信息:
- book_id — 唯一标识,如 nce-2(创建后不可改)
- title — 课程名称,如「新概念英语第二册」
- level — 级别(1-4)
- published — 是否发布上线
- 创建课程后,进入该课程的 「📚 管理课时」,再点 「+ 新建课时」 逐课录入内容,包含课文文本(JSON 格式)、词汇、语法等。
- 数据库:
PostgreSQL的courses和lessons表自动写入。
注意:目前管理后台创建的课程和前端用户端尚未打通(前端仍读硬编码 JS 文件),后续需要补充联调。
方式二:VOA 脚本批量拉取(开发者操作)
适合从 VOA 官网批量抓取音频和文稿来快速搭建课程。
1. 编辑课程计划文件 backend-record-learn/scripts/voa/plans/rl-book-1.json,追加新课:
{
"id": "rl-b1-003",
"slug": "classmates",
"voaUrl": "https://learningenglish.voanews.com/a/.../xxx.html",
"title": "Classmates",
"unit": "L1",
"order": 3,
"grammarFocus": "be 动词 + 复数"
}
2. 运行脚本:
cd backend-record-learn
node scripts/voa/voa-build-from-plan.js scripts/voa/plans/rl-book-1.json
自动产出 MP3 音频、transcript 文稿、LRC 字幕到 frontend-record-learn/src/static/data/book1/。
3. 手动编写中文层 — 在 frontend-record-learn/src/static/data/lessons/book1/group1.js 中补充 sentences[].cnText、knowledgePoints、grammar.points、quiz、summaryQA。
4. 更新课时总数 — 在 frontend-record-learn/src/static/data/subjects.js 中更新 totalLessons。
5. 启动前端验证: pnpm dev → 英语 → Record Learn Book 1,点开新课确认。
方式三:AI 辅助生成(规划中,未完成)
根据 frontend-record-learn/docs/courses-plan.md 设计,理想流程是:
① 人工定稿大纲 → ② AI 生成课文 → ③ 人工审核润色
→ ④ TTS 配音 → ⑤ AI 生成词汇/语法 → ⑥ AI 生成练习题 → ⑦ 发布
目前后端 /api/ai/quiz(出题)和 /api/ai/explain(精讲)等接口已就绪,但完整的批量自动生产 pipeline 尚未实现。
总结:如果你现在就要生成课程,用方式一(管理后台)最快;如果需要批量从 VOA 拉素材,用方式二;AI 全自动生成还在规划中。需要我具体帮你走其中某一步吗?