From c1afde1187c9bd344e85b4dff68735b1e728eff9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?cls=5F=E5=AE=81=E6=B3=A2=E6=9C=AC=E6=9C=BA?= <908705107@qq.com> Date: Sun, 21 Jun 2026 23:40:40 +0800 Subject: [PATCH] feat: improve agent chat entry --- web/apps/web-ele/src/router/prefetch.ts | 1 + .../src/views/_core/agent-chat/index.vue | 92 ++++++++++++++++--- 2 files changed, 82 insertions(+), 11 deletions(-) diff --git a/web/apps/web-ele/src/router/prefetch.ts b/web/apps/web-ele/src/router/prefetch.ts index 487e63f..b363b47 100644 --- a/web/apps/web-ele/src/router/prefetch.ts +++ b/web/apps/web-ele/src/router/prefetch.ts @@ -143,6 +143,7 @@ function prefetchAiPlatformPages(currentPath = '') { if (isAiPlatformRoute(currentPath)) { delayedPrefetch(aiManagementPrefetchTasks, 2000); + delayedPrefetch(aiInteractivePrefetchTasks, 4500); return; } diff --git a/web/apps/web-ele/src/views/_core/agent-chat/index.vue b/web/apps/web-ele/src/views/_core/agent-chat/index.vue index 6c70792..58dc328 100644 --- a/web/apps/web-ele/src/views/_core/agent-chat/index.vue +++ b/web/apps/web-ele/src/views/_core/agent-chat/index.vue @@ -8,7 +8,7 @@ import { Page } from '@vben/common-ui/es/page'; import { PanelLeft, PanelRight } from '@vben/icons'; import { $t } from '@vben/locales'; -import { ElButton, ElEmpty } from 'element-plus'; +import { ElButton, ElEmpty, ElTag } from 'element-plus'; import { getAgentByCodeApi } from '#/api/ai-platform/ai-platform'; @@ -53,6 +53,43 @@ const currentConversationId = ref(null); const showHistoryPanel = ref(false); const conversationListRef = ref(); +const agentModeLabel = computed(() => { + const mode = agent.value?.mode; + if (mode === 'autonomous') return '自主规划'; + if (mode === 'dialog_flow') return '对话流'; + return mode || '-'; +}); + +const agentStatusLabel = computed(() => { + const status = agent.value?.status; + if (status === 'published') return '已发布'; + if (status === 'draft') return '草稿'; + if (status === 'disabled') return '已停用'; + return status || '-'; +}); + +const agentStatusType = computed(() => { + const status = agent.value?.status; + if (status === 'published') return 'success'; + if (status === 'disabled') return 'danger'; + return 'warning'; +}); + +const modelLabel = computed( + () => agent.value?.model_name || agent.value?.model_id || '默认 Chat 模型', +); + +const agentDescription = computed( + () => + agent.value?.description || + agent.value?.welcome_message || + '发送消息后开始智能体协作。', +); + +const historyButtonTitle = computed(() => + showHistoryPanel.value ? '收起历史' : '打开历史', +); + // 加载智能体 async function loadAgent() { if (!agentCode.value) { @@ -128,7 +165,7 @@ onMounted(() => {
{
-
- - +
+
+ +
+
+
+ {{ agent.name }} +
+ + {{ agentStatusLabel }} + +
+
+ {{ agentDescription }} +
+
+ +
{ :enable-image="true" :show-clear-button="true" :show-header="false" - class="flex-1" + class="agent-chat-panel min-h-0 flex-1" @message-complete="handleMessageComplete" />
@@ -169,3 +226,16 @@ onMounted(() => {
+ +