|
@@ -764,12 +764,12 @@ export default {
|
|
|
// { index: 98,label:"已发布"},
|
|
|
// { index: 99,label:"未发布"},
|
|
|
],
|
|
|
- statusList:[
|
|
|
- {value:'',label:'所有状态'},
|
|
|
- {value:1,label:"测试"},
|
|
|
- {value:2,label:"稳定"}
|
|
|
+ statusList: [
|
|
|
+ { value: "", label: "所有状态" },
|
|
|
+ { value: 1, label: "测试" },
|
|
|
+ { value: 2, label: "稳定" }
|
|
|
],
|
|
|
- statusType:'',
|
|
|
+ statusType: "",
|
|
|
labelSelect: [
|
|
|
{ value: "", label: "所有类型" },
|
|
|
{ value: "agent", label: "智能体" },
|
|
@@ -783,7 +783,8 @@ export default {
|
|
|
recentUse: [],
|
|
|
collect: [],
|
|
|
editAppCard: null,
|
|
|
- bannerObj: null
|
|
|
+ bannerObj: null,
|
|
|
+ userName: null
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
@@ -821,7 +822,7 @@ export default {
|
|
|
},
|
|
|
watch: {
|
|
|
searchText: {
|
|
|
- immediate:false,
|
|
|
+ immediate: false,
|
|
|
handler() {
|
|
|
if (this.searchText === "") {
|
|
|
this.getData();
|
|
@@ -849,7 +850,7 @@ export default {
|
|
|
type: this.showType, //应用的类型
|
|
|
juri: this.selectJuri, //应用权限 1:我的 2:组织内 3:所有人
|
|
|
stand: "cn", //cn站还是hk站
|
|
|
- status:this.statusType
|
|
|
+ status: this.statusType
|
|
|
};
|
|
|
|
|
|
this.ajax
|
|
@@ -920,13 +921,50 @@ export default {
|
|
|
// this.insertSave(item, 0);
|
|
|
// },
|
|
|
//复制app
|
|
|
- copyApp(item) {
|
|
|
+ async copyApp(item) {
|
|
|
this.$confirm(`确定复制《${item.name}》这个应用至我的列表吗?`, "复制", {
|
|
|
confirmButtonText: "确定",
|
|
|
cancelButtonText: "取消",
|
|
|
type: "warning"
|
|
|
})
|
|
|
- .then(() => {
|
|
|
+ .then(async e => {
|
|
|
+ this.copyAgentOrWorkflow(item);
|
|
|
+ // console.log(item);
|
|
|
+ // let url = item.url;
|
|
|
+ // let id =
|
|
|
+ // this.queryURLParams(url, "id") ||
|
|
|
+ // item.url.split("/")[item.url.split("/").length - 1];
|
|
|
+ // if (!id) return this.$message.error("复制失败,未找到对应id");
|
|
|
+ // if ((item.label = "workflow")) {
|
|
|
+ // this.ajax
|
|
|
+ // .get(`https://appapi.cocorobo.cn/api/agents/muti_agent/${id}`)
|
|
|
+ // .then(res => {
|
|
|
+ // let _data = res.data;
|
|
|
+ // let _idList = [];
|
|
|
+ // if (_data["dialoguePublishDataId"])
|
|
|
+ // _idList.push(_data["dialoguePublishDataId"]);
|
|
|
+ // if (_data["immersivePublishDataId"])
|
|
|
+ // _idList.push(_data["immersivePublishDataId"]);
|
|
|
+ // if (_data["cardPublishDataId"])
|
|
|
+ // _idList.push(_data["cardPublishDataId"]);
|
|
|
+ // if (_idList.length > 0) {
|
|
|
+ // } else {
|
|
|
+ // console.log("该应用无id");
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // } else if ((item.label = "agent")) {
|
|
|
+ // let _idList = [id];
|
|
|
+ // }
|
|
|
+ // this.ajax.get(`https://appapi.cocorobo.cn/api/agents/muti_agent/${id}`).then(res=>{
|
|
|
+ // let _data = res.data;
|
|
|
+ // console.log(_data)
|
|
|
+ // let dialoguePublishDataId = _data['dialoguePublishDataId'];
|
|
|
+ // let immersivePublishDataId = _data['immersivePublishDataId'];
|
|
|
+ // let cardPublishDataId = _data['cardPublishDataId'];
|
|
|
+ // console.log('dialoguePublishDataId',dialoguePublishDataId);
|
|
|
+ // console.log('immersivePublishDataId',immersivePublishDataId);
|
|
|
+ // console.log('cardPublishDataId',cardPublishDataId)
|
|
|
+ // })
|
|
|
let params = [
|
|
|
{
|
|
|
name: `${item.name}_copy`, //app名称
|
|
@@ -960,6 +998,63 @@ export default {
|
|
|
console.log("取消复制");
|
|
|
});
|
|
|
},
|
|
|
+ async copyAgentOrWorkflow(item) {
|
|
|
+ return new Promise(async resolve => {
|
|
|
+ let url = item.url;
|
|
|
+ let id =
|
|
|
+ this.queryURLParams(url, "id") ||
|
|
|
+ item.url.split("/")[item.url.split("/").length - 1];
|
|
|
+ if (!id){
|
|
|
+ console.log("该链接无对应id")
|
|
|
+ return resolve();
|
|
|
+ // return this.$message.error("复制失败,未找到对应id")
|
|
|
+ };
|
|
|
+ console.log(item)
|
|
|
+ if (item.label == "workflow") {//复制工作流
|
|
|
+ console.log("复制工作流")
|
|
|
+ this.ajax
|
|
|
+ .get(`https://appapi.cocorobo.cn/api/agents/muti_agent/${id}`)
|
|
|
+ .then(async res => {
|
|
|
+ let _data = res.data;
|
|
|
+ let _idList = [];
|
|
|
+ if (_data["dialoguePublishDataId"])
|
|
|
+ _idList.push(_data["dialoguePublishDataId"]);
|
|
|
+ if (_data["immersivePublishDataId"])
|
|
|
+ _idList.push(_data["immersivePublishDataId"]);
|
|
|
+ if (_data["cardPublishDataId"])
|
|
|
+ _idList.push(_data["cardPublishDataId"]);
|
|
|
+ if (_idList.length <= 0) {
|
|
|
+ resolve(0);
|
|
|
+ return console.log("该应用无id");
|
|
|
+ }
|
|
|
+ // /api/agents/copy_mutiAgent
|
|
|
+ this.ajax.post('https://appapi.cocorobo.cn/api/agents/copy_mutiAgent',{
|
|
|
+ ids: _idList,
|
|
|
+ userId: this.userId,
|
|
|
+ username: this.userName?this.userName:await this.getUserName(this.userId),
|
|
|
+ }).then(_=>{
|
|
|
+ resolve(1);
|
|
|
+ }).catch(e=>{
|
|
|
+ console.log(e)
|
|
|
+ resolve(0)
|
|
|
+ })
|
|
|
+ });
|
|
|
+ } else if (item.label == "agent") {//复制智能体
|
|
|
+ console.log("复制智能体")
|
|
|
+ let _idList = [id];
|
|
|
+ this.ajax.post('https://appapi.cocorobo.cn/api/agents/copy_agent',{
|
|
|
+ ids: _idList,
|
|
|
+ userId: this.userId,
|
|
|
+ username: this.userName?this.userName:await this.getUserName(this.userId),
|
|
|
+ }).then(_=>{
|
|
|
+ resolve(1);
|
|
|
+ }).catch(e=>{
|
|
|
+ console.log(e)
|
|
|
+ resolve(0)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
// 取消收藏
|
|
|
cancelCollectApp(item) {
|
|
|
this.editAppCard = null;
|
|
@@ -1216,11 +1311,15 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
delApp(item) {
|
|
|
- this.$confirm(`确定要取消发布《${item.name}》这个应用吗!`, `确定取消发布应用`, {
|
|
|
- confirmButtonText: "确定",
|
|
|
- cancelButtonText: "取消",
|
|
|
- type: "warning"
|
|
|
- })
|
|
|
+ this.$confirm(
|
|
|
+ `确定要取消发布《${item.name}》这个应用吗!`,
|
|
|
+ `确定取消发布应用`,
|
|
|
+ {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ }
|
|
|
+ )
|
|
|
.then(() => {
|
|
|
let params = [
|
|
|
{
|
|
@@ -1377,6 +1476,57 @@ export default {
|
|
|
this.getCollect();
|
|
|
});
|
|
|
}
|
|
|
+ },
|
|
|
+ queryURLParams(url, paramName) {
|
|
|
+ // 正则表达式模式,用于匹配URL中的参数部分。正则表达式的含义是匹配不包含 ?、&、= 的字符作为参数名,之后是等号和不包含 & 的字符作为参数值
|
|
|
+ let pattern = /([^?&=]+)=([^&]+)/g;
|
|
|
+ let params = {};
|
|
|
+
|
|
|
+ // match用于存储正则匹配的结果
|
|
|
+ let match;
|
|
|
+ // while 循环和正则表达式 exec 方法来迭代匹配URL中的参数
|
|
|
+ while ((match = pattern.exec(url)) !== null) {
|
|
|
+ // 在字符串url中循环匹配pattern,并对每个匹配项进行解码操作,将解码后的键和值分别存储在key和value变量中
|
|
|
+ let key = decodeURIComponent(match[1]);
|
|
|
+ let value = decodeURIComponent(match[2]);
|
|
|
+
|
|
|
+ if (params[key]) {
|
|
|
+ if (Array.isArray(params[key])) {
|
|
|
+ params[key].push(value);
|
|
|
+ } else {
|
|
|
+ params[key] = [params[key], value];
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 参数名在 params 对象中不存在,将该参数名和对应的值添加到 params 对象中
|
|
|
+ params[key] = value;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!paramName) {
|
|
|
+ // 没有传入参数名称, 返回含有所有参数的对象params
|
|
|
+ return params;
|
|
|
+ } else {
|
|
|
+ if (params[paramName]) {
|
|
|
+ return params[paramName];
|
|
|
+ } else {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getUserName(uid) {
|
|
|
+ return new Promise(resolve => {
|
|
|
+ let params = { uid: uid };
|
|
|
+ this.ajax
|
|
|
+ .get(this.$store.state.api + "getUser", params)
|
|
|
+ .then(res => {
|
|
|
+ let data = res.data[0][0];
|
|
|
+ this.userName = data.username;
|
|
|
+ resolve(data.username);
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ console.error(err);
|
|
|
+ });
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|