|
|
|
@ -92,6 +92,7 @@ public class KlTxt2Img extends KlCommon {
|
|
|
|
|
// 提示词和模型名称
|
|
|
|
|
String prompt = "一只可爱的小猫咪在草地上玩耍,阳光明媚";
|
|
|
|
|
String modelName = "kling-v1"; // 可选:kling-v1, kling-v1-5, kling-v2
|
|
|
|
|
String saveImagePath = basePath + "KeLing_Txt_2_Image.png";
|
|
|
|
|
|
|
|
|
|
// 添加重试逻辑
|
|
|
|
|
int generateRetryCount = 0;
|
|
|
|
@ -110,8 +111,8 @@ public class KlTxt2Img extends KlCommon {
|
|
|
|
|
|
|
|
|
|
// 检查是否是账户问题
|
|
|
|
|
if (e.getMessage().contains("资源包已耗尽") ||
|
|
|
|
|
e.getMessage().contains("账户欠费") ||
|
|
|
|
|
e.getMessage().contains("无权限")) {
|
|
|
|
|
e.getMessage().contains("账户欠费") ||
|
|
|
|
|
e.getMessage().contains("无权限")) {
|
|
|
|
|
log.error("账户问题,停止重试");
|
|
|
|
|
accountIssue = true;
|
|
|
|
|
} else {
|
|
|
|
@ -161,7 +162,7 @@ public class KlTxt2Img extends KlCommon {
|
|
|
|
|
String imageUrl = image.getString("url");
|
|
|
|
|
|
|
|
|
|
// 下载图片
|
|
|
|
|
String saveImagePath = basePath + "image_" + index + ".png";
|
|
|
|
|
|
|
|
|
|
log.info("开始下载图片...");
|
|
|
|
|
downloadFile(imageUrl, saveImagePath);
|
|
|
|
|
log.info("图片已下载到: {}", saveImagePath);
|
|
|
|
|