This commit is contained in:
jonathang4 2025-08-31 18:23:14 +08:00
parent e0d4330761
commit 0a6de7e945

View File

@ -239,6 +239,8 @@ export async function generateImages(
},
},
});
logger.log(`图片生成查询 ${historyId} errmsg: ${result.errmsg}`);
if (!result[historyId])
throw new APIException(EX.API_IMAGE_GENERATION_FAILED, "记录不存在");
status = result[historyId].status;
@ -260,6 +262,7 @@ export async function generateImages(
if (validImageUrls.length > 0) {
await imagesTaskCache.finishTask(task_id, -1, validImageUrls.join(",")); // Success
} else {
logger.error(`图片生成任务 ${task_id} 异常: 图片生成未返回有效链接`);
// If no valid URLs but no explicit error thrown earlier, consider it a failure.
// This could happen if item_list is empty or items don't have video_url.
await imagesTaskCache.finishTask(task_id, -2); // Failure
@ -267,6 +270,7 @@ export async function generateImages(
}
return validImageUrls;
}catch (error) {
logger.error(`图片生成任务 ${task_id} 异常: ${error.message}`);
await imagesTaskCache.finishTask(task_id, -2); // Failure due to exception
throw error; // Re-throw the error to be handled by the caller
}