fix: PicWish API返回的是file字段不是image字段
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled

This commit is contained in:
Your Name 2026-02-03 14:45:06 +08:00
parent e24d2cf9b0
commit 33f2a729d6

View File

@ -56,13 +56,13 @@ async function pollForResult(taskId: string, apiKey: string): Promise<{ success:
// 检查任务状态
if (result.data?.state === 1) {
// 任务完成
const imageUrl = result.data?.image;
// 任务完成 - PicWish API 返回 "file" 字段
const imageUrl = result.data?.file || result.data?.image;
if (imageUrl) {
return { success: true, imageUrl };
}
return { success: false, error: "处理完成但未返回图片URL" };
} else if (result.data?.state === -1) {
} else if (result.data?.state === -1 || result.data?.state < 0) {
// 任务失败
return { success: false, error: result.data?.error || "去水印处理失败" };
}