zjs_project 10 ماه پیش
والد
کامیت
72406cd89a

+ 1 - 0
package.json

@@ -26,6 +26,7 @@
     "jquery": "^3.6.0",
     "mint-ui": "^2.2.13",
     "qiniu-js": "^2.4.0",
+    "replicate": "^0.32.0",
     "three": "^0.154.0",
     "vue": "^2.6.14",
     "vue-count-to": "^1.0.13",

+ 2 - 2
src/components/newQCCom/viewMask/viewMask.html

@@ -94,8 +94,8 @@
 				<div class="btn AiBtn rows justify-center up1" @click.stop="aiSubmit(1)">
 					<div class="iconfont icon-a-lujing35039 style1"></div>{{aiImagesList && aiImagesList.length>0?'继续生成':'开始设计'}}
 				</div>
-				<!-- <div class="btn houseType rows justify-center up2" @click.stop="gonext">
-					下一步
+				<!-- <div class="btn  rows justify-center up2" @click.stop="test">
+					
 				</div> -->
                 <div class="btn houseType rows justify-center up2" @click.stop="submit">
                 	提交

+ 89 - 0
src/components/newQCCom/viewMask/viewMask.vue

@@ -12,6 +12,11 @@
 		setStorage,
 		getStorage,
 	} from '@/utils/localStorage';
+    import Replicate from "replicate";
+    
+    const replicate = new Replicate({
+        auth: "Token r8_VvWR3EJobLn1G4FNlyEqBZaXxWY4X4E3Yjyfy",
+    });
 	// import requestConfig from '@/static/lib/requestConfig';
 	// const app = getApp(); //获取应用实例
 	export default {
@@ -679,6 +684,90 @@
 					}
 				})
 			},
+            //直接调接口测试
+            async test() {
+            	if(!this.styleList || this.curStyleIndex < 0 || !this.styleList[this.curStyleIndex].imgUrl){
+            		return false
+            	}
+            	if(this.$parent.pvCurPageName!="room_show"){//说明用户切换页面了
+            		console.warn("***用户已经退出页面***")
+            		return false;
+            	}
+                const output = await replicate.run(
+                  "batouresearch/sdxl-controlnet-lora:3bb13fe1c33c35987b33792b01b71ed6529d03f165d1c2416375859f09ca9fef",
+                  {
+                    input: {
+                      seed: null,
+                      image: "https://replicate.delivery/pbxt/JiOTMCHj4oGrTTf8Pg2r7vyI8YdXc5jL2IDyC2SfhuggjYe6/out-0%20(1).png",
+                      prompt: "shot in the style of sksfer, a woman in alaska",
+                      refine: "base_image_refiner",
+                      strength: 0.8,
+                      scheduler: "K_EULER",
+                      lora_scale: 0.95,
+                      num_outputs: 1,
+                      lora_weights: "https://pbxt.replicate.delivery/mwN3AFyYZyouOB03Uhw8ubKW9rpqMgdtL9zYV9GF2WGDiwbE/trained_model.tar",
+                      refine_steps: 20,
+                      guidance_scale: 7.5,
+                      apply_watermark: true,
+                      condition_scale: 0.5,
+                      negative_prompt: "",
+                      num_inference_steps: 40
+                    }
+                  }
+                );
+                console.log(output);
+            	// let imgUrl = this.styleList[this.curStyleIndex].imgUrl;
+            	// let subType = this.subType;
+            	// let session_hash = Date.now();
+            	// let theme = this.themeList[this.themeIndex];//主题数据
+            	// let prompt = this.styleList[this.curStyleIndex].prompt + theme.prot;
+            	// let noPromot = this.styleList[this.curStyleIndex].negativePrompt;
+            	// let unit = 768 / this.screenWidth;
+            	// this.imageWidth = parseInt((this.screenWidth * unit).toFixed());
+            	// this.imageHeight = parseInt((this.$parent.canvasHeight * unit).toFixed());
+            	// this.timeOut = this.modelType==1 ? 20000: 120000;
+            	// var parmas = {
+            	// 	negativePrompt: noPromot,
+            	// 	prompt: prompt,
+            	// 	"batchSize": 1,
+            	// 	brandId: $config.brandId,
+            	// 	height: this.imageHeight,
+            	// 	width: this.imageWidth,
+            	// 	"moduleType": "AI_Biography",
+            	// 	"steps":20,
+            	// 	"sampler":"DDIM",
+            	// 	"controlNetSessionHash":session_hash,
+            	// 	"cfgScale":12,
+            	// 	"denoising":0.9,
+            	// 	image:this.shottingImg,
+            	// 	styleImage:imgUrl,
+            	// 	keyword: "replicate",
+            	// 	model: this.modelType==1? "lucataco/ssd-1b" : 'catio-apps/controlnet-interior-design',
+            	// };
+            	// if(this.modelType==2){//精准设计
+            	// 	if(subType == 0){//首次
+            	// 		parmas.model = this.reqList[0].model;
+            	// 	}else{//重试
+            	// 		parmas.model = this.reqListReset[0].model;
+            	// 	}
+            	// }else{//创意设计
+            	// 	if(subType == 0){//首次
+            	// 		parmas.model = "lucataco/ssd-1b";
+            	// 	}else{//重试
+            	// 		parmas.model = "deployments/elabgroup/elab-ssd-1b";
+            	// 	}
+            	// }
+            	// this.curSpaceId = this.spaceObj.spaceId;//生成时的空间id
+            	// // let result = await this.prevHandle(parmas);
+            	// // console.warn("***prevHandle***",result)
+             //    let res = await requestConfig("https://replicate.com/batouresearch/sdxl-controlnet-lora?input=nodejs", parmas);
+             //    if (res && res.success) {
+                    
+             //    }else{
+                    
+             //    }
+                
+            },
 			//开始图生图流程
 			async startServer() {
 				if(!this.styleList || this.curStyleIndex < 0 || !this.styleList[this.curStyleIndex].imgUrl){

+ 6 - 0
src/components/newQCCom/viewlayout/viewlayout.vue

@@ -350,6 +350,7 @@
                     message: '正在变化,请稍后',
                 });
                 // this.sendMessageAction(JSON.stringify(parmas));
