Files

23 lines
607 B
TypeScript

import { NextResponse } from "next/server";
import { getAsrConfig } from "@/lib/stt/dashscope";
import { enqueueMissingTranscriptions } from "@/lib/stt/tasks";
export const runtime = "nodejs";
export async function POST() {
try {
getAsrConfig();
} catch (error) {
return NextResponse.json(
{ error: (error as Error).message },
{ status: 503 },
);
}
try {
return NextResponse.json(
{ queued: await enqueueMissingTranscriptions() },
{ status: 202 },
);
} catch {
return NextResponse.json({ error: "批量任务入队失败" }, { status: 500 });
}
}