From 645462abd0455eaad30a3393574edd3bb14bd3db Mon Sep 17 00:00:00 2001 From: zhuoqinglian <1035449612@qq.com> Date: Sat, 28 Feb 2026 17:51:46 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E6=A0=87=E7=AD=BE=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/manager-web/src/apis/module/agent.js | 31 +++++ .../manager-web/src/components/DeviceItem.vue | 68 ++++++++- main/manager-web/src/i18n/de.js | 3 +- main/manager-web/src/i18n/en.js | 3 +- main/manager-web/src/i18n/pt_BR.js | 3 +- main/manager-web/src/i18n/vi.js | 3 +- main/manager-web/src/i18n/zh_CN.js | 3 +- main/manager-web/src/i18n/zh_TW.js | 3 +- main/manager-web/src/views/roleConfig.vue | 131 +++++++++++++++++- 9 files changed, 235 insertions(+), 13 deletions(-) diff --git a/main/manager-web/src/apis/module/agent.js b/main/manager-web/src/apis/module/agent.js index b90c932c..5cbd60cb 100644 --- a/main/manager-web/src/apis/module/agent.js +++ b/main/manager-web/src/apis/module/agent.js @@ -398,4 +398,35 @@ export default { }); }).send(); }, + // 获取智能体标签 + getAgentTags(agentId, callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/agent/${agentId}/tags`) + .method('GET') + .success((res) => { + RequestService.clearRequestTime(); + callback(res); + }) + .networkFail(() => { + RequestService.reAjaxFun(() => { + this.getAgentTags(agentId, callback); + }); + }).send(); + }, + // 保存智能体标签 + saveAgentTags(agentId, tags, callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/agent/${agentId}/tags`) + .method('PUT') + .data(tags) + .success((res) => { + RequestService.clearRequestTime(); + callback(res); + }) + .networkFail(() => { + RequestService.reAjaxFun(() => { + this.saveAgentTags(agentId, tags, callback); + }); + }).send(); + }, } diff --git a/main/manager-web/src/components/DeviceItem.vue b/main/manager-web/src/components/DeviceItem.vue index c29d3243..28cbcb5b 100644 --- a/main/manager-web/src/components/DeviceItem.vue +++ b/main/manager-web/src/components/DeviceItem.vue @@ -39,6 +39,11 @@
{{ $t('home.lastConversation') }}:{{ formattedLastConnectedTime }}
+
+
+ {{ tag }} +
+
@@ -81,6 +86,10 @@ export default { } else { return this.device.lastConnectedAt; } + }, + tags() { + if (!this.device.tags) return []; + return this.device.tags.map((tag) => tag.tagName); } }, methods: { @@ -102,15 +111,34 @@ export default { } this.$emit('chat-history', { agentId: this.device.agentId, agentName: this.device.agentName }) } + }, + watch: { + tags: { + handler(newTags) { + if (newTags.length === 0) return; + this.$nextTick(() => { + const scrollWidth = this.$refs.scrollRef.clientWidth; + const tagsWidth = this.$refs.tagsRef.clientWidth; + if (tagsWidth < scrollWidth) { + this.$refs.tagsRef.style.width = '100%'; + this.$refs.tagsRef.style.justifyContent = 'flex-end'; + } else { + this.$refs.tagsRef.style.width = 'fit-content'; + this.$refs.tagsRef.style.justifyContent = 'flex-start'; + } + }) + }, + immediate: true + } } } -