Disable cache storage on live config routes
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { requireRequestSession } from "@/lib/boss-auth";
|
||||
import { jsonNoStore } from "@/lib/api-response";
|
||||
import { deleteAiAccount, getAiAccount, saveAiAccount } from "@/lib/boss-data";
|
||||
|
||||
function isValidRole(value: string): value is "primary" | "backup" | "api_fallback" {
|
||||
@@ -16,14 +17,14 @@ export async function GET(
|
||||
) {
|
||||
const session = await requireRequestSession(request);
|
||||
if (!session) {
|
||||
return NextResponse.json({ ok: false, message: "UNAUTHORIZED" }, { status: 401 });
|
||||
return jsonNoStore({ ok: false, message: "UNAUTHORIZED" }, { status: 401 });
|
||||
}
|
||||
const { accountId } = await context.params;
|
||||
const account = await getAiAccount(accountId);
|
||||
if (!account) {
|
||||
return NextResponse.json({ ok: false, message: "AI_ACCOUNT_NOT_FOUND" }, { status: 404 });
|
||||
return jsonNoStore({ ok: false, message: "AI_ACCOUNT_NOT_FOUND" }, { status: 404 });
|
||||
}
|
||||
return NextResponse.json({ ok: true, account });
|
||||
return jsonNoStore({ ok: true, account });
|
||||
}
|
||||
|
||||
export async function PATCH(
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { requireRequestSession } from "@/lib/boss-auth";
|
||||
import { jsonNoStore } from "@/lib/api-response";
|
||||
import {
|
||||
createUserMasterMemory,
|
||||
listUserMasterMemories,
|
||||
@@ -27,7 +28,7 @@ function parseBoolean(value: string | null) {
|
||||
export async function GET(request: NextRequest) {
|
||||
const session = await requireRequestSession(request);
|
||||
if (!session) {
|
||||
return NextResponse.json({ ok: false, message: "UNAUTHORIZED" }, { status: 401 });
|
||||
return jsonNoStore({ ok: false, message: "UNAUTHORIZED" }, { status: 401 });
|
||||
}
|
||||
|
||||
const { searchParams } = new URL(request.url);
|
||||
@@ -35,7 +36,7 @@ export async function GET(request: NextRequest) {
|
||||
const scope = searchParams.get("scope") as MasterMemoryScope | null;
|
||||
const projectId = searchParams.get("projectId")?.trim() || undefined;
|
||||
if (scope && !memoryScopes.has(scope)) {
|
||||
return NextResponse.json({ ok: false, message: "INVALID_MEMORY_SCOPE" }, { status: 400 });
|
||||
return jsonNoStore({ ok: false, message: "INVALID_MEMORY_SCOPE" }, { status: 400 });
|
||||
}
|
||||
|
||||
const memories = await listUserMasterMemories(session.account, {
|
||||
@@ -43,7 +44,7 @@ export async function GET(request: NextRequest) {
|
||||
...(scope ? { scope } : {}),
|
||||
...(projectId ? { projectId } : {}),
|
||||
});
|
||||
return NextResponse.json({ ok: true, memories });
|
||||
return jsonNoStore({ ok: true, memories });
|
||||
}
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { requireRequestSession } from "@/lib/boss-auth";
|
||||
import { jsonNoStore } from "@/lib/api-response";
|
||||
import {
|
||||
getMasterAgentPromptPolicy,
|
||||
updateMasterAgentPromptPolicy,
|
||||
@@ -10,11 +11,11 @@ export const runtime = "nodejs";
|
||||
export async function GET(request: NextRequest) {
|
||||
const session = await requireRequestSession(request);
|
||||
if (!session) {
|
||||
return NextResponse.json({ ok: false, message: "UNAUTHORIZED" }, { status: 401 });
|
||||
return jsonNoStore({ ok: false, message: "UNAUTHORIZED" }, { status: 401 });
|
||||
}
|
||||
|
||||
const policy = await getMasterAgentPromptPolicy();
|
||||
return NextResponse.json({ ok: true, policy });
|
||||
return jsonNoStore({ ok: true, policy });
|
||||
}
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { requireRequestSession } from "@/lib/boss-auth";
|
||||
import { jsonNoStore } from "@/lib/api-response";
|
||||
import {
|
||||
clearUserMasterPrompt,
|
||||
getUserMasterPrompt,
|
||||
@@ -11,11 +12,11 @@ export const runtime = "nodejs";
|
||||
export async function GET(request: NextRequest) {
|
||||
const session = await requireRequestSession(request);
|
||||
if (!session) {
|
||||
return NextResponse.json({ ok: false, message: "UNAUTHORIZED" }, { status: 401 });
|
||||
return jsonNoStore({ ok: false, message: "UNAUTHORIZED" }, { status: 401 });
|
||||
}
|
||||
|
||||
const prompt = await getUserMasterPrompt(session.account);
|
||||
return NextResponse.json({ ok: true, prompt });
|
||||
return jsonNoStore({ ok: true, prompt });
|
||||
}
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { requireRequestSession } from "@/lib/boss-auth";
|
||||
import { jsonNoStore } from "@/lib/api-response";
|
||||
import {
|
||||
getAttachmentStorageConfig,
|
||||
upsertAttachmentStorageConfig,
|
||||
@@ -18,11 +19,11 @@ export const runtime = "nodejs";
|
||||
export async function GET(request: NextRequest) {
|
||||
const session = await requireRequestSession(request);
|
||||
if (!session) {
|
||||
return NextResponse.json({ ok: false, message: "UNAUTHORIZED" }, { status: 401 });
|
||||
return jsonNoStore({ ok: false, message: "UNAUTHORIZED" }, { status: 401 });
|
||||
}
|
||||
|
||||
const config = await getAttachmentStorageConfig(session.account);
|
||||
return NextResponse.json({
|
||||
return jsonNoStore({
|
||||
ok: true,
|
||||
config: sanitizeAttachmentStorageConfig(config),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user