mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-28 10:03:54 +08:00
add:manage-web智能体功能
添加智能体功能
This commit is contained in:
@@ -159,36 +159,52 @@ export default {
|
|||||||
});
|
});
|
||||||
}).send();
|
}).send();
|
||||||
},
|
},
|
||||||
|
// 获取智能体列表
|
||||||
|
getAgentList(callback) {
|
||||||
|
RequestService.sendRequest()
|
||||||
|
.url(`${getServiceUrl()}/api/v1/user/agent`)
|
||||||
|
.method('GET')
|
||||||
|
.success((res) => {
|
||||||
|
RequestService.clearRequestTime();
|
||||||
|
callback(res);
|
||||||
|
})
|
||||||
|
.fail(() => {
|
||||||
|
RequestService.reAjaxFun(() => {
|
||||||
|
this.getAgentList(callback);
|
||||||
|
});
|
||||||
|
}).send();
|
||||||
|
},
|
||||||
|
|
||||||
// 获取智能体列表
|
getUserInfo(callback) {
|
||||||
getAgentList(callback) {
|
RequestService.sendRequest()
|
||||||
RequestService.sendRequest()
|
.url(`${getServiceUrl()}/api/v1/user/info`)
|
||||||
.url(`${getServiceUrl()}/api/v1/user/agent`)
|
.method('GET')
|
||||||
.method('GET')
|
.success((res) => {
|
||||||
.success((res) => {
|
RequestService.clearRequestTime()
|
||||||
RequestService.clearRequestTime();
|
callback(res)
|
||||||
callback(res);
|
})
|
||||||
|
.fail((err) => {
|
||||||
|
console.error('接口请求失败:', err)
|
||||||
|
RequestService.reAjaxFun(() => {
|
||||||
|
this.getUserInfo(callback)
|
||||||
})
|
})
|
||||||
.fail(() => {
|
}).send()
|
||||||
RequestService.reAjaxFun(() => {
|
},
|
||||||
this.getAgentList(callback);
|
// 添加智能体
|
||||||
});
|
addAgent(agentName, callback) {
|
||||||
}).send();
|
RequestService.sendRequest()
|
||||||
},
|
.url(`${getServiceUrl()}/api/v1/user/agent`)
|
||||||
getUserInfo(callback) {
|
.method('POST')
|
||||||
RequestService.sendRequest()
|
.data({ name: agentName })
|
||||||
.url(`${getServiceUrl()}/api/v1/user/info`)
|
.success((res) => {
|
||||||
.method('GET')
|
RequestService.clearRequestTime();
|
||||||
.success((res) => {
|
callback(res);
|
||||||
RequestService.clearRequestTime()
|
})
|
||||||
callback(res)
|
.fail(() => {
|
||||||
})
|
RequestService.reAjaxFun(() => {
|
||||||
.fail((err) => {
|
this.addAgent(agentName, callback);
|
||||||
console.error('接口请求失败:', err)
|
});
|
||||||
RequestService.reAjaxFun(() => {
|
}).send();
|
||||||
this.getUserInfo(callback)
|
},
|
||||||
})
|
|
||||||
}).send()
|
|
||||||
},
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import userApi from '@/apis/module/user';
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'AddWisdomBodyDialog',
|
name: 'AddWisdomBodyDialog',
|
||||||
props: {
|
props: {
|
||||||
@@ -39,9 +42,16 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
confirm() {
|
confirm() {
|
||||||
this.$emit('update:visible', false)
|
if (!this.wisdomBodyName.trim()) {
|
||||||
this.$emit('confirmed', this.wisdomBodyName)
|
this.$message.error('请输入智慧体名称');
|
||||||
this.wisdomBodyName = ""
|
return;
|
||||||
|
}
|
||||||
|
userApi.addAgent(this.wisdomBodyName, (res) => {
|
||||||
|
this.$message.success('添加成功');
|
||||||
|
this.$emit('confirm', res);
|
||||||
|
this.$emit('update:visible', false);
|
||||||
|
this.wisdomBodyName = "";
|
||||||
|
});
|
||||||
},
|
},
|
||||||
cancel() {
|
cancel() {
|
||||||
this.$emit('update:visible', false)
|
this.$emit('update:visible', false)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="device-item">
|
<div class="device-item">
|
||||||
<div style="display: flex;justify-content: space-between;">
|
<div style="display: flex;justify-content: space-between;">
|
||||||
<div style="font-weight: 700;font-size: 24px;text-align: left;color: #3d4566;">
|
<div style="font-weight: 700;font-size: 18px;text-align: left;color: #3d4566;">
|
||||||
{{ device.agentName }}
|
{{ device.agentName }}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@@ -58,7 +58,7 @@ export default {
|
|||||||
.device-name {
|
.device-name {
|
||||||
margin: 7px 0 10px;
|
margin: 7px 0 10px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-size: 10px;
|
font-size: 11px;
|
||||||
color: #3d4566;
|
color: #3d4566;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
// 处理搜索
|
// 处理搜索
|
||||||
handleSearch() {
|
handleSearch() {
|
||||||
const searchValue = this.serach.trim();
|
const searchValue = this.serach.trim();
|
||||||
let filteredDevices;
|
let filteredDevices;
|
||||||
|
|||||||
@@ -71,9 +71,10 @@ export default {
|
|||||||
// 点击配置角色后跳转到角色配置页
|
// 点击配置角色后跳转到角色配置页
|
||||||
this.$router.push('/role-config')
|
this.$router.push('/role-config')
|
||||||
},
|
},
|
||||||
handleWisdomBodyAdded(name) {
|
handleWisdomBodyAdded(res) {
|
||||||
console.log('新增智慧体名称:', name)
|
console.log('新增智能体响应:', res);
|
||||||
this.addDeviceDialogVisible = false
|
this.fetchAgentList();
|
||||||
|
this.addDeviceDialogVisible = false;
|
||||||
},
|
},
|
||||||
handleDeviceManage() {
|
handleDeviceManage() {
|
||||||
this.$router.push('/device-management');
|
this.$router.push('/device-management');
|
||||||
|
|||||||
Reference in New Issue
Block a user