feat: add AI settings controls
This commit is contained in:
@@ -2,6 +2,7 @@ import { headers } from "next/headers";
|
||||
import { NextResponse } from "next/server";
|
||||
import { auth } from "@/auth";
|
||||
import { buildMultimodalMessages } from "@/lib/ai-event-messages";
|
||||
import { getAiDisabledMessage, isAdminAiEnabled } from "@/lib/ai-feature-flags";
|
||||
import { extractJsonFromText } from "@/lib/json-utils";
|
||||
import { openRouterClient } from "@/lib/openrouter-client";
|
||||
import { AiEventRequestSchema, AiEventResponseSchema } from "@/lib/types";
|
||||
@@ -86,6 +87,13 @@ const callMultimodal = async (
|
||||
};
|
||||
|
||||
export async function POST(request: Request) {
|
||||
if (!isAdminAiEnabled()) {
|
||||
return NextResponse.json(
|
||||
{ error: getAiDisabledMessage() },
|
||||
{ status: 403 },
|
||||
);
|
||||
}
|
||||
|
||||
const session = await auth.api.getSession({
|
||||
headers: await headers(),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user