debug: 添加请求体处理步骤的调试日志
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled

This commit is contained in:
Your Name 2025-12-29 01:47:02 +08:00
parent e3f15b8bef
commit 4e4c5e6bba

View File

@ -197,7 +197,9 @@ export async function POST(request: NextRequest) {
}
// 2. 获取请求体(Base64图片或FormData)
console.log("[Enhance API] 开始获取请求体...");
const contentType = request.headers.get("content-type") || "";
console.log("[Enhance API] Content-Type:", contentType);
let imageBase64: string;
let prompt = ""; // 用户提示词(可选)
@ -206,7 +208,9 @@ export async function POST(request: NextRequest) {
if (contentType.includes("application/json")) {
// JSON格式:Base64图片
console.log("[Enhance API] 解析JSON请求体...");
const body = await request.json();
console.log("[Enhance API] JSON请求体解析完成,image_base64长度:", body.image_base64?.length || 0);
imageBase64 = body.image_base64;
prompt = body.prompt || "图片变清晰处理";
chatId = body.chatId || null;