feat: add AI settings controls

This commit is contained in:
2026-04-10 15:40:29 -04:00
parent e01a7ed1ad
commit 12849b2362
16 changed files with 907 additions and 127 deletions

View File

@@ -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(),
});