feat(openmaic-classroom): 增加基于知识图谱概念的微课堂生成支持,更新需求构建模板

This commit is contained in:
bingxiang.cheng
2026-05-02 09:19:22 +08:00
committed by lyingbug
parent 19cd17c0a6
commit db8abd3f9b
3 changed files with 572 additions and 2 deletions
@@ -70,6 +70,66 @@ OpenMAIC 的 `requirement` 字段需要是**结构化的教学需求描述**,
- 重点覆盖:[关键主题列表]
```
### 模板 5: 基于概念图遍历(Concept Graph)
当从知识图谱 concept 页面及其关联 entity 生成微课堂时使用此模板。由 `scripts/concept-to-requirement.py` 自动生成。
**输入结构**:
```json
{
"concept": { "slug": "concept/rag", "title": "RAG 检索增强生成", "summary": "...", "content": "..." },
"entities": [
{ "slug": "entity/vector-db", "title": "向量数据库", "summary": "...", "link_type": "outlink" },
{ "slug": "entity/embedding", "title": "Embedding 模型", "summary": "...", "link_type": "bidirectional" }
],
"language": "zh-CN",
"depth": "intermediate",
"audience": "相关领域的学习者"
}
```
**输出 requirement 结构**:
```
基于知识图谱概念「[concept.title]」,为[audience]创建一个[depth]微课堂(micro-classroom)。
教学锚点:[concept.summary]
学习目标:
- 理解[concept.summary 中的关键句]
核心知识点:
- [从 concept.content 解析的定义/机制]
关联实体(实践环节):
- 案例:[entity.title]:[entity.summary]
- 工具:[entity.title]:[entity.summary]
- 应用场景:[entity.title]:[entity.summary]
- 前置知识:[entity.title]
实践任务:
- 通过 [entity.title] 实践 [concept.title] 的应用
常见误区检查:
- [从 concept.content 解析的误区]
评估提示:
- 请解释 [concept.title] 的核心定义
请使用中文生成课程内容。
```
**entity 分类排序规则**(纯文本操作,无 LLM/embedding):
- link_type 权重:bidirectional (+3) > outlink (+2) > inlink (+1)
- title token overlap:concept title 分词后与 entity title 的交集数 (+1 per hit, cap +2)
- summary keyword hit:concept summary 关键词在 entity summary 中出现 (+1 per hit, cap +2)
- slug token hit:concept slug token 在 entity slug 中出现 (+1)
- summary 为空扣分 (-2)
- 取 top 3-5 entities,分为 Examples / Tools / Application Scenarios / Prerequisites
**概念内容解析逻辑**:
- 优先解析 markdown 结构:标题列表(定义段、机制段、案例段、误区段)
- fallback 到前 N 字
## 示例
### 示例 1: 技术文档 → 课程