Commit d9f47644 authored by netyouli's avatar netyouli

优化生成串图片显示判断

parent 8e8e93f9
......@@ -79,11 +79,14 @@ class AIDrawImageResultController extends GetxController {
}
}
void loadImage(String imageUrl) async {
void loadImage(String imageUrl, int progress) async {
final imageData = await HttpUtil().getData(imageUrl);
if (imageData != null) {
placehoderImageData = this.imageData.value ?? imageData;
this.imageData.value = imageData;
if (progress == 100) {
showProgressView.value = false;
}
}
}
......@@ -200,9 +203,9 @@ class AIDrawImageResultController extends GetxController {
}
progress.value = model.progress ?? 0;
if (model.progress == 100) {
showProgressView.value = false;
if (model.response?.imageUrl == null) {
EasyLoading.showError("AI生成图片错误:imageUrl为null");
showProgressView.value = false;
}
}
final progressBase64 = model.progressBase64?.replaceAll("data:image/png;base64,", "") ?? "";
......@@ -217,7 +220,7 @@ class AIDrawImageResultController extends GetxController {
imageData.value = decode;
} else {
if (imageUrl.value.isNotEmpty) {
loadImage(imageUrl.value);
loadImage(imageUrl.value, model.progress ?? 0);
}
}
final first = model.response?.buttons?.first ?? "";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment