|
@@ -208,22 +208,30 @@
|
|
|
reqList:[
|
|
|
{
|
|
|
model:'batouresearch/sdxl-controlnet-lora',
|
|
|
+ level:'5',
|
|
|
aiPicId:'',
|
|
|
+ resultImg:'',
|
|
|
},{
|
|
|
model:'lucataco/sdxl-controlnet',
|
|
|
+ level:'3',
|
|
|
aiPicId:'',
|
|
|
+ resultImg:'',
|
|
|
}
|
|
|
],
|
|
|
reqListReset:[
|
|
|
{
|
|
|
model:'deployments/elabgroup/elab-sdxl-controlnet-lora',
|
|
|
+ level:'5',
|
|
|
aiPicId:'',
|
|
|
+ resultImg:'',
|
|
|
},{
|
|
|
model:'batouresearch/sdxl-controlnet-lora',
|
|
|
+ level:'3',
|
|
|
aiPicId:'',
|
|
|
+ resultImg:'',
|
|
|
}
|
|
|
],
|
|
|
- dialogVisible: false
|
|
|
+ dialogVisible: false,
|
|
|
}
|
|
|
},
|
|
|
props:{
|
|
@@ -723,11 +731,29 @@
|
|
|
var self = this;
|
|
|
this.outTimer = setTimeout(function() {
|
|
|
if (self.img2imgTimer) {
|
|
|
- self.clearInterval();//停止轮询
|
|
|
- // self.$message.warning("AI开了个小差,请稍后再试");
|
|
|
- self.dialogVisible = true;
|
|
|
- self.aiFlag = false;
|
|
|
- self.aiImage = "";
|
|
|
+ let hasResult = false;
|
|
|
+ if(self.modelType==2){//精准设计
|
|
|
+ let reqList = [];
|
|
|
+ if(self.subType == 0){//首次
|
|
|
+ reqList = self.reqList;
|
|
|
+ }else{//重试
|
|
|
+ reqList = self.reqListReset;
|
|
|
+ }
|
|
|
+ reqList.some((item,index) => {
|
|
|
+ if(item.resultImg){
|
|
|
+ hasResult = true;
|
|
|
+ self.resultHandle(item.resultImg)
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ console.warn("***hasResult***",hasResult)
|
|
|
+ if(!hasResult){//没有结果
|
|
|
+ self.clearInterval();//停止轮询
|
|
|
+ // self.$message.warning("AI开了个小差,请稍后再试");
|
|
|
+ self.dialogVisible = true;//弹出超时提示
|
|
|
+ self.aiFlag = false;
|
|
|
+ self.aiImage = "";
|
|
|
+ }
|
|
|
}
|
|
|
clearTimeout(self.outTimer);
|
|
|
self.outTimer = null
|
|
@@ -769,91 +795,100 @@
|
|
|
id: model.aiPicId,
|
|
|
};
|
|
|
let res = await requestConfig("generateProcess", parmas);
|
|
|
- // let lastPage = getCurrentPages()[getCurrentPages().length - 2] ? getCurrentPages()[getCurrentPages().length - 2].$vm : null;
|
|
|
- // console.warn("图生图轮询结果:", res);
|
|
|
if (res.success && res.single) {
|
|
|
if(this.currentImg){//当前已经有生成图了
|
|
|
- console.warn("***当前已经有生成图了***")
|
|
|
+ console.warn("***当前已经有最高级生成图了***")
|
|
|
return false;
|
|
|
}
|
|
|
- if (res.single.inQueue == false) {
|
|
|
- if (res.single.urls) {
|
|
|
- this.currentImg = true;
|
|
|
- this.aiFlag = false;
|
|
|
- this.random = 100;
|
|
|
- console.warn("图生图轮询结束: ", res);
|
|
|
- this.aiImage = res.single.urls[0];
|
|
|
- this.showAIFlag = true;
|
|
|
- let newImage = this.aiImage;
|
|
|
- let aiStyleName = this.styleList[this.curStyleIndex].styleName;
|
|
|
- let _data = {
|
|
|
- image:newImage,
|
|
|
- checked:false,
|
|
|
- list:[newImage],
|
|
|
- }
|
|
|
- this.aiImagesList.push(_data);
|
|
|
- this.showAIImage = true;//显示AI结果集合-因为生成了AI图片
|
|
|
- if(this.$parent && typeof(this.$parent.clearHandle)=="function" ){
|
|
|
- this.$parent.clearHandle();
|
|
|
- }
|
|
|
- let cpAiData = JSON.parse(JSON.stringify(this.aiData)) || []
|
|
|
- if(cpAiData){//给上一个页面回传生成的数据
|
|
|
- let space = cpAiData.find(it=>{
|
|
|
- return it.houseFloor == this.curHouseObj.houseFloor && it.spaceId == this.spaceObj.spaceId
|
|
|
- })
|
|
|
- if(space){
|
|
|
- let data ={
|
|
|
- aiStyleName:aiStyleName,
|
|
|
- image:newImage,
|
|
|
- checked:false,
|
|
|
- }
|
|
|
- space.aiImagesList.push(data);
|
|
|
- }else{//不存在则构建数据
|
|
|
- let data = {
|
|
|
- houseFloor:this.curHouseObj.houseFloor,//当前的楼层
|
|
|
- spaceId:this.spaceObj.spaceId,
|
|
|
- aiImagesList:[
|
|
|
- {
|
|
|
- aiStyleName:aiStyleName,
|
|
|
- image:newImage,
|
|
|
- checked:false,
|
|
|
- }
|
|
|
- ]
|
|
|
- }
|
|
|
- cpAiData.push(data)
|
|
|
- }
|
|
|
- this.$store.dispatch('setAiData', cpAiData)
|
|
|
+ if (res.single.urls) {
|
|
|
+ console.warn("图生图轮询结束: ", res);
|
|
|
+ if(this.modelType==2){//精准设计
|
|
|
+ model.resultImg = res.single.urls[0];
|
|
|
+ if(model.level=='5'){//最高级了
|
|
|
+ this.currentImg = true;
|
|
|
+ this.resultHandle(res.single.urls[0])
|
|
|
}
|
|
|
+ }else{
|
|
|
+ this.resultHandle(res.single.urls[0])
|
|
|
+ }
|
|
|
+ console.warn("***有生成图了***",model)
|
|
|
+
|
|
|
+ } else {
|
|
|
+ if (!res.success) {
|
|
|
+ this.showToast("渲染失败,请重试")
|
|
|
+ this.aiFlag = false;
|
|
|
+ this.aiImage = "";
|
|
|
this.clearInterval();
|
|
|
- if(this.aiImagesList.length>1){
|
|
|
- setTimeout(()=>{
|
|
|
- // this.$refs.carousel.next();
|
|
|
- this.$refs.carousel.setActiveItem(this.aiImagesList.length-1);//切换到最后一张
|
|
|
- }, 1000);
|
|
|
+ }else {
|
|
|
+ // this.random = parseInt(this.count * 2);
|
|
|
+ this.random = parseInt(this.count * 100/(this.timeOut/1000));
|
|
|
+ if(this.random>=100){
|
|
|
+ this.random = 99;
|
|
|
}
|
|
|
- } else {
|
|
|
- if (!res.success) {
|
|
|
- this.showToast("渲染失败,请重试")
|
|
|
- this.aiFlag = false;
|
|
|
- this.aiImage = "";
|
|
|
- this.clearInterval();
|
|
|
- }else {
|
|
|
- // this.random = parseInt(this.count * 2);
|
|
|
- this.random = parseInt(this.count * 100/(this.timeOut/1000));
|
|
|
- if(this.random>=100){
|
|
|
- this.random = 99;
|
|
|
- }
|
|
|
- if(!this.showAIImage){
|
|
|
- // this.$store.state.loadingMsg='生成中…' + this.random + '%';
|
|
|
- this.loadingMsg = '生成中…' + this.random + '%';
|
|
|
- }else{
|
|
|
- }
|
|
|
+ if(!this.showAIImage){
|
|
|
+ // this.$store.state.loadingMsg='生成中…' + this.random + '%';
|
|
|
+ this.loadingMsg = '生成中…' + this.random + '%';
|
|
|
+ }else{
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
+ //返回结果处理
|
|
|
+ resultHandle(resultImg){
|
|
|
+ this.currentImg = true;
|
|
|
+ this.aiFlag = false;
|
|
|
+ this.random = 100;
|
|
|
+ this.aiImage = resultImg;
|
|
|
+ this.showAIFlag = true;
|
|
|
+ let newImage = this.aiImage;
|
|
|
+ let aiStyleName = this.styleList[this.curStyleIndex].styleName;
|
|
|
+ let _data = {
|
|
|
+ image:newImage,
|
|
|
+ checked:false,
|
|
|
+ list:[newImage],
|
|
|
+ }
|
|
|
+ this.aiImagesList.push(_data);
|
|
|
+ this.showAIImage = true;//显示AI结果集合-因为生成了AI图片
|
|
|
+ if(this.$parent && typeof(this.$parent.clearHandle)=="function" ){
|
|
|
+ this.$parent.clearHandle();
|
|
|
+ }
|
|
|
+ let cpAiData = JSON.parse(JSON.stringify(this.aiData)) || []
|
|
|
+ if(cpAiData && this.curHouseObj && this.curHouseObj.houseFloor){//给上一个页面回传生成的数据
|
|
|
+ let space = cpAiData.find(it=>{
|
|
|
+ return it.houseFloor == this.curHouseObj.houseFloor && it.spaceId == this.spaceObj.spaceId
|
|
|
+ })
|
|
|
+ if(space){
|
|
|
+ let data ={
|
|
|
+ aiStyleName:aiStyleName,
|
|
|
+ image:newImage,
|
|
|
+ checked:false,
|
|
|
+ }
|
|
|
+ space.aiImagesList.push(data);
|
|
|
+ }else{//不存在则构建数据
|
|
|
+ let data = {
|
|
|
+ houseFloor:this.curHouseObj.houseFloor,//当前的楼层
|
|
|
+ spaceId:this.spaceObj.spaceId,
|
|
|
+ aiImagesList:[
|
|
|
+ {
|
|
|
+ aiStyleName:aiStyleName,
|
|
|
+ image:newImage,
|
|
|
+ checked:false,
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ cpAiData.push(data)
|
|
|
+ }
|
|
|
+ this.$store.dispatch('setAiData', cpAiData)
|
|
|
+ }
|
|
|
+ this.clearInterval();
|
|
|
+ if(this.aiImagesList.length>1){
|
|
|
+ setTimeout(()=>{
|
|
|
+ // this.$refs.carousel.next();
|
|
|
+ this.$refs.carousel.setActiveItem(this.aiImagesList.length-1);//切换到最后一张
|
|
|
+ }, 1000);
|
|
|
+ }
|
|
|
+ },
|
|
|
showToast(title,time=3000){
|
|
|
this.$store.state.loading = true;
|
|
|
this.$store.state.loadingMsg = title || "";
|