|
|
|
@ -46,7 +46,6 @@ public class KlTxt2Img extends KlCommon {
|
|
|
|
|
.execute();
|
|
|
|
|
|
|
|
|
|
log.info("生成图片请求体:{}", JSONUtil.toJsonStr(requestBody));
|
|
|
|
|
log.info("生成图片响应体:{}", response.body());
|
|
|
|
|
// 检查响应状态码
|
|
|
|
|
if (response.getStatus() != 200) {
|
|
|
|
|
throw new Exception("请求失败,状态码:" + response.getStatus());
|
|
|
|
@ -119,8 +118,6 @@ public class KlTxt2Img extends KlCommon {
|
|
|
|
|
return responseJson;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 下载函数已移至KlCommon类
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
|
|
|
// 提示词和模型名称
|
|
|
|
|
String prompt = "一只可爱的小猫咪在草地上玩耍,阳光明媚";
|
|
|
|
@ -170,7 +167,7 @@ public class KlTxt2Img extends KlCommon {
|
|
|
|
|
|
|
|
|
|
// 查询任务状态
|
|
|
|
|
int queryRetryCount = 0;
|
|
|
|
|
int maxQueryRetries = 30; // 最大查询次数
|
|
|
|
|
int maxQueryRetries = 1000; // 最大查询次数
|
|
|
|
|
int queryRetryInterval = 3000; // 查询间隔(毫秒)
|
|
|
|
|
|
|
|
|
|
while (queryRetryCount < maxQueryRetries) {
|
|
|
|
|