Commit fa295967 authored by netyouli's avatar netyouli

优化AI图生图功能

parent a05f35b4
......@@ -189,12 +189,21 @@ class AIDrawImageResultController extends GetxController {
}
Map<String, dynamic> jsonMap = jsonDecode("${event.data}");
final model = MidJourneyImageModel.fromJson(jsonMap);
final progressStr = model.progressStr ?? "";
if (progressStr.isNotEmpty) {
showProgressView.value = false;
EasyLoading.showError("AI生成图片错误:$progressStr");
return;
}
if (model.response?.buttonMessageId != null) {
_buttonMessageId = model.response?.buttonMessageId ?? "";
}
progress.value = model.progress ?? 0;
if (model.progress == 100) {
showProgressView.value = false;
if (model.response?.imageUrl == null) {
EasyLoading.showError("AI生成图片错误:imageUrl为null");
}
}
final progressBase64 = model.progressBase64 ?? "";
if (model.response?.imageUrl != null) {
......
......@@ -26,13 +26,15 @@ class MidJourneyModel {
class MidJourneyImageModel {
int? progress;
String? progressImageUrl;
String? progressStr;
String? progressBase64;
MidJourneyImageResponse? response;
MidJourneyImageModel({this.progress, this.progressImageUrl, this.response, this.progressBase64,});
MidJourneyImageModel({this.progress, this.progressStr, this.progressImageUrl, this.response, this.progressBase64,});
MidJourneyImageModel.fromJson(Map<String, dynamic> json) {
progress = json['progress'];
progressStr = json['progressStr'];
progressImageUrl = json['progressImageUrl'];
response = json['response'] != null
? new MidJourneyImageResponse.fromJson(json['response'])
......@@ -43,6 +45,7 @@ class MidJourneyImageModel {
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['progress'] = this.progress;
data['progressStr'] = this.progressStr;
data['progressImageUrl'] = this.progressImageUrl;
if (this.response != null) {
data['response'] = this.response?.toJson();
......
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