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:50:18 +08:00
parent 4e4c5e6bba
commit e9cbca3042

View File

@ -115,6 +115,7 @@ async function pollTaskResult(
}
const { progress, state } = result.data;
console.log(`[Enhance] 轮询进度: progress=${progress}%, state=${state}, task_id=${taskId}`);
// state < 0 表示失败
if (state < 0) {
@ -123,6 +124,7 @@ async function pollTaskResult(
// progress >= 100 表示完成
if (progress >= 100) {
console.log(`[Enhance] 任务完成,task_id=${taskId}`);
return result;
}
@ -298,6 +300,7 @@ export async function POST(request: NextRequest) {
// 将Buffer转换为Uint8Array用于fetch(更兼容)
const uint8Array = new Uint8Array(formDataBuffer);
console.log("[Enhance API] 发送创建任务请求...");
const createResponse = await fetch(enhanceUrl, {
method: "POST",
headers,
@ -305,6 +308,7 @@ export async function POST(request: NextRequest) {
signal: controller.signal,
});
console.log("[Enhance API] 创建任务响应状态:", createResponse.status, createResponse.statusText);
clearTimeout(timeoutId);
if (!createResponse.ok) {