diff --git a/components/style-pro/StyleProWorkspace.tsx b/components/style-pro/StyleProWorkspace.tsx index 19ed44115..866ec7bcb 100644 --- a/components/style-pro/StyleProWorkspace.tsx +++ b/components/style-pro/StyleProWorkspace.tsx @@ -1331,10 +1331,18 @@ export function StyleProWorkspace({ while (Date.now() < deadline) { await sleep(STYLE_PRO_TASK_POLL_INTERVAL_MS); - const statusResponse = await fetch( - `/api/style-pro/generate?taskId=${encodeURIComponent(taskId)}`, - { cache: "no-store" } - ); + let statusResponse: Response; + try { + statusResponse = await fetch( + `/api/style-pro/generate?taskId=${encodeURIComponent(taskId)}`, + { cache: "no-store" } + ); + } catch (pollError) { + lastError = + pollError instanceof Error ? pollError.message : "查询任务失败"; + continue; + } + const statusPayload = (await statusResponse.json().catch(() => ({}))) as | StyleProGenerateResponse | undefined;