import { NextResponse } from "next/server"; import { getVisualLessonFrames } from "@/lib/knowledge-base/sslc-physics"; export async function GET(request: Request) { const { searchParams } = new URL(request.url); const chapterId = searchParams.get("chapterId"); if (!chapterId) { return NextResponse.json({ error: "chapterId is required" }, { status: 400 }); } try { const data = getVisualLessonFrames(chapterId); if (!data) { return NextResponse.json({ error: "Not found" }, { status: 404 }); } return NextResponse.json(data); } catch { return NextResponse.json({ error: "Internal server error" }, { status: 500 }); } }