import { NextRequest, NextResponse } from "next/server"; import { removeComfyModel } from "@/lib/docker"; export const dynamic = "force-dynamic"; export const runtime = "nodejs"; /** * POST /api/comfy/models/rm * Body: { filename: string, type?: string } * Removes a comfy model from disk via model-worker. */ export async function POST(req: NextRequest) { const body = (await req.json()) as { filename?: string; type?: string }; if (!body.filename) { return NextResponse.json( { ok: false, error: "filename required" }, { status: 400 } ); } const result = await removeComfyModel(body.filename, body.type); return NextResponse.json( { ok: result.ok, output: result.output, error: result.error }, { status: result.ok ? 200 : 500 } ); }