From e48f67335caab3b3012f139006da0cb52a0f3535 Mon Sep 17 00:00:00 2001 From: caohuipeng Date: Wed, 20 May 2026 19:29:03 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=8E=92=E7=A8=8B=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E4=B8=AD=E8=A7=A6=E5=8F=91=E6=97=B6=E6=9C=BA?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E5=86=85=E5=AE=B9=E6=98=BE=E7=A4=BA=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/WorkspaceView.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/views/WorkspaceView.vue b/frontend/src/views/WorkspaceView.vue index f2b4993c..824c68a8 100644 --- a/frontend/src/views/WorkspaceView.vue +++ b/frontend/src/views/WorkspaceView.vue @@ -1849,7 +1849,7 @@ onMounted(async () => { {{ r.schedule_name || '-' }} {{ r.run_no }} - {{ r.trigger_type === 'manual' ? '手动' : '定时' }} + {{ r.trigger_type === 'manual' ? '手动' : r.trigger_type === 'test' ? '测试' : '定时' }} {{ formatDateTime(r.started_at) }} {{ formatDateTime(r.finished_at) }} {{ r.duration_ms != null ? (r.duration_ms >= 1000 ? (r.duration_ms / 1000).toFixed(1) + 's' : r.duration_ms + 'ms') : '-' }} From 73c93a497b0e7585a216dc3ace7244e5c10f9ac2 Mon Sep 17 00:00:00 2001 From: "DESKTOP-JKIE562\\PC" <1013397054@qq.com> Date: Wed, 20 May 2026 20:32:11 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AFUI=E4=BA=A4=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/dist/index.html | 4 +- frontend/src/views/ChatView.vue | 47 ++++++- frontend/src/views/WorkspaceView.vue | 202 ++++++++++++++++++++------- 3 files changed, 196 insertions(+), 57 deletions(-) diff --git a/frontend/dist/index.html b/frontend/dist/index.html index 88a1fad1..2e243d12 100644 --- a/frontend/dist/index.html +++ b/frontend/dist/index.html @@ -10,8 +10,8 @@ AI工作台 - - + +
diff --git a/frontend/src/views/ChatView.vue b/frontend/src/views/ChatView.vue index 50e893c4..b2f48af2 100644 --- a/frontend/src/views/ChatView.vue +++ b/frontend/src/views/ChatView.vue @@ -13,7 +13,7 @@ import { ref, onMounted, onBeforeUnmount, computed, watch, nextTick } from 'vue'; import { useI18n } from 'vue-i18n'; import { useChat } from '../composables/useChat'; -import { Send, Loader2, Plus, Copy, Edit2, RotateCw, Check, X, PanelLeftClose, PanelLeftOpen, Heart, Bell, Mail, Settings, ChevronDown, Sparkles, Database, Mic, LogOut, MessageSquareText, Globe, ExternalLink, Search, LayoutGrid, UserCircle } from 'lucide-vue-next'; +import { Send, Loader2, Plus, Copy, Edit2, RotateCw, Check, X, PanelLeftClose, PanelLeftOpen, Heart, Bell, Mail, Settings, ChevronDown, Sparkles, Database, Mic, LogOut, MessageSquareText, Globe, ExternalLink, Search, LayoutGrid, History, MoreVertical } from 'lucide-vue-next'; import { marked } from 'marked'; import { useRoute, useRouter } from 'vue-router'; import { config } from '../config'; @@ -26,6 +26,21 @@ import { getAuthHeaders, getStoredAuthUser, clearAuthUser } from '../utils/auth' const { t } = useI18n(); const { showMessageDialog } = useGlobalMessageDialog(); const { isMobile } = useIsMobile(); +const showMobileAgentPopover = ref(false); +const mobileAgentPopoverRef = ref(null); + +const handleMobileAgentPopoverClickOutside = (e: MouseEvent | TouchEvent) => { + if (mobileAgentPopoverRef.value && !mobileAgentPopoverRef.value.contains(e.target as Node)) { + showMobileAgentPopover.value = false; + } +}; + +const toggleMobileAgentPopover = () => { + showMobileAgentPopover.value = !showMobileAgentPopover.value; + if (showMobileAgentPopover.value) { + loadUserAgents(); + } +}; const currentUser = ref(getStoredAuthUser()); const showUserDropdown = ref(false); const userMenuRef = ref(null); @@ -1662,6 +1677,8 @@ const switchToAgent = (agent: { id: number; name: string }) => { onMounted(async () => { document.addEventListener('mousedown', handleDocumentPointerDown); document.addEventListener('touchstart', handleDocumentPointerDown, { passive: true }); + document.addEventListener('mousedown', handleMobileAgentPopoverClickOutside); + document.addEventListener('touchstart', handleMobileAgentPopoverClickOutside, { passive: true }); window.addEventListener('resize', syncViewportWidth); await syncCurrentUserProfile(); await loadAgent(); @@ -1681,6 +1698,8 @@ onMounted(async () => { onBeforeUnmount(() => { document.removeEventListener('mousedown', handleDocumentPointerDown); document.removeEventListener('touchstart', handleDocumentPointerDown); + document.removeEventListener('mousedown', handleMobileAgentPopoverClickOutside); + document.removeEventListener('touchstart', handleMobileAgentPopoverClickOutside); window.removeEventListener('resize', syncViewportWidth); stopBrowserResize(); if (scrollToBottomFrame !== null) { @@ -1873,9 +1892,29 @@ const showChatRating = ref(false);
AI
{{ currentAgent?.name || 'AI' }} - +
+ + +
+
+
智能体
+ +
暂无其他智能体
+
diff --git a/frontend/src/views/WorkspaceView.vue b/frontend/src/views/WorkspaceView.vue index f2b4993c..d4fad072 100644 --- a/frontend/src/views/WorkspaceView.vue +++ b/frontend/src/views/WorkspaceView.vue @@ -48,8 +48,7 @@ import { Megaphone, X, ChevronDown, - ChevronUp, - MessageCircle + ChevronUp } from 'lucide-vue-next'; import KbWorkspaceView from './KbWorkspaceView.vue'; @@ -320,7 +319,7 @@ const fetchHome = async () => { defaultSections.forEach(d => { if (!backendIds.has(d.id)) { if (config.workspace.modules[mapKey(d.id) as keyof typeof config.workspace.modules] === false) { - return; +return; } merged.push(d); } @@ -771,7 +770,7 @@ const handleRegister = async () => { } }; -const activeSidebarItem = ref<'profile' | 'applications' | 'feedback' | 'updates' | 'knowledge_base' | 'schedule_runs'>('applications'); +const activeSidebarItem = ref<'profile' | 'applications' | 'feedback' | 'updates' | 'knowledge_base' | 'schedule_runs' | 'history'>('applications'); const isProfileLoading = ref(false); const isProfileSaving = ref(false); const isProfileEditing = ref(false); @@ -817,15 +816,16 @@ const hasProfileUnsavedChanges = computed(() => { const mobileTabActive = computed({ get: () => { if (activeSidebarItem.value === 'profile') return 'profile'; - if (activeSidebarItem.value === 'feedback') return 'feedback'; + if (activeSidebarItem.value === 'history') return 'history'; return 'applications'; }, - set: (tab: 'applications' | 'feedback' | 'profile') => { + set: (tab: 'applications' | 'profile' | 'history') => { if (tab === 'profile') { activeSidebarItem.value = 'profile'; if (!profileUser.value.id) fetchProfile(); - } else if (tab === 'feedback') { - activeSidebarItem.value = 'feedback'; + } else if (tab === 'history') { + activeSidebarItem.value = 'history'; + if (chatHistories.value.length === 0) loadChatHistories(); } else { activeSidebarItem.value = 'applications'; } @@ -834,7 +834,7 @@ const mobileTabActive = computed({ const mobileTabTitle = computed(() => { if (mobileTabActive.value === 'profile') return '我的'; - if (mobileTabActive.value === 'feedback') return '意见反馈'; + if (mobileTabActive.value === 'history') return '历史会话'; return '应用管理'; }); @@ -1117,6 +1117,43 @@ const downloadWsScheduleExcel = async (runId: number) => { URL.revokeObjectURL(url); }; +interface ChatHistoryItem { + id: number; + conversation_id: string; + title: string; + agent_id?: number; + agent_name?: string; + created_at: string; +} +const chatHistories = ref([]); +const isLoadingHistories = ref(false); + +const loadChatHistories = async () => { + isLoadingHistories.value = true; + try { + const res = await fetch('/api/agents', { headers: getAuthHeaders() }); + if (!res.ok) { isLoadingHistories.value = false; return; } + const agentList = await res.json(); + const allHistories: ChatHistoryItem[] = []; + await Promise.all( + (Array.isArray(agentList) ? agentList : []).map(async (agent: any) => { + try { + const hRes = await fetch(`/api/chat/sessions?agent_id=${agent.id}`, { headers: getAuthHeaders() }); + if (hRes.ok) { + const sessions = await hRes.json(); + for (const s of sessions) { + allHistories.push({ ...s, agent_id: agent.id, agent_name: agent.name }); + } + } + } catch {} + }) + ); + allHistories.sort((a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime()); + chatHistories.value = allHistories; + } catch {} + isLoadingHistories.value = false; +}; + const navigateToGeneralChat = () => { router.push(`/chat/${DEFAULT_POST_LOGIN_AGENT_ID}`); }; @@ -1331,12 +1368,15 @@ onMounted(async () => { await fetchHome(); await handleWecomDeeplinkContext(); const viewParam = route.query.view as string; - const validViews: string[] = ['profile', 'applications', 'feedback', 'updates', 'knowledge_base', 'schedule_runs']; + const validViews: string[] = ['profile', 'applications', 'feedback', 'updates', 'knowledge_base', 'schedule_runs', 'history']; if (viewParam && validViews.includes(viewParam)) { activeSidebarItem.value = viewParam as typeof activeSidebarItem.value; if (viewParam === 'profile' && !profileUser.value.id) { await fetchProfile(); } + if (viewParam === 'history') { + await loadChatHistories(); + } } } else { await fetchPublicAgents(); @@ -1384,7 +1424,7 @@ onMounted(async () => { + +
+
+
+

登录OA系统

+
+ + +
+
+ + +
+
+
+
+