Initial working commit
Some checks failed
Automated Container Build / build-and-push (push) Failing after 7s

This commit is contained in:
Elijah 2026-06-27 19:19:38 -07:00
parent 666ceb7325
commit b7ce314f01
105 changed files with 35510 additions and 11 deletions

View file

@ -0,0 +1,31 @@
import { NextRequest, NextResponse } from "next/server";
import * as settingsService from "@/services/settingsService";
export async function GET(request: NextRequest) {
const { searchParams } = new URL(request.url);
const type = searchParams.get("type") as "flashcards" | "quizzes" || "flashcards";
const instructions = await settingsService.getLlmInstructions(type);
return NextResponse.json({ value: instructions });
}
export async function PATCH(request: NextRequest) {
const { searchParams } = new URL(request.url);
const type = searchParams.get("type") as "flashcards" | "quizzes" || "flashcards";
const body = await request.json().catch(() => null);
if (!body || typeof body.value !== "string") {
return NextResponse.json(
{ error: "value is required" },
{ status: 400 }
);
}
if (body.value === "__RESET__") {
await settingsService.resetLlmInstructions(type);
const instructions = await settingsService.getLlmInstructions(type);
return NextResponse.json({ value: instructions });
}
await settingsService.updateLlmInstructions(type, body.value);
return NextResponse.json({ value: body.value });
}