架构概览
表示层 (Presentation)
React 组件、设计系统、工作区视图
design-system/workspace/providers/
API 路由层 (API Routes)
Next.js App Router API 端点
api/v1/session/api/v1/block/api/v1/copilot/api/v1/sessions/api/v1/verify/
核心层 (Core)
业务逻辑、AI 引擎、算法
ai-brain/flow-controller/personas/memory-hub/exporters/
基础设施层 (Infrastructure)
状态管理、持久化、外部服务网关
store/persistence/server/tts/i18n/
API 参考
POST
/api/v1/session创建学习会话蓝图,返回 SSE 流事件。兼容入口:/api/v1/builder/blueprint/stream
Request Body:
{ topic: string, style?: "documentary" | "socratic" | "storytelling" | "workshop", difficulty?: "beginner" | "intermediate" | "advanced", language?: string }Response:
text/event-stream → start | blueprint | error | [DONE]POST
/api/v1/block/hydrate填充单个区块内容,返回 SSE 流事件。兼容入口:/api/v1/builder/block/hydrate
Request Body:
{ blockOutline, sessionTopic, sessionStyle?, sessionDifficulty?, sessionLanguage?, previousBlocksSummary?, personaUids?, learnerContext? }Response:
text/event-stream → content_partial | timeline_event | narration_text | progress | complete | error | [DONE]POST
/api/v1/copilotAI 助教对话,返回 SSE 流事件。兼容入口:/api/v1/interaction/copilot/stream
Request Body:
{ conversationHistory, contextSnapshot?, config?: { personaUids?, dialogueMode?, topic? } }Response:
text/event-stream → persona_message / ink / highlight / error / done / [DONE]POST
/api/v1/tts文字转语音。兼容入口:/api/v1/assets/synthesize-voice
Request Body:
{ text: string, voice?: string, speed?: number, volume?: number, format?: "mp3" | "wav" }Response:
audio/* 或 { fallback: "browser", message, text }GET/POST/DELETE
/api/v1/sessions会话列表/读取/创建更新/删除,已接入服务端文件持久化
Request Body:
GET ?uid=...;POST { uid?, title?, topic?, description?, language?, style?, requirement?, blueprint?, blocks?, personaUids?, gateway?, status?, progress?, currentBlockIndex? };DELETE ?uid=...Response:
{ success, items?, item?, listItem?, total?, deleted? }GET/POST
/api/v1/verify/provider校验 AI provider/baseUrl/model/apiKey 配置
Request Body:
POST { provider?, baseUrl?, model?, apiKey? }Response:
{ success, provider?, resolved, availableProviders?, errors }POST
/api/v1/export导出课程为指定格式
Request Body:
{ sessionId?: string, format: "pptx" | "html" | "markdown" } 或完整 session payloadResponse:
BlobGET
/api/v1/health健康检查
Request Body:
-Response:
{ status: "ok", timestamp: string }快速开始
1. 克隆项目
git clone https://github.com/openedu/openedu.git && cd openedu2. 安装依赖
pnpm install3. 配置环境变量
cp .env.example .env.local4. 启动开发服务器
pnpm dev