fix: PicWish API返回的是file字段不是image字段
This commit is contained in:
parent
e24d2cf9b0
commit
33f2a729d6
@ -56,13 +56,13 @@ async function pollForResult(taskId: string, apiKey: string): Promise<{ success:
|
|||||||
|
|
||||||
// 检查任务状态
|
// 检查任务状态
|
||||||
if (result.data?.state === 1) {
|
if (result.data?.state === 1) {
|
||||||
// 任务完成
|
// 任务完成 - PicWish API 返回 "file" 字段
|
||||||
const imageUrl = result.data?.image;
|
const imageUrl = result.data?.file || result.data?.image;
|
||||||
if (imageUrl) {
|
if (imageUrl) {
|
||||||
return { success: true, imageUrl };
|
return { success: true, imageUrl };
|
||||||
}
|
}
|
||||||
return { success: false, error: "处理完成但未返回图片URL" };
|
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 || "去水印处理失败" };
|
return { success: false, error: result.data?.error || "去水印处理失败" };
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user