debug: 添加轮询进度日志,监控任务处理状态
This commit is contained in:
parent
4e4c5e6bba
commit
e9cbca3042
@ -115,6 +115,7 @@ async function pollTaskResult(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const { progress, state } = result.data;
|
const { progress, state } = result.data;
|
||||||
|
console.log(`[Enhance] 轮询进度: progress=${progress}%, state=${state}, task_id=${taskId}`);
|
||||||
|
|
||||||
// state < 0 表示失败
|
// state < 0 表示失败
|
||||||
if (state < 0) {
|
if (state < 0) {
|
||||||
@ -123,6 +124,7 @@ async function pollTaskResult(
|
|||||||
|
|
||||||
// progress >= 100 表示完成
|
// progress >= 100 表示完成
|
||||||
if (progress >= 100) {
|
if (progress >= 100) {
|
||||||
|
console.log(`[Enhance] 任务完成,task_id=${taskId}`);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -298,6 +300,7 @@ export async function POST(request: NextRequest) {
|
|||||||
// 将Buffer转换为Uint8Array用于fetch(更兼容)
|
// 将Buffer转换为Uint8Array用于fetch(更兼容)
|
||||||
const uint8Array = new Uint8Array(formDataBuffer);
|
const uint8Array = new Uint8Array(formDataBuffer);
|
||||||
|
|
||||||
|
console.log("[Enhance API] 发送创建任务请求...");
|
||||||
const createResponse = await fetch(enhanceUrl, {
|
const createResponse = await fetch(enhanceUrl, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers,
|
headers,
|
||||||
@ -305,6 +308,7 @@ export async function POST(request: NextRequest) {
|
|||||||
signal: controller.signal,
|
signal: controller.signal,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log("[Enhance API] 创建任务响应状态:", createResponse.status, createResponse.statusText);
|
||||||
clearTimeout(timeoutId);
|
clearTimeout(timeoutId);
|
||||||
|
|
||||||
if (!createResponse.ok) {
|
if (!createResponse.ok) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user