v0.11.1: 权限体系重构 + AI管线优化 + 内容整理
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { requireAdmin } from "@/lib/admin-auth";
|
||||
import { prisma } from "@/lib/prisma";
|
||||
import { discoverSkills } from "@/lib/skill-discoverer";
|
||||
|
||||
export async function POST(request: Request) {
|
||||
const authError = await requireAdmin();
|
||||
if (authError) return authError;
|
||||
|
||||
try {
|
||||
const body = await request.json().catch(() => ({}));
|
||||
const result = await discoverSkills(prisma, {
|
||||
minStars: body.minStars ?? 500,
|
||||
maxPerQuery: body.maxPerQuery ?? 5,
|
||||
dailyLimit: body.dailyLimit ?? 10,
|
||||
withReview: body.withReview ?? true,
|
||||
queries: body.queries,
|
||||
});
|
||||
|
||||
return NextResponse.json(result);
|
||||
} catch (error: unknown) {
|
||||
const err = error as { message?: string };
|
||||
return NextResponse.json({ error: err.message }, { status: 500 });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user