2025-03-25 05:40:07 +08:00
|
|
|
|
<template>
|
2025-03-31 23:02:05 +08:00
|
|
|
|
<div class="agent-view">
|
2025-05-15 22:34:32 +08:00
|
|
|
|
<div class="agent-view-body">
|
|
|
|
|
|
<!-- 中间内容区域 -->
|
|
|
|
|
|
<div class="content">
|
|
|
|
|
|
<AgentChatComponent
|
2025-10-13 11:12:25 +08:00
|
|
|
|
ref="chatComponentRef"
|
2025-08-11 21:29:33 +08:00
|
|
|
|
:single-mode="false"
|
2026-03-24 02:32:35 +08:00
|
|
|
|
@thread-change="handleThreadChange"
|
2025-05-15 22:34:32 +08:00
|
|
|
|
>
|
2026-05-25 21:02:23 +08:00
|
|
|
|
<template #input-actions-right="{ hasActiveThread }">
|
2026-04-18 16:22:59 +08:00
|
|
|
|
<a-dropdown
|
2026-03-16 21:39:49 +08:00
|
|
|
|
v-if="selectedAgentId"
|
2026-05-24 00:47:08 +08:00
|
|
|
|
v-model:open="agentDropdownOpen"
|
2026-04-18 16:22:59 +08:00
|
|
|
|
:trigger="['click']"
|
|
|
|
|
|
placement="topLeft"
|
|
|
|
|
|
overlay-class-name="config-dropdown-overlay"
|
2026-03-16 21:39:49 +08:00
|
|
|
|
>
|
2026-04-18 16:22:59 +08:00
|
|
|
|
<button
|
|
|
|
|
|
type="button"
|
|
|
|
|
|
class="input-action-btn config-dropdown-trigger"
|
|
|
|
|
|
:class="{ disabled: isLoadingConfig }"
|
|
|
|
|
|
@click.stop
|
|
|
|
|
|
@mousedown.stop
|
|
|
|
|
|
>
|
2026-05-24 00:47:08 +08:00
|
|
|
|
<span class="hide-text config-dropdown-text">{{ currentAgentLabel }}</span>
|
2026-04-18 16:22:59 +08:00
|
|
|
|
<ChevronDown size="15" class="config-dropdown-chevron" />
|
|
|
|
|
|
</button>
|
|
|
|
|
|
|
|
|
|
|
|
<template #overlay>
|
|
|
|
|
|
<div class="config-dropdown-panel" @click.stop>
|
|
|
|
|
|
<button
|
2026-05-24 00:47:08 +08:00
|
|
|
|
v-for="agent in agentQuickSwitchOptions"
|
|
|
|
|
|
:key="agent.value"
|
2026-04-18 16:22:59 +08:00
|
|
|
|
type="button"
|
|
|
|
|
|
class="config-dropdown-item"
|
2026-05-24 00:47:08 +08:00
|
|
|
|
:class="{
|
|
|
|
|
|
selected: agent.value === selectedAgentId,
|
|
|
|
|
|
disabled: hasActiveThread && agent.value !== selectedAgentId
|
|
|
|
|
|
}"
|
|
|
|
|
|
@click="handleAgentSwitch(agent.value, hasActiveThread)"
|
2026-04-18 16:22:59 +08:00
|
|
|
|
>
|
2026-05-24 00:47:08 +08:00
|
|
|
|
<img
|
2026-06-02 18:47:28 +08:00
|
|
|
|
v-if="agent.icon"
|
2026-05-24 00:47:08 +08:00
|
|
|
|
class="config-dropdown-item-icon-image"
|
|
|
|
|
|
:src="agent.icon"
|
|
|
|
|
|
:alt="`${agent.label}图标`"
|
|
|
|
|
|
/>
|
2026-06-02 18:47:28 +08:00
|
|
|
|
<span v-else class="config-dropdown-item-icon-empty" aria-hidden="true"></span>
|
2026-05-24 00:47:08 +08:00
|
|
|
|
<span class="config-dropdown-item-label">{{ agent.label }}</span>
|
|
|
|
|
|
<span v-if="agent.isBuiltin" class="config-dropdown-item-badge">内置</span>
|
2026-04-18 16:22:59 +08:00
|
|
|
|
<Check
|
2026-05-24 00:47:08 +08:00
|
|
|
|
v-if="agent.value === selectedAgentId"
|
2026-04-18 16:22:59 +08:00
|
|
|
|
:size="14"
|
|
|
|
|
|
class="config-dropdown-item-check"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</button>
|
|
|
|
|
|
|
2026-05-24 00:47:08 +08:00
|
|
|
|
<div v-if="hasActiveThread" class="config-dropdown-hint">
|
|
|
|
|
|
当前对话已绑定智能体,新对话可切换。
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-06-03 14:13:59 +08:00
|
|
|
|
<div class="config-dropdown-divider"></div>
|
2026-05-24 00:47:08 +08:00
|
|
|
|
|
2026-06-03 14:13:59 +08:00
|
|
|
|
<button
|
|
|
|
|
|
type="button"
|
|
|
|
|
|
class="config-dropdown-item action-item"
|
|
|
|
|
|
@click="openAgentManagement"
|
|
|
|
|
|
>
|
|
|
|
|
|
<Settings2 :size="15" class="config-dropdown-item-icon" />
|
|
|
|
|
|
<span class="config-dropdown-item-label">管理智能体</span>
|
|
|
|
|
|
</button>
|
2026-04-18 16:22:59 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</a-dropdown>
|
2026-03-16 21:39:49 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
2026-05-29 22:19:58 +08:00
|
|
|
|
<template #header-right="{ sideActive, hasActiveThread, toggleAgentPanel }">
|
2026-05-12 15:26:48 +08:00
|
|
|
|
<button
|
|
|
|
|
|
v-if="hasActiveThread"
|
|
|
|
|
|
type="button"
|
|
|
|
|
|
class="agent-nav-btn agent-state-btn"
|
2026-05-29 22:19:58 +08:00
|
|
|
|
:class="{ active: sideActive === 'file' }"
|
2026-05-12 15:26:48 +08:00
|
|
|
|
title="查看文件"
|
|
|
|
|
|
@click.stop="toggleAgentPanel"
|
|
|
|
|
|
>
|
|
|
|
|
|
<FolderKanban size="18" class="nav-btn-icon" />
|
|
|
|
|
|
<span class="hide-text">文件</span>
|
|
|
|
|
|
</button>
|
2026-05-29 22:19:58 +08:00
|
|
|
|
<button
|
2026-05-12 15:26:48 +08:00
|
|
|
|
v-if="userStore.isAdmin && selectedAgentId"
|
2026-01-15 06:01:34 +08:00
|
|
|
|
ref="moreButtonRef"
|
|
|
|
|
|
type="button"
|
|
|
|
|
|
class="agent-nav-btn"
|
2026-05-29 22:19:58 +08:00
|
|
|
|
@click.stop="toggleMoreMenu"
|
2026-01-15 06:01:34 +08:00
|
|
|
|
>
|
|
|
|
|
|
<Ellipsis size="18" class="nav-btn-icon" />
|
2026-05-29 22:19:58 +08:00
|
|
|
|
</button>
|
2025-10-13 11:12:25 +08:00
|
|
|
|
</template>
|
2025-05-15 22:34:32 +08:00
|
|
|
|
</AgentChatComponent>
|
|
|
|
|
|
</div>
|
2025-08-22 23:17:48 +08:00
|
|
|
|
|
2025-10-08 22:36:35 +08:00
|
|
|
|
<!-- 反馈模态框 -->
|
2026-03-17 19:46:09 +08:00
|
|
|
|
<FeedbackModalComponent
|
|
|
|
|
|
v-if="userStore.isAdmin"
|
|
|
|
|
|
ref="feedbackModal"
|
|
|
|
|
|
:agent-id="selectedAgentId"
|
|
|
|
|
|
/>
|
2025-10-13 11:12:25 +08:00
|
|
|
|
|
|
|
|
|
|
<!-- 自定义更多菜单 -->
|
|
|
|
|
|
<Teleport to="body">
|
|
|
|
|
|
<Transition name="menu-fade">
|
|
|
|
|
|
<div
|
2026-03-17 00:58:56 +08:00
|
|
|
|
v-if="userStore.isAdmin && chatUIStore.moreMenuOpen"
|
2025-10-13 11:12:25 +08:00
|
|
|
|
ref="moreMenuRef"
|
|
|
|
|
|
class="more-popup-menu"
|
|
|
|
|
|
:style="{
|
2025-11-08 13:59:56 +08:00
|
|
|
|
left: chatUIStore.moreMenuPosition.x + 'px',
|
|
|
|
|
|
top: chatUIStore.moreMenuPosition.y + 'px'
|
2025-10-13 11:12:25 +08:00
|
|
|
|
}"
|
|
|
|
|
|
>
|
|
|
|
|
|
<div class="menu-item" @click="handleShareChat">
|
|
|
|
|
|
<ShareAltOutlined class="menu-icon" />
|
|
|
|
|
|
<span class="menu-text">分享对话</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="menu-item" @click="handleFeedback">
|
|
|
|
|
|
<MessageOutlined class="menu-icon" />
|
|
|
|
|
|
<span class="menu-text">查看反馈</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</Transition>
|
|
|
|
|
|
</Teleport>
|
2025-05-15 22:34:32 +08:00
|
|
|
|
</div>
|
2025-03-25 05:40:07 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
2025-03-31 23:02:05 +08:00
|
|
|
|
<script setup>
|
2026-04-18 16:22:59 +08:00
|
|
|
|
import { computed, ref, watch } from 'vue'
|
2026-03-17 00:58:56 +08:00
|
|
|
|
import { MessageOutlined, ShareAltOutlined } from '@ant-design/icons-vue'
|
2026-01-15 06:01:34 +08:00
|
|
|
|
import { message } from 'ant-design-vue'
|
2026-05-24 00:47:08 +08:00
|
|
|
|
import { Settings2, Ellipsis, ChevronDown, Check, FolderKanban } from 'lucide-vue-next'
|
2026-03-17 00:58:56 +08:00
|
|
|
|
import { useRoute, useRouter } from 'vue-router'
|
2026-01-15 06:01:34 +08:00
|
|
|
|
import AgentChatComponent from '@/components/AgentChatComponent.vue'
|
|
|
|
|
|
import FeedbackModalComponent from '@/components/dashboard/FeedbackModalComponent.vue'
|
|
|
|
|
|
import { useUserStore } from '@/stores/user'
|
2026-05-24 00:47:08 +08:00
|
|
|
|
import { isBuiltinAgent, useAgentStore } from '@/stores/agent'
|
2026-01-15 06:01:34 +08:00
|
|
|
|
import { useChatUIStore } from '@/stores/chatUI'
|
|
|
|
|
|
import { ChatExporter } from '@/utils/chatExporter'
|
|
|
|
|
|
import { handleChatError } from '@/utils/errorHandler'
|
2026-06-01 22:29:18 +08:00
|
|
|
|
import { generatePixelAvatar } from '@/utils/pixelAvatar'
|
2026-01-15 06:01:34 +08:00
|
|
|
|
import { onClickOutside } from '@vueuse/core'
|
|
|
|
|
|
|
|
|
|
|
|
import { storeToRefs } from 'pinia'
|
2025-03-31 23:02:05 +08:00
|
|
|
|
|
2025-10-08 22:36:35 +08:00
|
|
|
|
// 组件引用
|
|
|
|
|
|
const feedbackModal = ref(null)
|
2025-10-13 11:12:25 +08:00
|
|
|
|
const chatComponentRef = ref(null)
|
2025-11-08 13:59:56 +08:00
|
|
|
|
|
|
|
|
|
|
// Stores
|
2026-01-15 06:01:34 +08:00
|
|
|
|
const userStore = useUserStore()
|
|
|
|
|
|
const agentStore = useAgentStore()
|
|
|
|
|
|
const chatUIStore = useChatUIStore()
|
2026-03-17 00:58:56 +08:00
|
|
|
|
const route = useRoute()
|
|
|
|
|
|
const router = useRouter()
|
2025-08-25 01:46:31 +08:00
|
|
|
|
|
2025-11-08 13:59:56 +08:00
|
|
|
|
// 从 agentStore 中获取响应式状态
|
2026-06-05 21:02:13 +08:00
|
|
|
|
const { agents, selectedAgentId, isLoadingConfig } = storeToRefs(agentStore)
|
2025-10-13 11:12:25 +08:00
|
|
|
|
|
2026-03-24 02:32:35 +08:00
|
|
|
|
const syncingRouteThread = ref(false)
|
2026-03-17 00:58:56 +08:00
|
|
|
|
|
2026-03-24 02:32:35 +08:00
|
|
|
|
const getRouteThreadId = () => {
|
|
|
|
|
|
const value = route.params.thread_id
|
2026-03-17 00:58:56 +08:00
|
|
|
|
return typeof value === 'string' ? value : ''
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-24 02:32:35 +08:00
|
|
|
|
const syncSelectedThreadFromRoute = async () => {
|
|
|
|
|
|
const chatComponent = chatComponentRef.value
|
|
|
|
|
|
if (!chatComponent?.selectThreadFromRoute) return
|
2026-03-17 00:58:56 +08:00
|
|
|
|
|
2026-03-24 02:32:35 +08:00
|
|
|
|
const threadId = getRouteThreadId()
|
|
|
|
|
|
syncingRouteThread.value = true
|
2026-03-17 00:58:56 +08:00
|
|
|
|
try {
|
2026-05-24 00:47:08 +08:00
|
|
|
|
if (!threadId && !agentStore.isInitialized) {
|
|
|
|
|
|
await agentStore.initialize()
|
2026-03-17 00:58:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-24 02:32:35 +08:00
|
|
|
|
const ok = await chatComponent.selectThreadFromRoute(threadId)
|
|
|
|
|
|
if (threadId && !ok) {
|
|
|
|
|
|
await router.replace({ name: 'AgentComp' })
|
2026-03-17 00:58:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
handleChatError(error, 'load')
|
|
|
|
|
|
} finally {
|
2026-03-24 02:32:35 +08:00
|
|
|
|
syncingRouteThread.value = false
|
2026-03-17 00:58:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
watch(
|
2026-03-24 02:32:35 +08:00
|
|
|
|
() => route.params.thread_id,
|
2026-03-17 00:58:56 +08:00
|
|
|
|
() => {
|
2026-03-24 02:32:35 +08:00
|
|
|
|
syncSelectedThreadFromRoute()
|
2026-03-17 00:58:56 +08:00
|
|
|
|
},
|
|
|
|
|
|
{ immediate: true }
|
|
|
|
|
|
)
|
|
|
|
|
|
|
2026-03-24 02:32:35 +08:00
|
|
|
|
watch(chatComponentRef, (instance) => {
|
|
|
|
|
|
if (!instance) return
|
|
|
|
|
|
syncSelectedThreadFromRoute()
|
2026-03-17 00:58:56 +08:00
|
|
|
|
})
|
|
|
|
|
|
|
2026-03-24 02:32:35 +08:00
|
|
|
|
const handleThreadChange = (threadId) => {
|
|
|
|
|
|
if (syncingRouteThread.value) return
|
|
|
|
|
|
const currentRouteThreadId = getRouteThreadId()
|
|
|
|
|
|
const nextThreadId = threadId || ''
|
|
|
|
|
|
if (currentRouteThreadId === nextThreadId) return
|
|
|
|
|
|
|
|
|
|
|
|
if (nextThreadId) {
|
|
|
|
|
|
router.replace({ name: 'AgentCompWithThreadId', params: { thread_id: nextThreadId } })
|
|
|
|
|
|
} else {
|
|
|
|
|
|
router.replace({ name: 'AgentComp' })
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-24 00:47:08 +08:00
|
|
|
|
const agentQuickSwitchOptions = computed(() =>
|
2026-06-01 22:29:18 +08:00
|
|
|
|
(agents.value || [])
|
|
|
|
|
|
.filter((agent) => !agent.is_subagent)
|
|
|
|
|
|
.map((agent) => ({
|
|
|
|
|
|
label: agent.name || agent.id,
|
|
|
|
|
|
value: agent.id,
|
2026-06-02 18:47:28 +08:00
|
|
|
|
icon: agent.icon || (agent.id ? generatePixelAvatar(agent.id) : ''),
|
2026-06-01 22:29:18 +08:00
|
|
|
|
isBuiltin: isBuiltinAgent(agent)
|
|
|
|
|
|
}))
|
2026-05-24 00:47:08 +08:00
|
|
|
|
)
|
2026-04-18 16:22:59 +08:00
|
|
|
|
|
2026-05-24 00:47:08 +08:00
|
|
|
|
const currentAgentOption = computed(() =>
|
|
|
|
|
|
agentQuickSwitchOptions.value.find((agent) => agent.value === selectedAgentId.value)
|
|
|
|
|
|
)
|
2026-04-18 16:22:59 +08:00
|
|
|
|
|
2026-05-24 00:47:08 +08:00
|
|
|
|
const currentAgentLabel = computed(() => {
|
|
|
|
|
|
if (isLoadingConfig.value) return '加载中...'
|
|
|
|
|
|
return currentAgentOption.value?.label || '智能体'
|
2026-04-18 16:22:59 +08:00
|
|
|
|
})
|
|
|
|
|
|
|
2026-05-25 21:02:23 +08:00
|
|
|
|
|
2026-05-24 00:47:08 +08:00
|
|
|
|
const agentDropdownOpen = ref(false)
|
2026-04-18 16:22:59 +08:00
|
|
|
|
|
2026-05-24 00:47:08 +08:00
|
|
|
|
const handleAgentSwitch = async (agentId, hasActiveThread) => {
|
|
|
|
|
|
if (!agentId || agentId === selectedAgentId.value) return
|
|
|
|
|
|
if (hasActiveThread) {
|
|
|
|
|
|
message.info('当前对话已绑定智能体,请新建对话后切换')
|
2026-04-18 16:22:59 +08:00
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
try {
|
2026-05-24 00:47:08 +08:00
|
|
|
|
await agentStore.selectAgent(agentId)
|
|
|
|
|
|
agentDropdownOpen.value = false
|
2026-04-18 16:22:59 +08:00
|
|
|
|
} catch (error) {
|
2026-05-24 00:47:08 +08:00
|
|
|
|
console.error('切换智能体出错:', error)
|
|
|
|
|
|
message.error('切换智能体失败')
|
2026-04-18 16:22:59 +08:00
|
|
|
|
}
|
2026-01-22 05:57:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-24 00:47:08 +08:00
|
|
|
|
const openAgentManagement = () => {
|
|
|
|
|
|
agentDropdownOpen.value = false
|
|
|
|
|
|
router.push({ name: 'ModelManageComp', query: { tab: 'agents' } })
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-10-13 11:12:25 +08:00
|
|
|
|
// 更多菜单相关
|
2026-01-15 06:01:34 +08:00
|
|
|
|
const moreMenuRef = ref(null)
|
|
|
|
|
|
const moreButtonRef = ref(null)
|
2025-10-13 11:12:25 +08:00
|
|
|
|
|
|
|
|
|
|
const toggleMoreMenu = (event) => {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
event.stopPropagation()
|
2025-10-13 11:12:25 +08:00
|
|
|
|
// 切换状态,而不是只打开
|
2026-01-15 06:01:34 +08:00
|
|
|
|
chatUIStore.moreMenuOpen = !chatUIStore.moreMenuOpen
|
2025-10-13 11:12:25 +08:00
|
|
|
|
|
2025-11-08 13:59:56 +08:00
|
|
|
|
if (chatUIStore.moreMenuOpen) {
|
2025-10-13 11:12:25 +08:00
|
|
|
|
// 只在打开时计算位置
|
2026-01-15 06:01:34 +08:00
|
|
|
|
const rect = event.currentTarget.getBoundingClientRect()
|
2026-03-24 02:32:35 +08:00
|
|
|
|
chatUIStore.openMoreMenu(rect.right - 110, rect.bottom + 8)
|
2025-10-13 11:12:25 +08:00
|
|
|
|
}
|
2026-01-15 06:01:34 +08:00
|
|
|
|
}
|
2025-10-13 11:12:25 +08:00
|
|
|
|
|
|
|
|
|
|
const closeMoreMenu = () => {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
chatUIStore.closeMoreMenu()
|
|
|
|
|
|
}
|
2025-10-13 11:12:25 +08:00
|
|
|
|
|
|
|
|
|
|
// 使用 VueUse 的 onClickOutside
|
2026-01-15 06:01:34 +08:00
|
|
|
|
onClickOutside(
|
|
|
|
|
|
moreMenuRef,
|
|
|
|
|
|
() => {
|
|
|
|
|
|
if (chatUIStore.moreMenuOpen) {
|
|
|
|
|
|
closeMoreMenu()
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
{ ignore: [moreButtonRef] }
|
|
|
|
|
|
)
|
2025-10-13 11:12:25 +08:00
|
|
|
|
|
|
|
|
|
|
const handleShareChat = async () => {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
closeMoreMenu()
|
2025-10-13 11:12:25 +08:00
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
// 从聊天组件获取导出数据
|
2026-01-15 06:01:34 +08:00
|
|
|
|
const exportData = chatComponentRef.value?.getExportPayload?.()
|
2025-10-13 11:12:25 +08:00
|
|
|
|
|
2026-01-15 06:01:34 +08:00
|
|
|
|
console.log('[AgentView] Export data:', exportData)
|
2025-07-26 03:36:54 +08:00
|
|
|
|
|
2025-10-13 11:12:25 +08:00
|
|
|
|
if (!exportData) {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
message.warning('当前没有可导出的对话内容')
|
|
|
|
|
|
return
|
2025-10-13 11:12:25 +08:00
|
|
|
|
}
|
2025-08-31 12:22:49 +08:00
|
|
|
|
|
2025-10-13 11:12:25 +08:00
|
|
|
|
// 检查是否有实际的消息内容
|
2026-01-15 06:01:34 +08:00
|
|
|
|
const hasMessages = exportData.messages && exportData.messages.length > 0
|
|
|
|
|
|
const hasOngoingMessages = exportData.onGoingMessages && exportData.onGoingMessages.length > 0
|
2025-10-13 11:12:25 +08:00
|
|
|
|
|
|
|
|
|
|
if (!hasMessages && !hasOngoingMessages) {
|
|
|
|
|
|
console.warn('[AgentView] Export data has no messages:', {
|
|
|
|
|
|
messages: exportData.messages,
|
|
|
|
|
|
onGoingMessages: exportData.onGoingMessages
|
2026-01-15 06:01:34 +08:00
|
|
|
|
})
|
|
|
|
|
|
message.warning('当前对话暂无内容可导出,请先进行对话')
|
|
|
|
|
|
return
|
2025-10-13 11:12:25 +08:00
|
|
|
|
}
|
2025-04-02 13:00:25 +08:00
|
|
|
|
|
2026-01-15 06:01:34 +08:00
|
|
|
|
const result = await ChatExporter.exportToHTML(exportData)
|
|
|
|
|
|
message.success(`对话已导出为HTML文件: ${result.filename}`)
|
2025-10-13 11:12:25 +08:00
|
|
|
|
} catch (error) {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
console.error('[AgentView] Export error:', error)
|
2025-10-13 11:12:25 +08:00
|
|
|
|
if (error?.message?.includes('没有可导出的对话内容')) {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
message.warning('当前对话暂无内容可导出,请先进行对话')
|
|
|
|
|
|
return
|
2025-10-13 11:12:25 +08:00
|
|
|
|
}
|
2026-01-15 06:01:34 +08:00
|
|
|
|
handleChatError(error, 'export')
|
2025-04-02 13:00:25 +08:00
|
|
|
|
}
|
2026-01-15 06:01:34 +08:00
|
|
|
|
}
|
2025-04-02 13:00:25 +08:00
|
|
|
|
|
2025-10-13 11:12:25 +08:00
|
|
|
|
const handleFeedback = () => {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
closeMoreMenu()
|
|
|
|
|
|
feedbackModal.value?.show()
|
|
|
|
|
|
}
|
2025-03-31 23:02:05 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
|
|
|
.agent-view {
|
|
|
|
|
|
display: flex;
|
2025-05-15 22:34:32 +08:00
|
|
|
|
flex-direction: column;
|
2025-03-31 23:02:05 +08:00
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 100vh;
|
|
|
|
|
|
overflow: hidden;
|
2025-05-15 22:34:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.agent-view-body {
|
|
|
|
|
|
--gap-radius: 6px;
|
|
|
|
|
|
display: flex;
|
2025-08-22 23:17:48 +08:00
|
|
|
|
flex-direction: row;
|
2025-05-15 22:34:32 +08:00
|
|
|
|
width: 100%;
|
|
|
|
|
|
flex: 1;
|
2025-10-13 11:12:25 +08:00
|
|
|
|
height: 100%;
|
2025-04-01 22:16:07 +08:00
|
|
|
|
overflow: hidden;
|
2025-08-22 23:17:48 +08:00
|
|
|
|
position: relative;
|
2025-04-01 22:16:07 +08:00
|
|
|
|
|
2025-08-25 01:46:31 +08:00
|
|
|
|
.content {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
}
|
2025-03-31 23:02:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-06-29 15:43:40 +08:00
|
|
|
|
.content {
|
|
|
|
|
|
flex: 1;
|
2025-03-31 23:02:05 +08:00
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-04-18 16:22:59 +08:00
|
|
|
|
.config-dropdown-trigger {
|
|
|
|
|
|
display: inline-flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
min-width: 0;
|
|
|
|
|
|
max-width: min(240px, calc(100vw - 160px));
|
|
|
|
|
|
gap: 4px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.config-dropdown-trigger :deep(svg) {
|
|
|
|
|
|
color: currentColor;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.config-dropdown-text {
|
|
|
|
|
|
min-width: 0;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
|
color: currentColor;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.config-dropdown-chevron {
|
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
|
color: currentColor;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-10-13 11:12:25 +08:00
|
|
|
|
// 自定义更多菜单样式
|
|
|
|
|
|
.more-popup-menu {
|
|
|
|
|
|
position: fixed;
|
2026-01-22 12:15:46 +08:00
|
|
|
|
min-width: 100px;
|
2025-11-23 01:39:44 +08:00
|
|
|
|
background: var(--gray-0);
|
2025-10-13 11:12:25 +08:00
|
|
|
|
border-radius: 10px;
|
2026-01-15 06:01:34 +08:00
|
|
|
|
box-shadow:
|
|
|
|
|
|
0 8px 24px rgba(0, 0, 0, 0.08),
|
|
|
|
|
|
0 2px 8px rgba(0, 0, 0, 0.04);
|
2025-10-13 11:12:25 +08:00
|
|
|
|
border: 1px solid var(--gray-100);
|
2026-01-22 12:15:46 +08:00
|
|
|
|
padding: 4px;
|
2025-10-13 11:12:25 +08:00
|
|
|
|
z-index: 9999;
|
|
|
|
|
|
|
|
|
|
|
|
.menu-item {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
gap: 10px;
|
2026-01-22 12:15:46 +08:00
|
|
|
|
padding: 6px 8px;
|
2025-10-13 11:12:25 +08:00
|
|
|
|
border-radius: 6px;
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
|
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
color: var(--gray-900);
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
user-select: none;
|
|
|
|
|
|
|
|
|
|
|
|
.menu-icon {
|
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
|
color: var(--gray-600);
|
|
|
|
|
|
transition: color 0.15s ease;
|
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.menu-text {
|
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
|
letter-spacing: 0.01em;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
|
|
background: var(--gray-50);
|
|
|
|
|
|
// color: var(--main-700);
|
|
|
|
|
|
|
|
|
|
|
|
// .menu-icon {
|
|
|
|
|
|
// color: var(--main-600);
|
|
|
|
|
|
// }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
&:active {
|
|
|
|
|
|
background: var(--gray-100);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.menu-divider {
|
|
|
|
|
|
height: 1px;
|
|
|
|
|
|
background: var(--gray-100);
|
|
|
|
|
|
margin: 4px 8px;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 菜单淡入淡出动画
|
|
|
|
|
|
.menu-fade-enter-active {
|
|
|
|
|
|
animation: menuSlideIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.menu-fade-leave-active {
|
|
|
|
|
|
animation: menuSlideOut 0.15s cubic-bezier(0.4, 0, 1, 1);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@keyframes menuSlideIn {
|
|
|
|
|
|
from {
|
|
|
|
|
|
opacity: 0;
|
|
|
|
|
|
transform: translateY(-8px);
|
|
|
|
|
|
}
|
|
|
|
|
|
to {
|
|
|
|
|
|
opacity: 1;
|
|
|
|
|
|
transform: translateY(0);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@keyframes menuSlideOut {
|
|
|
|
|
|
from {
|
|
|
|
|
|
opacity: 1;
|
|
|
|
|
|
transform: translateY(0);
|
|
|
|
|
|
}
|
|
|
|
|
|
to {
|
|
|
|
|
|
opacity: 0;
|
|
|
|
|
|
transform: translateY(-4px);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 响应式优化
|
|
|
|
|
|
@media (max-width: 520px) {
|
2026-04-18 16:22:59 +08:00
|
|
|
|
.config-dropdown-trigger {
|
|
|
|
|
|
max-width: calc(100vw - 112px);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-10-13 11:12:25 +08:00
|
|
|
|
.more-popup-menu {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
box-shadow:
|
|
|
|
|
|
0 12px 32px rgba(0, 0, 0, 0.12),
|
|
|
|
|
|
0 4px 12px rgba(0, 0, 0, 0.06);
|
2025-10-13 11:12:25 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-03-31 23:02:05 +08:00
|
|
|
|
</style>
|
2026-04-18 16:22:59 +08:00
|
|
|
|
|
|
|
|
|
|
<style lang="less">
|
|
|
|
|
|
.config-dropdown-overlay .config-dropdown-panel {
|
|
|
|
|
|
min-width: 188px;
|
|
|
|
|
|
max-width: min(260px, calc(100vw - 24px));
|
|
|
|
|
|
padding: 4px;
|
|
|
|
|
|
background: var(--gray-0);
|
|
|
|
|
|
border: 1px solid var(--gray-100);
|
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
|
box-shadow:
|
|
|
|
|
|
0 8px 24px rgba(0, 0, 0, 0.08),
|
|
|
|
|
|
0 2px 8px rgba(0, 0, 0, 0.04);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.config-dropdown-overlay .config-dropdown-item {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
gap: 6px;
|
|
|
|
|
|
min-width: 0;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
padding: 6px 8px;
|
|
|
|
|
|
border: none;
|
|
|
|
|
|
border-radius: 6px;
|
|
|
|
|
|
background: transparent;
|
|
|
|
|
|
text-align: left;
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
transition: background-color 0.15s ease;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.config-dropdown-overlay .config-dropdown-item:hover {
|
|
|
|
|
|
background: var(--gray-50);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-24 00:47:08 +08:00
|
|
|
|
.config-dropdown-overlay .config-dropdown-item.disabled {
|
|
|
|
|
|
cursor: not-allowed;
|
|
|
|
|
|
opacity: 0.55;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-04-18 16:22:59 +08:00
|
|
|
|
.config-dropdown-overlay .config-dropdown-item.selected {
|
|
|
|
|
|
background: var(--gray-50);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.config-dropdown-overlay .config-dropdown-item.action-item {
|
|
|
|
|
|
color: var(--gray-800);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.config-dropdown-overlay .config-dropdown-item-label {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
min-width: 0;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
|
font-size: 13px;
|
|
|
|
|
|
line-height: 1.35;
|
|
|
|
|
|
color: var(--gray-800);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-24 00:47:08 +08:00
|
|
|
|
.config-dropdown-overlay .config-dropdown-item-icon,
|
2026-06-02 18:47:28 +08:00
|
|
|
|
.config-dropdown-overlay .config-dropdown-item-icon-image,
|
|
|
|
|
|
.config-dropdown-overlay .config-dropdown-item-icon-empty {
|
2026-04-18 16:22:59 +08:00
|
|
|
|
flex-shrink: 0;
|
2026-05-24 00:47:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.config-dropdown-overlay .config-dropdown-item-icon {
|
2026-04-18 16:22:59 +08:00
|
|
|
|
color: var(--gray-500);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-02 18:47:28 +08:00
|
|
|
|
.config-dropdown-overlay .config-dropdown-item-icon-image,
|
|
|
|
|
|
.config-dropdown-overlay .config-dropdown-item-icon-empty {
|
2026-05-24 00:47:08 +08:00
|
|
|
|
width: 24px;
|
|
|
|
|
|
height: 24px;
|
2026-05-25 21:02:23 +08:00
|
|
|
|
border-radius: 4px;
|
2026-05-24 00:47:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-02 18:47:28 +08:00
|
|
|
|
.config-dropdown-overlay .config-dropdown-item-icon-image {
|
|
|
|
|
|
object-fit: cover;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-04-18 16:22:59 +08:00
|
|
|
|
.config-dropdown-overlay .config-dropdown-item-badge {
|
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
|
padding: 1px 6px;
|
|
|
|
|
|
border-radius: 999px;
|
|
|
|
|
|
background: var(--gray-100);
|
|
|
|
|
|
color: var(--gray-600);
|
|
|
|
|
|
font-size: 11px;
|
|
|
|
|
|
line-height: 1.4;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.config-dropdown-overlay .config-dropdown-item-check {
|
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
|
color: var(--main-600);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-24 00:47:08 +08:00
|
|
|
|
.config-dropdown-overlay .config-dropdown-hint {
|
|
|
|
|
|
padding: 6px 8px;
|
|
|
|
|
|
color: var(--gray-500);
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
line-height: 1.4;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-04-18 16:22:59 +08:00
|
|
|
|
.config-dropdown-overlay .config-dropdown-divider {
|
|
|
|
|
|
height: 1px;
|
|
|
|
|
|
margin: 4px 4px;
|
|
|
|
|
|
background: var(--gray-100);
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|