Your Name 670a50c4d0
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled
feat: add enhance pro canvas workflow and presets
2026-04-04 22:40:50 +08:00

29 lines
951 B
TypeScript

import { NextResponse } from "next/server";
import { auth } from "@/app/(auth)/auth";
import { getSystemSetting } from "@/lib/db/queries";
import {
ENHANCE_PRO_KREA_SETTING_KEY,
normalizeEnhanceProKreaConfig,
sanitizeEnhanceProKreaConfigForClient,
} from "@/lib/enhance-pro/config";
export async function GET() {
try {
const session = await auth();
if (!session?.user?.id) {
return NextResponse.json({ error: "未授权,请先登录" }, { status: 401 });
}
const setting = await getSystemSetting({ key: ENHANCE_PRO_KREA_SETTING_KEY });
const config = normalizeEnhanceProKreaConfig(setting?.value);
return NextResponse.json({
success: true,
config: sanitizeEnhanceProKreaConfigForClient(config),
});
} catch (error) {
console.error("[Enhance Pro Config] 获取配置失败:", error);
return NextResponse.json({ error: "获取图像增强 Pro 配置失败" }, { status: 500 });
}
}