|
@@ -87,7 +87,8 @@
|
|
|
"chatHistoryConf": ""
|
|
|
},
|
|
|
imageUrl:'',
|
|
|
- resultUrl:''
|
|
|
+ resultUrl:'',
|
|
|
+ scanParams:''
|
|
|
}
|
|
|
},
|
|
|
onLoad(option) {
|
|
@@ -96,12 +97,13 @@
|
|
|
if(option.type==1) this.backUrl = '/pages/home'
|
|
|
else if(option.type==2) this.backUrl = '/pages/role'
|
|
|
}
|
|
|
- this.deviceId = option.deviceId;
|
|
|
+ // this.deviceId = option.deviceId;
|
|
|
if(option.agentId){
|
|
|
this.title = '编辑角色';
|
|
|
this.agentId = option.agentId;
|
|
|
this.getDetail();
|
|
|
}
|
|
|
+ if(option.scanParams) this.scanParams = JSON.parse(option.scanParams)
|
|
|
this.getModelVoiceList();
|
|
|
},
|
|
|
watch:{
|
|
@@ -188,7 +190,7 @@
|
|
|
if(this.agentDto.voiceText==='请选择音色') return this.$showToast('请选择音色')
|
|
|
|
|
|
let dto = JSON.parse(JSON.stringify(this.agentDto));
|
|
|
- if(this.deviceId) dto.deviceId = this.deviceId;
|
|
|
+ // if(this.deviceId) dto.deviceId = this.deviceId;
|
|
|
//默认固定值(暂时)
|
|
|
dto.asrModelId = 'ASR_FunASR';
|
|
|
dto.vadModelId = 'VAD_SileroVAD';
|
|
@@ -201,13 +203,32 @@
|
|
|
dto.language = '中文';
|
|
|
dto.vllmModelId = 'VLLM_ChatGLMVLLM';
|
|
|
dto.avatar = this.resultUrl;
|
|
|
- this.$api.post(this.agentId?`/agent/update/${this.agentId}`:'/agent',dto).then(res=>{
|
|
|
- if(res.data.code!==0) return this.$showToast(res.data.msg)
|
|
|
- this.$showToast(this.agentId?'编辑成功':'创建成功');
|
|
|
- setTimeout(()=>{
|
|
|
- uni.reLaunch({ url:this.type==1?'/pages/home':'/pages/role' })
|
|
|
- },1500)
|
|
|
- })
|
|
|
+ if(this.scanParams){
|
|
|
+ this.$api.post('/device/bind',{
|
|
|
+ ...this.scanParams,
|
|
|
+ "type": "",
|
|
|
+ "userId": 0,
|
|
|
+ "agentId": ""
|
|
|
+ }).then(res=>{
|
|
|
+ if(res.data.code!==0) return this.$showToast(res.data.msg)
|
|
|
+ dto.deviceId = res.data.data;
|
|
|
+ this.$api.post('/agent',dto).then(res2=>{
|
|
|
+ if(res2.data.code!==0) return this.$showToast(res2.data.msg)
|
|
|
+ this.$showToast('设备绑定成功');
|
|
|
+ setTimeout(()=>{
|
|
|
+ uni.reLaunch({ url:'/pages/home' })
|
|
|
+ },1500)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ this.$api.post(this.agentId?`/agent/update/${this.agentId}`:'/agent',dto).then(res=>{
|
|
|
+ if(res.data.code!==0) return this.$showToast(res.data.msg)
|
|
|
+ this.$showToast(this.agentId?'编辑成功':'创建成功');
|
|
|
+ setTimeout(()=>{
|
|
|
+ uni.reLaunch({ url:this.type==1?'/pages/home':'/pages/role' })
|
|
|
+ },1500)
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
getDetail(){
|
|
|
this.$api.get(`/agent/${this.agentId}`).then(res=>{
|