feat(lesson-preparation): V4 类型定义(interaction + QATurn + V4 文档)

This commit is contained in:
SpecialX
2026-07-04 11:11:54 +08:00
parent ccf1618b1c
commit 8fc798fbcf

View File

@@ -57,7 +57,8 @@ export type BlockType =
| "text_study"
| "exercise"
| "rich_text"
| "reflection";
| "reflection"
| "interaction"; // V4 新增:师生交互
// 正文节点类型(特殊:不可拖动,画布中央)
export type TextbookContentNodeType = "textbook_content";
@@ -208,6 +209,26 @@ export interface ReflectionBlockData {
reflection: ReflectionItem[];
}
// V4 师生交互
export interface QATurn {
id: string;
role: "teacher" | "student";
content: string;
/** 教师提问的预期答案 / 引导策略(可选)*/
expectedAnswer?: string;
/** 这一轮的顺序 */
order: number;
}
export interface InteractionBlockData {
/** 设计意图 */
designIntent: string;
/** 对话轮次 */
turns: QATurn[];
/** 关联知识点 */
knowledgePointIds: string[];
}
// 正文节点数据
export interface TextbookContentNodeData {
chapterId: string;
@@ -227,7 +248,8 @@ export type BlockData =
| SummaryBlockData
| HomeworkBlockData
| BlackboardBlockData
| ReflectionBlockData;
| ReflectionBlockData
| InteractionBlockData; // V4 新增
// V5-15 T1教学阶段用于画布节点分组与可视化排序
// - import: 导入环节
@@ -284,14 +306,20 @@ export type AnyLessonPlanNode = LessonPlanNode | TextbookContentNode;
// ---- 锚点 ----
export type AnchorType = "range" | "point";
// V4NodeAnchor 简化start/end/textPreview/invalid 字段标记为弃用)
// 旧 v3 字段保留用于迁移识别,新代码不应读取
export interface NodeAnchor {
id: string;
nodeId: string; // 关联的教学节点 ID
type: AnchorType;
start: number; // 正文纯文本偏移量
end?: number; // range 锚定的结束偏移
textPreview?: string; // range 锚定的文字预览(用于失效重定位)
invalid?: boolean; // 正文变更后无法重定位时标记为失效
/** @deprecated v3 字符串偏移v4 改用 Tiptap Mark不再使用 */
start?: number;
/** @deprecated v3 字符串偏移 */
end?: number;
/** @deprecated v3 文字预览 */
textPreview?: string;
/** @deprecated v3 失效标记 */
invalid?: boolean;
}
// ---- 边 ----
@@ -335,7 +363,7 @@ export interface LessonPlanDocumentV2 {
}
// v3课文锚点画布格式
export interface LessonPlanDocument {
export interface LessonPlanDocumentV3 {
version: 3;
textbookContentNodeId: string;
nodes: AnyLessonPlanNode[];
@@ -343,6 +371,20 @@ export interface LessonPlanDocument {
anchors: NodeAnchor[];
}
// v4纸感锚点格式Tiptap Mark 内嵌)
export interface LessonPlanDocumentV4 {
version: 4;
textbookContentNodeId: string;
nodes: AnyLessonPlanNode[];
edges: AnyLessonPlanEdge[]; // 保留但不再用于画布连线
anchors: NodeAnchor[]; // 简化:只存 id 关联
/** V4 新增:节点展开状态 */
expandedNodeIds: string[];
}
// 当前文档版本v4
export type LessonPlanDocument = LessonPlanDocumentV4;
// 课案
export interface LessonPlan {
id: string;