Przeglądaj źródła

调整AI生成逻辑

zjs_project 1 rok temu
rodzic
commit
7b1fa96bfc
1 zmienionych plików z 16 dodań i 15 usunięć
  1. 16 15
      src/components/newBottomCom/viewMask/viewMask.vue

+ 16 - 15
src/components/newBottomCom/viewMask/viewMask.vue

@@ -530,10 +530,10 @@
 				this.aiFlag = true;
 				this.aiImage = "";//清空AI结果图
 				this.stopInterval();
-				if(!this.showAIImage){
+				// if(!this.showAIImage){
 					this.myloading = true;
-					this.loadingMsg = "设计中...";
-				}
+					this.loadingMsg = "启动中";
+				// }
 				
 				// this.inputBase64Url = await this.shottingAction(2);//开始截图-返回的是base64的数据
 				// this.startServer();
@@ -756,10 +756,10 @@
 						process = 99;
 					}
 					if (count < randomNum) {//没有到上限
-						if(!self.showAIImage){
+						// if(!self.showAIImage){
 							self.myloading = true;
 							self.loadingMsg = '生成中…' + process + '%';
-						}
+						// }
 					}else{
 						self.myloading = false;
 						self.resultHandle(resultImg);
@@ -793,12 +793,11 @@
 					return false;
 				}
 				let self = this;
-				this.count = 0;//轮询次数
+				this.count = 1;//轮询次数
 				var random = 0;
 				this.currentImg = false;//当次生成图还没有结果
 				this.timer = 1;
 				this.getOutPicture();//不在轮询,而是等结果
-				this.count = this.count + 1;
 				this.setOutTimer();//设置超时逻辑
 			},
 			//设置一个超时逻辑,到底指定时间后停止轮询,当前是90s
@@ -895,13 +894,13 @@
 								this.currentImg = true;
 								setTimeout(()=>{
 									this.resultHandle(res.single.output)
-								},2000)
+								},1500)
 							}
 						}else{
 							this.currentImg = true;
 							setTimeout(()=>{
 								this.resultHandle(res.single.output)
-							},2000)
+							},1500)
 						}
 						console.warn("***有生成图了***",model)
 					} 
@@ -919,15 +918,17 @@
 			},
 			//进度处理
 			processHandle(single){
-				console.warn("***single***",single.status,single.progress,single);
+				console.warn("***single***",single.status,single.progress,this.count,single);
 				let self = this;
 				if(single.status=='starting'){//启动中的逻辑
 					if(this.count>=20){
 						this.stopInterval();//停止轮询
 						this.dialogAIVisible = true;
 					}else{
-						this.showToast("启动中");
+						this.myloading = true;
+						this.loadingMsg = '启动中';
 					}
+					this.count = this.count + 1;
 					this.getOutPicture();
 				}else if(single.status=='processing'){
 					let random = single.progress || 0;
@@ -938,10 +939,10 @@
 					// 	icon: 'loading',
 					// 	title: '生成中…' + parseInt(random) + '%'
 					// })
-					if(!this.showAIImage){
+					// if(!this.showAIImage){
 						this.myloading = true;
 						this.loadingMsg = '生成中…' + parseInt(random) + '%';
-					}
+					// }
 					this.getOutPicture();
 				}else if(single.status=='succeeded'){
 					// uni.showLoading({
@@ -949,10 +950,10 @@
 					// 	title: '生成中…100%',
 					// 	duration:2000,
 					// })
-					if(!this.showAIImage){
+					// if(!this.showAIImage){
 						this.myloading = true;
 						this.loadingMsg = '生成中…100%';
-					}
+					// }
 				}
 			},
 			//返回结果处理