+                this.$parent.$parent.callBackFun = this.callBack;//向父页面注册通知回调函数
                 this.$emit("curSpaceChange", data); //通知父组件-当前已经选中了户型大类
             },
             //语音识别
@@ -436,6 +437,11 @@
                 // webAudioSpeechRecognizer = null;
                 Indicator.close();
             },
+            callBack(type){
+            	console.warn("***viewlayout-callBack***",type)
+            	// this.initSpanceData();
+            	this.$parent.$refs.viewCareful.initData();//注销父页面的通知回调函数
+            }
         }
     }
 </script>

+ 2 - 12
src/pages/webgl_rxdz_recognizer_houseList/webgl_rxdz_recognizer_houseList.vue

@@ -74,8 +74,8 @@
             console.log("***onLoad-webgl_rxdz_houseList***", this.$route.query)
             this.queryObj = getStorage('queryObj') ? JSON.parse(getStorage('queryObj')) : null;
             this.houseId = this.$route.query.houseId ? this.$route.query.houseId : (this.$store.state.houseId || '');
-            this.id = this.$route.query.id2 ? this.$route.query.id2 : (this.queryObj && this.queryObj.id2 ? this
-                .queryObj.id2 : '110');
+            // this.id = this.$route.query.id2 ? this.$route.query.id2 : (this.queryObj && this.queryObj.id2 ? this
+            //     .queryObj.id2 : '110');
             this.findHouseTypeSpaceList();
             this.getUserMedia();
             // this.queryTestcaseSingle();
@@ -459,7 +459,6 @@
                 console.warn('speechRecognizer',this.recording);
                 // if (!webAudioSpeechRecognizer) {
                     const params = {
-                        // signCallback: signCallback, // 鉴权函数,若直接使用默认鉴权函数。可不传此参数
                         // 用户参数
                         secretid: $config.secretId,
                         secretkey: $config.secretKey,
@@ -468,15 +467,6 @@
                         // token: config.token,
                         // 实时识别接口参数
                         engine_model_type: '16k_zh', // 因为内置WebRecorder采样16k的数据,所以参数 engineModelType 需要选择16k的引擎,为 '16k_zh'
-                        // 以下为非必填参数,可跟据业务自行修改
-                        // voice_format : 1,
-                        // hotword_id : '08003a00000000000000000000000000',
-                        // needvad: 1,
-                        // filter_dirty: 1,
-                        // filter_modal: 2,
-                        // filter_punc: 0,
-                        // convert_num_mode : 1,
-                        // word_info: 2
                     }
                     webAudioSpeechRecognizer = new WebAudioSpeechRecognizer(params);
                     Indicator.open({

+ 10 - 2
vue.config.js

@@ -13,8 +13,16 @@ module.exports = {
 	assetsDir: 'static', //放置生成的静态资源 (js、css、img、fonts) 的 (相对于 outputDir 的) 目录。-打包时才有意义
 	indexPath: 'index.html', //指定生成的 index.html 的输出路径 (相对于 outputDir)。也可以是一个绝对路径。-打包时才有意义
 	devServer: {
-		open: false,
-		proxy:{},
+		open: true,
+		proxy: {
+		    '/api': {
+		        target: "https://api.replicate.com/v1/", // 代理地址,这里设置的地址会代替axios中设置的baseURL
+		        changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
+		        pathRewrite: {
+		            '^/api': ''
+		        }
+		    },
+		}
 	},
 	chainWebpack: config => {
 		config.plugin('html')