refactor: 统一页面样式
This commit is contained in:
1 parent
42908b42f1
commit
0c6f1c0ffc
25 files changed
+3509
-2044
No files matched your search
+200
-198
@@ -1,4 +1,4 @@
|
||||
|
||||
|
||||
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
@@ -27,6 +27,7 @@ import { getAuthHeaders, getStoredAuthUser, logoutAuth } from '../utils/auth';
|
||||
import { copyTextToClipboard } from '../utils/clipboard';
|
||||
import { setLastChatAgentId } from '../utils/lastChatAgent';
|
||||
import { openAgentChatTab, registerOpenAgentId } from '../utils/agentTabs';
|
||||
import ChatShell from '../layouts/ChatShell.vue';
|
||||
|
||||
const { t, locale } = useI18n();
|
||||
const { appliedTheme, toggleLightDark } = useTheme();
|
||||
@@ -2079,16 +2080,19 @@ const showChatRating = ref(false);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="relative flex h-screen overflow-hidden bg-slate-50 text-slate-800 dark:bg-slate-950 dark:text-slate-100">
|
||||
<div
|
||||
v-if="isSidebarOpen && !isMobile"
|
||||
class="fixed inset-0 z-40 bg-slate-900/55 backdrop-blur-sm transition-opacity md:hidden"
|
||||
@click="isSidebarOpen = false"
|
||||
></div>
|
||||
<ChatShell>
|
||||
<template #overlay>
|
||||
<div
|
||||
v-if="isSidebarOpen && !isMobile"
|
||||
class="fixed inset-0 z-40 bg-overlay backdrop-blur-sm transition-opacity md:hidden"
|
||||
@click="isSidebarOpen = false"
|
||||
></div>
|
||||
</template>
|
||||
|
||||
<template #sidebar>
|
||||
<aside
|
||||
v-if="!isMobile"
|
||||
class="glass-panel fixed inset-y-0 left-0 z-50 flex h-full flex-col border-r bg-white transition-all duration-300 ease-in-out dark:bg-slate-950 md:relative md:translate-x-0"
|
||||
class="glass-panel fixed inset-y-0 left-0 z-50 flex h-full flex-col border-r border-default bg-surface transition-all duration-300 ease-in-out md:relative md:translate-x-0"
|
||||
:class="[
|
||||
isSidebarOpen ? 'translate-x-0 w-[86vw] max-w-[300px]' : '-translate-x-full w-[86vw] max-w-[300px]',
|
||||
isSidebarCollapsed ? 'md:w-[72px]' : 'md:w-80'
|
||||
@@ -2096,7 +2100,7 @@ const showChatRating = ref(false);
|
||||
>
|
||||
<template v-if="isSidebarCollapsed">
|
||||
<div class="flex h-full w-full flex-col items-center py-4">
|
||||
<button @click="isSidebarCollapsed = false" class="mb-6 text-slate-400 transition-colors hover:text-slate-600 dark:hover:text-slate-200">
|
||||
<button @click="isSidebarCollapsed = false" class="mb-6 text-muted transition-colors hover:text-secondary">
|
||||
<PanelLeftOpen class="h-5 w-5" />
|
||||
</button>
|
||||
|
||||
@@ -2104,17 +2108,17 @@ const showChatRating = ref(false);
|
||||
<Sparkles class="h-5 w-5" />
|
||||
</div>
|
||||
|
||||
<button @click="startNewChat(); isSidebarOpen = false;" class="flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-slate-50 text-slate-700 shadow-sm transition-colors hover:bg-slate-100 dark:bg-slate-800 dark:text-slate-200 dark:hover:bg-slate-700" :title="$t('chat.createNewChat')">
|
||||
<button @click="startNewChat(); isSidebarOpen = false;" class="chat-sidebar-btn-icon" :title="$t('chat.createNewChat')">
|
||||
<Plus class="h-5 w-5" />
|
||||
</button>
|
||||
|
||||
<div class="mt-auto flex flex-col items-center gap-6 pb-2 text-slate-400">
|
||||
<button class="transition-colors hover:text-slate-600 dark:hover:text-slate-200"><Sparkles class="h-5 w-5" /></button>
|
||||
<div class="mt-auto flex flex-col items-center gap-6 pb-2 text-muted">
|
||||
<button class="transition-colors hover:text-secondary"><Sparkles class="h-5 w-5" /></button>
|
||||
<div class="flex h-8 w-8 items-center justify-center rounded-full bg-brand-600 text-sm font-bold text-white shadow-sm shadow-brand-500/20">
|
||||
{{ (currentUser?.username || 'I').charAt(0).toUpperCase() }}
|
||||
</div>
|
||||
<button @click="showGeneralFeedbackDialog = true" class="transition-colors hover:text-slate-600 dark:hover:text-slate-200" :title="$t('chat.generalFeedback')"><MessageSquareText class="h-5 w-5" /></button>
|
||||
<button @click="goToWorkspace()" class="transition-colors hover:text-slate-600 dark:hover:text-slate-200" :title="$t('workspace.title')"><Briefcase class="h-5 w-5" /></button>
|
||||
<button @click="showGeneralFeedbackDialog = true" class="transition-colors hover:text-secondary" :title="$t('chat.generalFeedback')"><MessageSquareText class="h-5 w-5" /></button>
|
||||
<button @click="goToWorkspace()" class="transition-colors hover:text-secondary" :title="$t('workspace.title')"><Briefcase class="h-5 w-5" /></button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -2123,47 +2127,45 @@ const showChatRating = ref(false);
|
||||
<div class="flex items-center justify-between p-4">
|
||||
<div class="flex items-center gap-2">
|
||||
<div class="flex h-8 w-8 items-center justify-center rounded-xl bg-gradient-to-br from-brand-500 via-brand-600 to-sky-600 text-sm font-bold text-white shadow-sm shadow-brand-500/25">AI</div>
|
||||
<span class="font-bold text-slate-800 dark:text-slate-100">{{ currentAgent?.name || 'AI' }}</span>
|
||||
<span class="font-bold text-primary">{{ currentAgent?.name || 'AI' }}</span>
|
||||
</div>
|
||||
<button @click="isSidebarCollapsed = true" class="text-slate-400 transition-colors hover:text-slate-600 dark:hover:text-slate-200">
|
||||
<button @click="isSidebarCollapsed = true" class="text-muted transition-colors hover:text-secondary">
|
||||
<PanelLeftClose class="h-5 w-5" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="px-4 pb-4">
|
||||
<button @click="startNewChat(); isSidebarOpen = false;" class="flex w-full items-center justify-center gap-2 rounded-xl border border-slate-200 bg-slate-50 py-3 text-sm font-medium text-slate-700 shadow-sm transition-colors hover:bg-slate-100 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-200 dark:hover:bg-slate-700">
|
||||
<button @click="startNewChat(); isSidebarOpen = false;" class="chat-sidebar-btn">
|
||||
<Plus class="h-4 w-4" /> {{ $t('chat.createNewChat') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-between px-4 py-2">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.history') }}</span>
|
||||
<button v-if="history.length > 0" @click="clearAllHistory" class="text-xs text-slate-400 transition-colors hover:text-slate-600 dark:hover:text-slate-200">
|
||||
<span class="text-xs font-semibold text-muted">{{ $t('chat.history') }}</span>
|
||||
<button v-if="history.length > 0" @click="clearAllHistory" class="text-xs text-muted transition-colors hover:text-secondary">
|
||||
{{ $t('chat.clearAll') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="flex-1 overflow-y-auto px-2 scrollbar-thin">
|
||||
<div v-if="history.length === 0" class="py-8 text-center text-sm italic text-slate-400">{{ $t('chat.noHistory') }}</div>
|
||||
<div v-if="history.length === 0" class="py-8 text-center text-sm italic text-muted">{{ $t('chat.noHistory') }}</div>
|
||||
<div v-else class="space-y-0.5">
|
||||
<div
|
||||
v-for="item in history"
|
||||
:key="item.conversation_id"
|
||||
class="group relative flex w-full items-center justify-between rounded-lg transition-colors"
|
||||
:class="conversationId === item.conversation_id ? 'bg-brand-50 dark:bg-brand-900/20' : 'hover:bg-slate-50 dark:hover:bg-slate-800/50'"
|
||||
class="chat-history-item"
|
||||
:class="{ 'chat-history-item--active': conversationId === item.conversation_id }"
|
||||
>
|
||||
<button
|
||||
class="flex-1 truncate px-3 py-2.5 text-left text-sm pr-8"
|
||||
:class="conversationId === item.conversation_id
|
||||
? 'font-medium text-brand-700 dark:text-brand-300'
|
||||
: 'text-slate-600 dark:text-slate-300'"
|
||||
class="chat-history-link"
|
||||
:class="{ 'chat-history-link--active': conversationId === item.conversation_id }"
|
||||
@click="loadConversation(item.conversation_id); isSidebarOpen = false;"
|
||||
>
|
||||
{{ item.title || $t('chat.newChat') }}
|
||||
</button>
|
||||
<button
|
||||
@click="deleteHistoryItem(item.conversation_id, $event)"
|
||||
class="absolute right-2 p-1.5 text-slate-400 opacity-0 transition-opacity hover:text-red-500 group-hover:opacity-100 dark:hover:text-red-400"
|
||||
class="absolute right-2 p-1.5 text-muted opacity-0 transition-opacity hover:text-red-500 group-hover:opacity-100"
|
||||
:title="$t('chat.clearOneRecord')"
|
||||
>
|
||||
<X class="h-4 w-4" />
|
||||
@@ -2173,8 +2175,8 @@ const showChatRating = ref(false);
|
||||
</div>
|
||||
|
||||
<div class="mt-auto flex flex-col p-4">
|
||||
<div v-if="userAgents.length > 0 && showAgentPanel" class="mb-4 rounded-2xl border border-slate-200 bg-slate-50/70 p-3 dark:border-slate-700 dark:bg-slate-800/60">
|
||||
<div class="mb-2 flex items-center gap-1.5 text-xs font-semibold text-slate-500 dark:text-slate-400">
|
||||
<div v-if="userAgents.length > 0 && showAgentPanel" class="chat-agent-panel">
|
||||
<div class="mb-2 flex items-center gap-1.5 text-xs font-semibold text-muted">
|
||||
<LayoutGrid class="h-3.5 w-3.5" /> {{ $t('chat.agents') }}
|
||||
</div>
|
||||
<div class="grid grid-cols-2 gap-x-2 gap-y-1.5">
|
||||
@@ -2182,37 +2184,37 @@ const showChatRating = ref(false);
|
||||
v-for="agent in userAgents"
|
||||
:key="agent.id"
|
||||
@click="switchToAgent(agent)"
|
||||
class="grid w-full min-w-0 grid-cols-[1rem_1fr] items-center gap-1.5 rounded-xl px-2 py-2 text-left text-xs font-medium text-slate-600 transition-colors hover:bg-white hover:shadow-sm dark:text-slate-200 dark:hover:bg-slate-700/50"
|
||||
class="grid w-full min-w-0 grid-cols-[1rem_1fr] items-center gap-1.5 rounded-xl px-2 py-2 text-left text-xs font-medium text-secondary transition-colors hover-surface-soft hover:shadow-sm"
|
||||
>
|
||||
<div v-if="agent.icon_url" class="h-4 w-4 shrink-0 rounded bg-contain bg-center bg-no-repeat" :style="{ backgroundImage: `url(${agent.icon_url})` }"></div>
|
||||
<div v-else class="flex h-4 w-4 shrink-0 items-center justify-center rounded bg-brand-100 text-[9px] font-bold text-brand-600 dark:bg-brand-900/30 dark:text-brand-400">{{ agent.name.charAt(0) }}</div>
|
||||
<div v-else class="flex h-4 w-4 shrink-0 items-center justify-center rounded bg-brand-100 text-[9px] font-bold text-brand-600">{{ agent.name.charAt(0) }}</div>
|
||||
<span class="min-w-0 truncate">{{ agent.name }}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Bottom Icons -->
|
||||
<div class="flex items-center justify-between text-slate-400 relative" ref="userMenuRef">
|
||||
<div class="flex items-center justify-between text-muted relative" ref="userMenuRef">
|
||||
<button @click="showUserDropdown = !showUserDropdown" class="flex h-8 w-8 items-center justify-center rounded-full bg-brand-600 text-sm font-bold text-white shadow-sm shadow-brand-500/20 hover:bg-brand-700 transition-colors">
|
||||
{{ (currentUser?.username || 'I').charAt(0).toUpperCase() }}
|
||||
</button>
|
||||
|
||||
<!-- User Dropdown Menu -->
|
||||
<div v-if="showUserDropdown" class="absolute bottom-full left-0 mb-2 w-56 bg-white dark:bg-slate-900 rounded-xl shadow-xl border border-slate-100 dark:border-slate-700 py-1 z-50 animate-fade-in">
|
||||
<div class="px-4 py-3 border-b border-slate-50 dark:border-slate-700 flex items-center gap-3">
|
||||
<div v-if="showUserDropdown" class="absolute bottom-full left-0 mb-2 w-56 bg-surface rounded-xl shadow-xl border border-subtle py-1 z-50 animate-fade-in">
|
||||
<div class="px-4 py-3 border-b border-subtle flex items-center gap-3">
|
||||
<div class="w-10 h-10 bg-brand-600 rounded-full flex items-center justify-center text-white font-bold text-lg shrink-0 shadow-sm shadow-brand-500/20">
|
||||
{{ (currentUser?.username || 'U').charAt(0).toUpperCase() }}
|
||||
</div>
|
||||
<div class="overflow-hidden">
|
||||
<div class="text-sm font-bold text-slate-900 dark:text-slate-100 truncate">{{ currentUser?.username || 'User' }}</div>
|
||||
<div v-if="(currentUser as any)?.employee_id" class="text-xs text-slate-500 dark:text-slate-400 truncate">{{ $t('chat.employeeId') }}: {{ (currentUser as any).employee_id }}</div>
|
||||
<div v-else class="text-xs text-slate-500 dark:text-slate-400 truncate">{{ currentUser?.role }}</div>
|
||||
<div class="text-sm font-bold text-primary truncate">{{ currentUser?.username || 'User' }}</div>
|
||||
<div v-if="(currentUser as any)?.employee_id" class="text-xs text-muted truncate">{{ $t('chat.employeeId') }}: {{ (currentUser as any).employee_id }}</div>
|
||||
<div v-else class="text-xs text-muted truncate">{{ currentUser?.role }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-2 px-4 py-2">
|
||||
<span class="shrink-0 text-xs font-medium text-slate-500 dark:text-slate-400">{{ $t('chat.language') }}</span>
|
||||
<select v-model="locale" class="min-w-0 flex-1 rounded-lg border border-slate-200 bg-slate-50 px-2 py-1 text-xs text-slate-700 outline-none transition focus:border-brand-400 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-200">
|
||||
<span class="shrink-0 text-xs font-medium text-muted">{{ $t('chat.language') }}</span>
|
||||
<select v-model="locale" class="min-w-0 flex-1 rounded-lg border border-default bg-surface-soft px-2 py-1 text-xs text-secondary outline-none transition focus:border-brand-400">
|
||||
<option value="zh-CN">简体中文</option>
|
||||
<option value="en">English</option>
|
||||
<option value="zh-TW">繁體中文</option>
|
||||
@@ -2220,71 +2222,70 @@ const showChatRating = ref(false);
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<button @click="handleLogout" class="flex w-full items-center gap-2 border-t border-slate-50 px-4 py-2 text-left text-sm text-red-600 transition-colors hover:bg-red-50 dark:border-slate-700/50 dark:hover:bg-red-950/30">
|
||||
<button @click="handleLogout" class="flex w-full items-center gap-2 border-t border-slate-50 px-4 py-2 text-left text-sm text-red-600 transition-colors hover:bg-red-50">
|
||||
<LogOut class="w-4 h-4" />
|
||||
{{ $t('chat.logout') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="flex gap-3">
|
||||
<button @click="userAgents.length === 0 ? undefined : (showAgentPanel = !showAgentPanel)" :class="showAgentPanel && userAgents.length > 0 ? 'text-brand-600 dark:text-brand-400' : ''" class="transition-colors hover:text-slate-600 dark:hover:text-slate-200" :title="userAgents.length === 0 ? $t('chat.noAvailableAgents') : (showAgentPanel ? $t('chat.collapseAgents') : $t('chat.expandAgents'))"><LayoutGrid class="h-4 w-4" /></button>
|
||||
<!-- <button class="transition-colors hover:text-slate-600 dark:hover:text-slate-200"><Heart class="h-4 w-4" /></button> -->
|
||||
<!-- <button class="transition-colors hover:text-slate-600 dark:hover:text-slate-200"><Bell class="h-4 w-4" /></button> -->
|
||||
<button @click="toggleLightDark" class="transition-colors hover:text-slate-600 dark:hover:text-slate-200" :title="appliedTheme === 'dark' ? ($t('theme.switchToLight') || 'Switch to light mode') : ($t('theme.switchToDark') || 'Switch to dark mode')">
|
||||
<button @click="userAgents.length === 0 ? undefined : (showAgentPanel = !showAgentPanel)" :class="showAgentPanel && userAgents.length > 0 ? 'text-brand-600' : ''" class="transition-colors hover:text-secondary" :title="userAgents.length === 0 ? $t('chat.noAvailableAgents') : (showAgentPanel ? $t('chat.collapseAgents') : $t('chat.expandAgents'))"><LayoutGrid class="h-4 w-4" /></button>
|
||||
<!-- <button class="transition-colors hover:text-secondary"><Heart class="h-4 w-4" /></button> -->
|
||||
<!-- <button class="transition-colors hover:text-secondary"><Bell class="h-4 w-4" /></button> -->
|
||||
<button @click="toggleLightDark" class="transition-colors hover:text-secondary" :title="appliedTheme === 'dark' ? ($t('theme.switchToLight') || 'Switch to light mode') : ($t('theme.switchToDark') || 'Switch to dark mode')">
|
||||
<Sun v-if="appliedTheme === 'dark'" class="h-4 w-4" />
|
||||
<Moon v-else class="h-4 w-4" />
|
||||
</button>
|
||||
<button @click="showGeneralFeedbackDialog = true" class="transition-colors hover:text-slate-600 dark:hover:text-slate-200" :title="$t('chat.generalFeedback')"><MessageSquareText class="h-4 w-4" /></button>
|
||||
<button @click="goToWorkspace()" class="transition-colors hover:text-slate-600 dark:hover:text-slate-200" :title="$t('workspace.title')"><Briefcase class="h-4 w-4" /></button>
|
||||
<button @click="showGeneralFeedbackDialog = true" class="transition-colors hover:text-secondary" :title="$t('chat.generalFeedback')"><MessageSquareText class="h-4 w-4" /></button>
|
||||
<button @click="goToWorkspace()" class="transition-colors hover:text-secondary" :title="$t('workspace.title')"><Briefcase class="h-4 w-4" /></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</aside>
|
||||
</template>
|
||||
|
||||
<div class="relative z-10 flex h-full w-full flex-1 flex-col overflow-hidden bg-white dark:bg-slate-950">
|
||||
|
||||
<header v-if="isMobile && currentAgent" class="flex items-center justify-between border-b border-slate-200 px-4 py-2.5 dark:border-slate-800">
|
||||
<header v-if="isMobile && currentAgent" class="flex items-center justify-between border-b border-default bg-surface px-4 py-2.5">
|
||||
<div class="flex items-center gap-2">
|
||||
<div class="flex h-7 w-7 items-center justify-center rounded-lg bg-gradient-to-br from-brand-500 via-brand-600 to-sky-600 text-xs font-bold text-white shadow-sm shadow-brand-500/20">AI</div>
|
||||
<span class="text-sm font-semibold text-slate-800 dark:text-slate-100">{{ currentAgent?.name || 'AI' }}</span>
|
||||
<span class="text-sm font-semibold text-primary">{{ currentAgent?.name || 'AI' }}</span>
|
||||
</div>
|
||||
<div class="flex items-center gap-1">
|
||||
<button @click="toggleMobileAgentPopover" class="flex h-9 w-9 items-center justify-center rounded-full text-slate-500 transition-colors hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-800" :title="$t('chat.agents')">
|
||||
<button @click="toggleMobileAgentPopover" class="flex h-9 w-9 items-center justify-center rounded-full text-muted transition-colors hover-surface-soft" :title="$t('chat.agents')">
|
||||
<LayoutGrid class="h-5 w-5" />
|
||||
</button>
|
||||
<button @click="goToWorkspace('history')" class="flex h-9 w-9 items-center justify-center rounded-full text-slate-500 transition-colors hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-800" :title="$t('chat.history')">
|
||||
<button @click="goToWorkspace('history')" class="flex h-9 w-9 items-center justify-center rounded-full text-muted transition-colors hover-surface-soft" :title="$t('chat.history')">
|
||||
<History class="h-5 w-5" />
|
||||
</button>
|
||||
</div>
|
||||
<div v-if="showMobileAgentPopover" ref="mobileAgentPopoverRef" class="absolute right-4 top-12 z-50 w-72 rounded-2xl border border-slate-200 bg-white p-3 shadow-xl dark:border-slate-700 dark:bg-slate-800">
|
||||
<div class="mb-2 text-xs font-medium text-slate-400">{{ $t('chat.agents') }}</div>
|
||||
<div v-if="showMobileAgentPopover" ref="mobileAgentPopoverRef" class="absolute right-4 top-12 z-50 w-72 rounded-2xl border border-default bg-surface p-3 shadow-xl">
|
||||
<div class="mb-2 text-xs font-medium text-muted">{{ $t('chat.agents') }}</div>
|
||||
<div class="grid grid-cols-2 gap-2">
|
||||
<button
|
||||
v-for="agent in userAgents"
|
||||
:key="agent.id"
|
||||
@click="switchToAgent(agent); showMobileAgentPopover = false"
|
||||
class="flex flex-col items-center gap-1.5 rounded-xl px-2 py-3 text-center transition-colors hover:bg-slate-100 dark:hover:bg-slate-700"
|
||||
class="flex flex-col items-center gap-1.5 rounded-xl px-2 py-3 text-center transition-colors hover-surface-soft"
|
||||
>
|
||||
<div class="flex h-9 w-9 items-center justify-center rounded-lg bg-brand-50 text-sm font-bold text-brand-600 dark:bg-brand-900/30">
|
||||
<div class="flex h-9 w-9 items-center justify-center rounded-lg bg-brand-50 text-sm font-bold text-brand-600">
|
||||
{{ agent.name.charAt(0) }}
|
||||
</div>
|
||||
<span class="w-full truncate text-xs font-medium text-slate-700 dark:text-slate-200">{{ agent.name }}</span>
|
||||
<span class="w-full truncate text-xs font-medium text-secondary">{{ agent.name }}</span>
|
||||
</button>
|
||||
</div>
|
||||
<div v-if="userAgents.length === 0" class="py-3 text-center text-xs text-slate-400">{{ $t('chat.noOtherAgents') }}</div>
|
||||
<div v-if="userAgents.length === 0" class="py-3 text-center text-xs text-muted">{{ $t('chat.noOtherAgents') }}</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div v-if="!currentAgent" class="flex flex-1 flex-col items-center justify-center space-y-4">
|
||||
<Loader2 class="h-10 w-10 animate-spin text-brand-500" />
|
||||
<p class="text-sm animate-pulse text-slate-500 dark:text-slate-300">{{ $t('chat.loadingAgent') }}</p>
|
||||
<p class="text-sm animate-pulse text-muted">{{ $t('chat.loadingAgent') }}</p>
|
||||
</div>
|
||||
|
||||
<div v-else-if="currentAgent.type === 'iframe'" class="relative h-full w-full flex-1">
|
||||
<iframe
|
||||
:src="currentAgent.extra_config?.iframe_url"
|
||||
class="h-full w-full border-0 bg-white dark:bg-slate-950"
|
||||
class="h-full w-full border-0 bg-surface"
|
||||
allow="microphone; camera; clipboard-read; clipboard-write"
|
||||
></iframe>
|
||||
</div>
|
||||
@@ -2304,7 +2305,7 @@ const showChatRating = ref(false);
|
||||
<div class="mb-6 flex h-16 w-16 items-center justify-center rounded-2xl bg-gradient-to-br from-brand-500 via-brand-600 to-sky-600 text-2xl font-bold text-white shadow-lg shadow-brand-500/20">
|
||||
AI
|
||||
</div>
|
||||
<h2 class="text-center text-xl font-medium text-slate-800 dark:text-slate-100 md:text-2xl">{{ $t('chat.welcomeTitle') }}</h2>
|
||||
<h2 class="text-center text-xl font-medium text-primary md:text-2xl">{{ $t('chat.welcomeTitle') }}</h2>
|
||||
</div>
|
||||
|
||||
<template v-for="(msg, index) in messages" :key="index">
|
||||
@@ -2322,7 +2323,7 @@ const showChatRating = ref(false);
|
||||
class="text-[15px] leading-relaxed"
|
||||
:class="msg.role === 'user'
|
||||
? 'rounded-2xl rounded-tr-sm bg-brand-600 px-5 py-2.5 text-white shadow-sm shadow-brand-500/15'
|
||||
: 'w-full rounded-2xl border border-slate-200 bg-white px-6 py-4 shadow-sm dark:border-slate-800 dark:bg-slate-900 dark:text-slate-100'"
|
||||
: 'chat-msg-assistant'"
|
||||
>
|
||||
<div
|
||||
v-if="msg.role === 'user'"
|
||||
@@ -2330,42 +2331,42 @@ const showChatRating = ref(false);
|
||||
>{{ msg.content }}</div>
|
||||
<div v-else>
|
||||
<div v-if="msg.type === 'leave-form'" class="space-y-4">
|
||||
<div class="text-sm font-medium text-slate-700 dark:text-slate-200">
|
||||
<div class="text-sm font-medium text-secondary">
|
||||
{{ $t('chat.leaveFormIntro') }} <a href="#" @click.prevent="openOALeaveRequestDirectly" class="text-brand-600 font-bold hover:underline">{{ $t('chat.oaLeaveDirectLink') }}</a>
|
||||
</div>
|
||||
<div v-if="getLeaveFormPayload(msg)" class="grid gap-4 md:grid-cols-2">
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.leaveFiller') }}</span>
|
||||
<span class="text-xs font-semibold text-muted">{{ $t('chat.leaveFiller') }}</span>
|
||||
<input
|
||||
v-model="getLeaveFormPayload(msg)!.form.fillerName"
|
||||
type="text"
|
||||
class="w-full rounded-xl border border-slate-200 bg-slate-50 px-3 py-2 text-sm text-slate-500 outline-none dark:border-slate-700 dark:bg-slate-950/60 dark:text-slate-400"
|
||||
class="w-full rounded-xl border border-default bg-surface-soft px-3 py-2 text-sm text-muted outline-none"
|
||||
disabled
|
||||
/>
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.employeeId') }}</span>
|
||||
<span class="text-xs font-semibold text-muted">{{ $t('chat.employeeId') }}</span>
|
||||
<input
|
||||
v-model="getLeaveFormPayload(msg)!.form.employeeId"
|
||||
type="text"
|
||||
class="w-full rounded-xl border border-slate-200 bg-slate-50 px-3 py-2 text-sm text-slate-500 outline-none dark:border-slate-700 dark:bg-slate-950/60 dark:text-slate-400"
|
||||
class="w-full rounded-xl border border-default bg-surface-soft px-3 py-2 text-sm text-muted outline-none"
|
||||
disabled
|
||||
/>
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.createdAt') }}</span>
|
||||
<span class="text-xs font-semibold text-muted">{{ $t('chat.createdAt') }}</span>
|
||||
<input
|
||||
:value="getLeaveFormPayload(msg)!.form.applyTime.replace('T', ' ')"
|
||||
type="text"
|
||||
class="w-full rounded-xl border border-slate-200 bg-slate-50 px-3 py-2 text-sm text-slate-500 outline-none dark:border-slate-700 dark:bg-slate-950/60 dark:text-slate-400"
|
||||
class="w-full rounded-xl border border-default bg-surface-soft px-3 py-2 text-sm text-muted outline-none"
|
||||
disabled
|
||||
/>
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.leaveType') }}</span>
|
||||
<span class="text-xs font-semibold text-muted">{{ $t('chat.leaveType') }}</span>
|
||||
<select
|
||||
v-model="getLeaveFormPayload(msg)!.form.leaveType"
|
||||
class="w-full rounded-xl border border-slate-200 px-3 py-2 text-sm text-slate-700 outline-none transition focus:border-blue-400 dark:border-slate-700 dark:bg-slate-950 dark:text-slate-100"
|
||||
class="w-full rounded-xl border border-default px-3 py-2 text-sm text-secondary outline-none transition focus:border-blue-400"
|
||||
:disabled="getLeaveFormPayload(msg)!.submitting || getLeaveFormPayload(msg)!.confirmationGenerated"
|
||||
@change="syncLeaveDuration(getLeaveFormPayload(msg)!.form)"
|
||||
>
|
||||
@@ -2374,20 +2375,20 @@ const showChatRating = ref(false);
|
||||
</select>
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.leaveApplicant') }}</span>
|
||||
<span class="text-xs font-semibold text-muted">{{ $t('chat.leaveApplicant') }}</span>
|
||||
<div class="relative">
|
||||
<input
|
||||
:value="getLeaveFormPayload(msg)!.form.applicantName ? `${getLeaveFormPayload(msg)!.form.applicantName} / ${getLeaveFormPayload(msg)!.form.employeeId}` : ''"
|
||||
type="text"
|
||||
:placeholder="$t('chat.selectLeaveApplicant')"
|
||||
readonly
|
||||
class="w-full rounded-xl border border-slate-200 bg-white px-3 py-2 pr-11 text-sm text-slate-700 outline-none transition focus:border-blue-400 dark:border-slate-700 dark:bg-slate-950 dark:text-slate-100"
|
||||
class="w-full rounded-xl border border-default bg-surface px-3 py-2 pr-11 text-sm text-secondary outline-none transition focus:border-blue-400"
|
||||
:disabled="getLeaveFormPayload(msg)!.submitting || getLeaveFormPayload(msg)!.confirmationGenerated"
|
||||
@click="openLeaveAgentDialog(msg, 'applicant')"
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
class="absolute inset-y-0 right-0 flex w-11 items-center justify-center text-slate-400 transition hover:text-brand-600 disabled:cursor-not-allowed disabled:opacity-50"
|
||||
class="absolute inset-y-0 right-0 flex w-11 items-center justify-center text-muted transition hover:text-brand-600 disabled:cursor-not-allowed disabled:opacity-50"
|
||||
:disabled="getLeaveFormPayload(msg)!.submitting || getLeaveFormPayload(msg)!.confirmationGenerated"
|
||||
@click="openLeaveAgentDialog(msg, 'applicant')"
|
||||
:title="$t('chat.pickLeaveApplicant')"
|
||||
@@ -2397,20 +2398,20 @@ const showChatRating = ref(false);
|
||||
</div>
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.leaveAgent') }}</span>
|
||||
<span class="text-xs font-semibold text-muted">{{ $t('chat.leaveAgent') }}</span>
|
||||
<div class="relative">
|
||||
<input
|
||||
:value="getLeaveAgentDisplayValue(getLeaveFormPayload(msg)!.form)"
|
||||
type="text"
|
||||
:placeholder="$t('chat.selectLeaveAgent')"
|
||||
readonly
|
||||
class="w-full rounded-xl border border-slate-200 bg-white px-3 py-2 pr-11 text-sm text-slate-700 outline-none transition focus:border-blue-400 dark:border-slate-700 dark:bg-slate-950 dark:text-slate-100"
|
||||
class="w-full rounded-xl border border-default bg-surface px-3 py-2 pr-11 text-sm text-secondary outline-none transition focus:border-blue-400"
|
||||
:disabled="getLeaveFormPayload(msg)!.submitting || getLeaveFormPayload(msg)!.confirmationGenerated"
|
||||
@click="openLeaveAgentDialog(msg)"
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
class="absolute inset-y-0 right-0 flex w-11 items-center justify-center text-slate-400 transition hover:text-brand-600 disabled:cursor-not-allowed disabled:opacity-50"
|
||||
class="absolute inset-y-0 right-0 flex w-11 items-center justify-center text-muted transition hover:text-brand-600 disabled:cursor-not-allowed disabled:opacity-50"
|
||||
:disabled="getLeaveFormPayload(msg)!.submitting || getLeaveFormPayload(msg)!.confirmationGenerated"
|
||||
@click="openLeaveAgentDialog(msg)"
|
||||
:title="$t('chat.pickLeaveAgent')"
|
||||
@@ -2420,39 +2421,39 @@ const showChatRating = ref(false);
|
||||
</div>
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.startTime') }}</span>
|
||||
<span class="text-xs font-semibold text-muted">{{ $t('chat.startTime') }}</span>
|
||||
<input
|
||||
v-model="getLeaveFormPayload(msg)!.form.startTime"
|
||||
type="datetime-local"
|
||||
class="w-full rounded-xl border border-slate-200 px-3 py-2 text-sm text-slate-700 outline-none transition focus:border-blue-400 dark:border-slate-700 dark:bg-slate-950 dark:text-slate-100"
|
||||
class="w-full rounded-xl border border-default px-3 py-2 text-sm text-secondary outline-none transition focus:border-blue-400"
|
||||
:disabled="getLeaveFormPayload(msg)!.submitting || getLeaveFormPayload(msg)!.confirmationGenerated"
|
||||
@input="syncLeaveDuration(getLeaveFormPayload(msg)!.form)"
|
||||
/>
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.endTime') }}</span>
|
||||
<span class="text-xs font-semibold text-muted">{{ $t('chat.endTime') }}</span>
|
||||
<input
|
||||
v-model="getLeaveFormPayload(msg)!.form.endTime"
|
||||
type="datetime-local"
|
||||
class="w-full rounded-xl border border-slate-200 px-3 py-2 text-sm text-slate-700 outline-none transition focus:border-blue-400 dark:border-slate-700 dark:bg-slate-950 dark:text-slate-100"
|
||||
class="w-full rounded-xl border border-default px-3 py-2 text-sm text-secondary outline-none transition focus:border-blue-400"
|
||||
:disabled="getLeaveFormPayload(msg)!.submitting || getLeaveFormPayload(msg)!.confirmationGenerated"
|
||||
@input="syncLeaveDuration(getLeaveFormPayload(msg)!.form)"
|
||||
/>
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.duration') }}</span>
|
||||
<span class="text-xs font-semibold text-muted">{{ $t('chat.duration') }}</span>
|
||||
<input
|
||||
:value="formatDurationLabel(getLeaveFormPayload(msg)!.form.durationHours, getLeaveFormPayload(msg)!.form.leaveType)"
|
||||
type="text"
|
||||
class="w-full rounded-xl border border-slate-200 bg-slate-50 px-3 py-2 text-sm text-slate-500 outline-none dark:border-slate-700 dark:bg-slate-950/60 dark:text-slate-400"
|
||||
class="w-full rounded-xl border border-default bg-surface-soft px-3 py-2 text-sm text-muted outline-none"
|
||||
disabled
|
||||
/>
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.isOutOfOffice') }}</span>
|
||||
<span class="text-xs font-semibold text-muted">{{ $t('chat.isOutOfOffice') }}</span>
|
||||
<select
|
||||
v-model="getLeaveFormPayload(msg)!.form.isOutOfOffice"
|
||||
class="w-full rounded-xl border border-slate-200 px-3 py-2 text-sm text-slate-700 outline-none transition focus:border-blue-400 dark:border-slate-700 dark:bg-slate-950 dark:text-slate-100"
|
||||
class="w-full rounded-xl border border-default px-3 py-2 text-sm text-secondary outline-none transition focus:border-blue-400"
|
||||
:disabled="getLeaveFormPayload(msg)!.submitting || getLeaveFormPayload(msg)!.confirmationGenerated"
|
||||
>
|
||||
<option :value="1">{{ $t('chat.no') }}</option>
|
||||
@@ -2460,10 +2461,10 @@ const showChatRating = ref(false);
|
||||
</select>
|
||||
</label>
|
||||
<label class="space-y-1.5 md:col-span-2">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.isWorkInjury') }}</span>
|
||||
<span class="text-xs font-semibold text-muted">{{ $t('chat.isWorkInjury') }}</span>
|
||||
<select
|
||||
v-model="getLeaveFormPayload(msg)!.form.isWorkInjury"
|
||||
class="w-full rounded-xl border border-slate-200 px-3 py-2 text-sm text-slate-700 outline-none transition focus:border-blue-400 dark:border-slate-700 dark:bg-slate-950 dark:text-slate-100"
|
||||
class="w-full rounded-xl border border-default px-3 py-2 text-sm text-secondary outline-none transition focus:border-blue-400"
|
||||
:disabled="getLeaveFormPayload(msg)!.submitting || getLeaveFormPayload(msg)!.confirmationGenerated"
|
||||
>
|
||||
<option :value="1">{{ $t('chat.no') }}</option>
|
||||
@@ -2471,58 +2472,58 @@ const showChatRating = ref(false);
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
<div v-if="getLeaveFormPayload(msg)?.confirmationGenerated" class="rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-xs text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-200">
|
||||
<div v-if="getLeaveFormPayload(msg)?.confirmationGenerated" class="rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-xs text-amber-700">
|
||||
{{ $t('chat.leaveConfirmGenerated') }}
|
||||
</div>
|
||||
<div class="flex justify-end">
|
||||
<button
|
||||
@click="submitLeaveForm(msg)"
|
||||
:disabled="getLeaveFormPayload(msg)?.submitting || getLeaveFormPayload(msg)?.confirmationGenerated"
|
||||
class="rounded-xl bg-brand-600 px-4 py-2 text-sm font-medium text-white transition hover:bg-brand-700 disabled:cursor-not-allowed disabled:opacity-60"
|
||||
class="btn-primary btn-sm disabled:cursor-not-allowed disabled:opacity-60"
|
||||
>
|
||||
{{ getLeaveFormPayload(msg)?.submitting ? $t('chat.submitting') : $t('chat.submit') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="msg.type === 'leave-confirmation' && getLeaveConfirmationPayload(msg)" class="space-y-4">
|
||||
<div class="text-sm font-medium text-slate-700 dark:text-slate-200">{{ msg.content }}</div>
|
||||
<div class="rounded-2xl border border-slate-200 bg-slate-50/90 p-4 dark:border-slate-700 dark:bg-slate-800/60">
|
||||
<div class="mb-3 text-xs font-bold uppercase tracking-wider text-slate-400 dark:text-slate-500">{{ $t('chat.leaveFillerInfo') }}</div>
|
||||
<div class="text-sm font-medium text-secondary">{{ msg.content }}</div>
|
||||
<div class="rounded-2xl border border-default bg-surface-soft/90 p-4">
|
||||
<div class="mb-3 text-xs font-bold uppercase tracking-wider text-muted">{{ $t('chat.leaveFillerInfo') }}</div>
|
||||
<div class="grid gap-3 text-sm md:grid-cols-2">
|
||||
<div><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveFiller') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.fillerName || $t('chat.noData') }}</div>
|
||||
<div><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.createdAt') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.applyTime.replace('T', ' ') }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.fillerJobTitleName || getLeaveConfirmationPayload(msg)!.form.fillerJobTitle"><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveFillerTitle') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.fillerJobTitleName || getLeaveConfirmationPayload(msg)!.form.fillerJobTitle }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.fillerDepartmentName || getLeaveConfirmationPayload(msg)!.form.fillerDepartmentId"><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveFillerDept') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.fillerDepartmentName || getLeaveConfirmationPayload(msg)!.form.fillerDepartmentId }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.fillerSubCompanyName || getLeaveConfirmationPayload(msg)!.form.fillerSubCompanyId1"><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveFillerCompany') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.fillerSubCompanyName || getLeaveConfirmationPayload(msg)!.form.fillerSubCompanyId1 }}</div>
|
||||
<div><span class="text-muted">{{ $t('chat.leaveFiller') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.fillerName || $t('chat.noData') }}</div>
|
||||
<div><span class="text-muted">{{ $t('chat.createdAt') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.applyTime.replace('T', ' ') }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.fillerJobTitleName || getLeaveConfirmationPayload(msg)!.form.fillerJobTitle"><span class="text-muted">{{ $t('chat.leaveFillerTitle') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.fillerJobTitleName || getLeaveConfirmationPayload(msg)!.form.fillerJobTitle }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.fillerDepartmentName || getLeaveConfirmationPayload(msg)!.form.fillerDepartmentId"><span class="text-muted">{{ $t('chat.leaveFillerDept') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.fillerDepartmentName || getLeaveConfirmationPayload(msg)!.form.fillerDepartmentId }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.fillerSubCompanyName || getLeaveConfirmationPayload(msg)!.form.fillerSubCompanyId1"><span class="text-muted">{{ $t('chat.leaveFillerCompany') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.fillerSubCompanyName || getLeaveConfirmationPayload(msg)!.form.fillerSubCompanyId1 }}</div>
|
||||
</div>
|
||||
<div class="my-3 border-t border-slate-200 dark:border-slate-700"></div>
|
||||
<div class="mb-3 text-xs font-bold uppercase tracking-wider text-slate-400 dark:text-slate-500">{{ $t('chat.leaveApplicantInfo') }}</div>
|
||||
<div class="my-3 border-t border-default"></div>
|
||||
<div class="mb-3 text-xs font-bold uppercase tracking-wider text-muted">{{ $t('chat.leaveApplicantInfo') }}</div>
|
||||
<div class="grid gap-3 text-sm md:grid-cols-2">
|
||||
<div><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveApplicant') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.applicantName }}({{ getLeaveConfirmationPayload(msg)!.form.employeeId }})</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.applicantJobTitleName || getLeaveConfirmationPayload(msg)!.form.applicantJobTitle"><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveApplicantTitle') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.applicantJobTitleName || getLeaveConfirmationPayload(msg)!.form.applicantJobTitle }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.applicantDepartmentName || getLeaveConfirmationPayload(msg)!.form.applicantDepartmentId"><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveApplicantDept') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.applicantDepartmentName || getLeaveConfirmationPayload(msg)!.form.applicantDepartmentId }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.applicantSubCompanyName || getLeaveConfirmationPayload(msg)!.form.applicantSubCompanyId1"><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveApplicantCompany') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.applicantSubCompanyName || getLeaveConfirmationPayload(msg)!.form.applicantSubCompanyId1 }}</div>
|
||||
<div><span class="text-muted">{{ $t('chat.leaveApplicant') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.applicantName }}({{ getLeaveConfirmationPayload(msg)!.form.employeeId }})</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.applicantJobTitleName || getLeaveConfirmationPayload(msg)!.form.applicantJobTitle"><span class="text-muted">{{ $t('chat.leaveApplicantTitle') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.applicantJobTitleName || getLeaveConfirmationPayload(msg)!.form.applicantJobTitle }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.applicantDepartmentName || getLeaveConfirmationPayload(msg)!.form.applicantDepartmentId"><span class="text-muted">{{ $t('chat.leaveApplicantDept') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.applicantDepartmentName || getLeaveConfirmationPayload(msg)!.form.applicantDepartmentId }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.applicantSubCompanyName || getLeaveConfirmationPayload(msg)!.form.applicantSubCompanyId1"><span class="text-muted">{{ $t('chat.leaveApplicantCompany') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.applicantSubCompanyName || getLeaveConfirmationPayload(msg)!.form.applicantSubCompanyId1 }}</div>
|
||||
</div>
|
||||
<div class="my-3 border-t border-slate-200 dark:border-slate-700"></div>
|
||||
<div class="mb-3 text-xs font-bold uppercase tracking-wider text-slate-400 dark:text-slate-500">{{ $t('chat.leaveInfo') }}</div>
|
||||
<div class="my-3 border-t border-default"></div>
|
||||
<div class="mb-3 text-xs font-bold uppercase tracking-wider text-muted">{{ $t('chat.leaveInfo') }}</div>
|
||||
<div class="grid gap-3 text-sm md:grid-cols-2">
|
||||
<div><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveAgent') }}:</span>{{ getLeaveAgentDisplayValue(getLeaveConfirmationPayload(msg)!.form) || $t('chat.notSelected') }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.agentJobTitleName || getLeaveConfirmationPayload(msg)!.form.agentJobTitle"><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveAgentTitle') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.agentJobTitleName || getLeaveConfirmationPayload(msg)!.form.agentJobTitle }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.agentDepartmentName || getLeaveConfirmationPayload(msg)!.form.agentDepartmentId"><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveAgentDept') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.agentDepartmentName || getLeaveConfirmationPayload(msg)!.form.agentDepartmentId }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.agentSubCompanyName || getLeaveConfirmationPayload(msg)!.form.agentSubCompanyId1"><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveAgentCompany') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.agentSubCompanyName || getLeaveConfirmationPayload(msg)!.form.agentSubCompanyId1 }}</div>
|
||||
<div><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveType') }}:</span>{{ getLeaveTypeLabel(getLeaveConfirmationPayload(msg)!.form.leaveType) }}</div>
|
||||
<div><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.duration') }}:</span>{{ formatDurationLabel(getLeaveConfirmationPayload(msg)!.form.durationHours, getLeaveConfirmationPayload(msg)!.form.leaveType) }}</div>
|
||||
<div><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.startTime') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.startTime.replace('T', ' ') }}</div>
|
||||
<div><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.endTime') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.endTime.replace('T', ' ') }}</div>
|
||||
<div><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.isOutOfOffice') }}:</span>{{ formatYesNoLabel(getLeaveConfirmationPayload(msg)!.form.isOutOfOffice) }}</div>
|
||||
<div><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.isWorkInjury') }}:</span>{{ formatYesNoLabel(getLeaveConfirmationPayload(msg)!.form.isWorkInjury) }}</div>
|
||||
<div><span class="text-muted">{{ $t('chat.leaveAgent') }}:</span>{{ getLeaveAgentDisplayValue(getLeaveConfirmationPayload(msg)!.form) || $t('chat.notSelected') }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.agentJobTitleName || getLeaveConfirmationPayload(msg)!.form.agentJobTitle"><span class="text-muted">{{ $t('chat.leaveAgentTitle') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.agentJobTitleName || getLeaveConfirmationPayload(msg)!.form.agentJobTitle }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.agentDepartmentName || getLeaveConfirmationPayload(msg)!.form.agentDepartmentId"><span class="text-muted">{{ $t('chat.leaveAgentDept') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.agentDepartmentName || getLeaveConfirmationPayload(msg)!.form.agentDepartmentId }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.agentSubCompanyName || getLeaveConfirmationPayload(msg)!.form.agentSubCompanyId1"><span class="text-muted">{{ $t('chat.leaveAgentCompany') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.agentSubCompanyName || getLeaveConfirmationPayload(msg)!.form.agentSubCompanyId1 }}</div>
|
||||
<div><span class="text-muted">{{ $t('chat.leaveType') }}:</span>{{ getLeaveTypeLabel(getLeaveConfirmationPayload(msg)!.form.leaveType) }}</div>
|
||||
<div><span class="text-muted">{{ $t('chat.duration') }}:</span>{{ formatDurationLabel(getLeaveConfirmationPayload(msg)!.form.durationHours, getLeaveConfirmationPayload(msg)!.form.leaveType) }}</div>
|
||||
<div><span class="text-muted">{{ $t('chat.startTime') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.startTime.replace('T', ' ') }}</div>
|
||||
<div><span class="text-muted">{{ $t('chat.endTime') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.endTime.replace('T', ' ') }}</div>
|
||||
<div><span class="text-muted">{{ $t('chat.isOutOfOffice') }}:</span>{{ formatYesNoLabel(getLeaveConfirmationPayload(msg)!.form.isOutOfOffice) }}</div>
|
||||
<div><span class="text-muted">{{ $t('chat.isWorkInjury') }}:</span>{{ formatYesNoLabel(getLeaveConfirmationPayload(msg)!.form.isWorkInjury) }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex justify-end gap-3">
|
||||
<button
|
||||
v-if="!getLeaveConfirmationPayload(msg)?.submitting && !getLeaveConfirmationPayload(msg)?.confirmed"
|
||||
@click="editLeaveConfirmation(msg, index)"
|
||||
class="rounded-xl border border-slate-200 px-4 py-2 text-sm font-medium text-slate-600 transition hover:bg-slate-50 disabled:cursor-not-allowed disabled:opacity-60 dark:border-slate-700 dark:text-slate-200 dark:hover:bg-slate-800"
|
||||
class="rounded-xl border border-default px-4 py-2 text-sm font-medium text-secondary transition hover:bg-surface-soft disabled:cursor-not-allowed disabled:opacity-60"
|
||||
>
|
||||
{{ $t('chat.backToEdit') }}
|
||||
</button>
|
||||
@@ -2539,8 +2540,8 @@ const showChatRating = ref(false);
|
||||
<div
|
||||
class="rounded-2xl border px-4 py-4"
|
||||
:class="getLeaveResultPayload(msg)!.success
|
||||
? 'border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-500/30 dark:bg-emerald-500/10 dark:text-emerald-100'
|
||||
: 'border-rose-200 bg-rose-50 text-rose-800 dark:border-rose-500/30 dark:bg-rose-500/10 dark:text-rose-100'"
|
||||
? 'border-emerald-200 bg-emerald-50 text-emerald-800'
|
||||
: 'border-rose-200 bg-rose-50 text-rose-800'"
|
||||
>
|
||||
<div class="text-sm font-semibold">{{ getLeaveResultPayload(msg)!.success ? $t('chat.oaSubmitResult') : $t('chat.oaSubmitFailed') }}</div>
|
||||
<div v-if="getLeaveResultPayload(msg)!.success" class="mt-2 whitespace-pre-wrap text-sm leading-7">
|
||||
@@ -2548,7 +2549,7 @@ const showChatRating = ref(false);
|
||||
<a
|
||||
href="#"
|
||||
@click.prevent="openOARequestDirectly(getLeaveResultPayload(msg)!.referenceNo)"
|
||||
class="ml-1 inline-flex items-center rounded-full border border-brand-200 bg-brand-50 px-3 py-0.5 font-bold text-brand-700 transition hover:bg-brand-100 hover:underline dark:border-brand-500/30 dark:bg-brand-500/10 dark:text-brand-200 dark:hover:bg-brand-500/20"
|
||||
class="ml-1 inline-flex items-center rounded-full border border-brand-200 bg-brand-50 px-3 py-0.5 font-bold text-brand-700 transition hover:bg-brand-100 hover:underline"
|
||||
>
|
||||
{{ $t('chat.leaveResultLinkText') }}
|
||||
</a>
|
||||
@@ -2560,7 +2561,7 @@ const showChatRating = ref(false);
|
||||
</div>
|
||||
<div
|
||||
v-else
|
||||
class="chat-markdown prose prose-sm max-w-none leading-7 text-slate-800 dark:text-slate-100 prose-a:text-blue-600 dark:prose-a:text-blue-400 prose-p:my-1 prose-li:my-0.5 prose-ol:my-2 prose-ul:my-2 prose-headings:my-2 prose-hr:my-3 prose-code:rounded prose-code:bg-slate-100 prose-code:px-1 prose-code:text-blue-700 dark:prose-code:bg-slate-800 dark:prose-code:text-blue-300 prose-pre:my-3 prose-pre:border prose-pre:border-slate-700 prose-pre:bg-slate-900 prose-pre:text-slate-100"
|
||||
class="chat-markdown prose prose-sm max-w-none leading-7 text-primary prose-a:text-blue-600 prose-p:my-1 prose-li:my-0.5 prose-ol:my-2 prose-ul:my-2 prose-headings:my-2 prose-hr:my-3 prose-code:rounded prose-code:bg-slate-100 prose-code:px-1 prose-code:text-blue-700 prose-pre:my-3 prose-pre:border prose-pre:border-slate-700 prose-pre:bg-slate-900 prose-pre:text-slate-100"
|
||||
@click="handleChatMarkdownClick"
|
||||
v-html="renderMarkdown(msg.content)"
|
||||
></div>
|
||||
@@ -2577,7 +2578,7 @@ const showChatRating = ref(false);
|
||||
v-for="(file, linkIndex) in getSourceLinks(getDisplayRetrieverResources(msg))"
|
||||
:key="`src-link-top-${linkIndex}-${file.url}`"
|
||||
@click="openPreview(file)"
|
||||
class="break-all rounded-lg border border-brand-200 bg-brand-50 px-2.5 py-1.5 text-xs text-brand-700 transition-colors hover:bg-brand-100 dark:border-brand-500/30 dark:bg-brand-500/10 dark:text-brand-200 dark:hover:bg-brand-500/20"
|
||||
class="break-all rounded-lg border border-brand-200 bg-brand-50 px-2.5 py-1.5 text-xs text-brand-700 transition-colors hover:bg-brand-100"
|
||||
>
|
||||
{{ file.name }}
|
||||
</button>
|
||||
@@ -2585,38 +2586,38 @@ const showChatRating = ref(false);
|
||||
|
||||
<details
|
||||
v-if="getDisplayRetrieverResources(msg).length > 0"
|
||||
class="rounded-xl border border-slate-200 bg-slate-50/90 px-4 py-3 dark:border-slate-700 dark:bg-slate-800/65"
|
||||
class="rounded-xl border border-default bg-surface-soft/90 px-4 py-3"
|
||||
:open="shouldExpandSourceDetails(msg)"
|
||||
>
|
||||
<summary class="cursor-pointer text-xs font-semibold uppercase tracking-wide text-slate-600 dark:text-slate-300">
|
||||
<summary class="cursor-pointer text-xs font-semibold uppercase tracking-wide text-secondary">
|
||||
{{ $t('chat.sourceDocs') }} ({{ getDisplayRetrieverResources(msg).length }})
|
||||
</summary>
|
||||
<div class="mt-3 space-y-2">
|
||||
<div
|
||||
v-for="(doc, docIndex) in getDisplayRetrieverResources(msg)"
|
||||
:key="`${doc.document_name || 'doc'}-${doc.segment_id || docIndex}`"
|
||||
class="rounded-lg border border-slate-200 bg-white p-3 dark:border-slate-700 dark:bg-slate-900"
|
||||
class="rounded-lg border border-default bg-surface p-3"
|
||||
>
|
||||
<div class="break-all text-sm font-semibold text-slate-800 dark:text-slate-100">{{ getSourceTitle(doc) }}</div>
|
||||
<div v-if="getSourceMeta(doc)" class="mt-1 text-xs text-slate-500 dark:text-slate-400">{{ getSourceMeta(doc) }}</div>
|
||||
<div v-if="getSourceBrief(doc)" class="mt-2 whitespace-pre-wrap break-all text-xs text-slate-600 dark:text-slate-300">{{ getSourceBrief(doc) }}</div>
|
||||
<div class="break-all text-sm font-semibold text-primary">{{ getSourceTitle(doc) }}</div>
|
||||
<div v-if="getSourceMeta(doc)" class="mt-1 text-xs text-muted">{{ getSourceMeta(doc) }}</div>
|
||||
<div v-if="getSourceBrief(doc)" class="mt-2 whitespace-pre-wrap break-all text-xs text-secondary">{{ getSourceBrief(doc) }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
<details
|
||||
v-if="msg.attribution_parts && msg.attribution_parts.length > 0"
|
||||
class="rounded-xl border border-slate-200 bg-slate-50/90 px-4 py-3 dark:border-slate-700 dark:bg-slate-800/65"
|
||||
class="rounded-xl border border-default bg-surface-soft/90 px-4 py-3"
|
||||
open
|
||||
>
|
||||
<summary class="cursor-pointer text-xs font-semibold uppercase tracking-wide text-slate-600 dark:text-slate-300">
|
||||
<summary class="cursor-pointer text-xs font-semibold uppercase tracking-wide text-secondary">
|
||||
{{ $t('chat.attributionParts') }}
|
||||
</summary>
|
||||
<ul class="mt-3 space-y-2">
|
||||
<li
|
||||
v-for="(part, partIndex) in msg.attribution_parts"
|
||||
:key="`attr-${partIndex}`"
|
||||
class="rounded-lg border border-slate-200 bg-white p-3 text-xs text-slate-700 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-300"
|
||||
class="rounded-lg border border-default bg-surface p-3 text-xs text-secondary"
|
||||
>
|
||||
{{ part }}
|
||||
</li>
|
||||
@@ -2627,12 +2628,12 @@ const showChatRating = ref(false);
|
||||
<div
|
||||
v-if="msg.type !== 'leave-form'"
|
||||
class="mt-1 flex items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100"
|
||||
:class="msg.role === 'user' ? 'justify-end text-slate-500' : 'justify-start text-slate-500'"
|
||||
:class="msg.role === 'user' ? 'justify-end text-muted' : 'justify-start text-muted'"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
@click.stop="copyToClipboard(msg, index)"
|
||||
class="rounded-md p-1.5 text-xs transition-colors hover:bg-slate-100 dark:hover:bg-slate-800"
|
||||
class="rounded-md p-1.5 text-xs transition-colors hover-surface-soft"
|
||||
:title="$t('chat.actions.copy')"
|
||||
>
|
||||
<Check v-if="copiedIndex === index" class="h-3.5 w-3.5 text-emerald-500" />
|
||||
@@ -2643,7 +2644,7 @@ const showChatRating = ref(false);
|
||||
<button
|
||||
type="button"
|
||||
@click.stop="input = msg.content"
|
||||
class="rounded-md p-1.5 text-xs transition-colors hover:bg-slate-100 dark:hover:bg-slate-800"
|
||||
class="rounded-md p-1.5 text-xs transition-colors hover-surface-soft"
|
||||
:title="$t('chat.actions.edit')"
|
||||
>
|
||||
<Edit2 class="h-3.5 w-3.5" />
|
||||
@@ -2651,7 +2652,7 @@ const showChatRating = ref(false);
|
||||
<button
|
||||
type="button"
|
||||
@click.stop="handleSend(msg.content)"
|
||||
class="rounded-md p-1.5 text-xs transition-colors hover:bg-slate-100 dark:hover:bg-slate-800"
|
||||
class="rounded-md p-1.5 text-xs transition-colors hover-surface-soft"
|
||||
:title="$t('chat.actions.resend')"
|
||||
>
|
||||
<RotateCw class="h-3.5 w-3.5" />
|
||||
@@ -2662,7 +2663,7 @@ const showChatRating = ref(false);
|
||||
<button
|
||||
v-if="index === messages.length - 1 && !isThinking"
|
||||
@click="regenerate"
|
||||
class="rounded-md p-1.5 text-xs transition-colors hover:bg-slate-100 dark:hover:bg-slate-800"
|
||||
class="rounded-md p-1.5 text-xs transition-colors hover-surface-soft"
|
||||
:title="$t('chat.actions.regenerate')"
|
||||
>
|
||||
<RotateCw class="h-3.5 w-3.5" />
|
||||
@@ -2670,7 +2671,7 @@ const showChatRating = ref(false);
|
||||
<button
|
||||
v-if="showChatRating && !isThinking && !(msg as any).rated"
|
||||
@click="handleOpenFeedback(index)"
|
||||
class="rounded-md p-1.5 text-xs transition-colors hover:bg-slate-100 dark:hover:bg-slate-800"
|
||||
class="rounded-md p-1.5 text-xs transition-colors hover-surface-soft"
|
||||
:title="$t('chat.rate')"
|
||||
>
|
||||
<MessageSquareText class="h-3.5 w-3.5" />
|
||||
@@ -2683,13 +2684,13 @@ const showChatRating = ref(false);
|
||||
</template>
|
||||
|
||||
<div v-if="shouldShowThinkingBubble" class="mx-auto flex w-full max-w-4xl justify-start">
|
||||
<div class="flex items-center gap-3 rounded-2xl rounded-tl-md border border-slate-200 bg-white/95 px-5 py-3 shadow-md dark:border-slate-700 dark:bg-slate-900/85">
|
||||
<div class="flex items-center gap-3 rounded-2xl rounded-tl-md border border-default bg-surface/95 px-5 py-3 shadow-md">
|
||||
<div class="flex gap-1">
|
||||
<span class="h-2 w-2 animate-bounce rounded-full bg-brand-400"></span>
|
||||
<span class="h-2 w-2 animate-bounce rounded-full bg-brand-400 delay-75"></span>
|
||||
<span class="h-2 w-2 animate-bounce rounded-full bg-brand-400 delay-150"></span>
|
||||
</div>
|
||||
<span class="text-sm font-medium text-slate-500 dark:text-slate-300">{{ $t('chat.thinking') }}</span>
|
||||
<span class="text-sm font-medium text-muted">{{ $t('chat.thinking') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="messages.length > 0" class="h-2 md:h-3"></div>
|
||||
@@ -2698,13 +2699,13 @@ const showChatRating = ref(false);
|
||||
|
||||
<footer class="safe-bottom sticky bottom-0 z-20 bg-transparent p-3 md:p-6">
|
||||
<div class="relative mx-auto max-w-4xl">
|
||||
<div class="flex flex-col rounded-2xl bg-white p-2 shadow-[0_0_15px_rgba(0,0,0,0.05)] transition-all dark:bg-slate-900">
|
||||
<div class="flex flex-col rounded-2xl bg-surface p-2 shadow-[0_0_15px_rgba(0,0,0,0.05)] transition-all">
|
||||
<textarea
|
||||
v-model="input"
|
||||
@keydown.enter.prevent="handleSend"
|
||||
rows="1"
|
||||
:placeholder="$t('chat.askAnything')"
|
||||
class="w-full resize-none border-none bg-transparent px-3 py-2 text-[15px] leading-relaxed text-slate-800 placeholder-slate-400 focus:outline-none focus:ring-0 focus:border-transparent dark:text-slate-100"
|
||||
class="w-full resize-none border-none bg-transparent px-3 py-2 text-[15px] leading-relaxed text-primary placeholder-slate-400 focus:outline-none focus:ring-0 focus:border-transparent"
|
||||
style="min-height: 44px; max-height: 220px;"
|
||||
:disabled="isThinking"
|
||||
spellcheck="false"
|
||||
@@ -2718,28 +2719,28 @@ const showChatRating = ref(false);
|
||||
@click="handleVoiceFeatureClick"
|
||||
type="button"
|
||||
:title="$t('chat.voiceFeature')"
|
||||
class="text-slate-400 transition-colors hover:text-brand-600 dark:hover:text-brand-300"
|
||||
class="text-muted transition-colors hover:text-brand-600"
|
||||
>
|
||||
<Mic class="h-5 w-5" />
|
||||
</button>
|
||||
<div class="relative" ref="kbMenuRef">
|
||||
<button
|
||||
@click="showKbDropdown = !showKbDropdown"
|
||||
class="flex items-center gap-1 rounded-lg border border-slate-200 px-3 py-1.5 text-xs font-medium text-slate-600 transition-colors hover:bg-slate-50 dark:border-slate-700 dark:text-slate-300 dark:hover:bg-slate-800"
|
||||
class="flex items-center gap-1 rounded-lg border border-default px-3 py-1.5 text-xs font-medium text-secondary transition-colors hover:bg-surface-soft"
|
||||
>
|
||||
<Database class="h-3.5 w-3.5 text-brand-500" />
|
||||
{{ getKbLabel(selectedKb) }} <ChevronDown class="h-3 w-3" />
|
||||
</button>
|
||||
<div
|
||||
v-if="showKbDropdown"
|
||||
class="absolute bottom-full left-0 mb-2 w-36 overflow-hidden rounded-xl border border-slate-100 bg-white py-1 shadow-xl animate-fade-in dark:border-slate-700 dark:bg-slate-900"
|
||||
class="absolute bottom-full left-0 mb-2 w-36 overflow-hidden rounded-xl border border-subtle bg-surface py-1 shadow-xl animate-fade-in"
|
||||
>
|
||||
<button
|
||||
v-for="option in kbOptions"
|
||||
:key="option"
|
||||
@click="selectedKb = option; showKbDropdown = false"
|
||||
class="flex w-full items-center justify-between px-3 py-2 text-xs text-slate-700 transition-colors hover:bg-slate-50 dark:text-slate-300 dark:hover:bg-slate-800"
|
||||
:class="{ 'font-bold text-brand-700 dark:text-brand-300': selectedKb === option }"
|
||||
class="flex w-full items-center justify-between px-3 py-2 text-xs text-secondary transition-colors hover:bg-surface-soft"
|
||||
:class="{ 'font-bold text-brand-700': selectedKb === option }"
|
||||
>
|
||||
{{ getKbLabel(option) }}
|
||||
<Check v-if="selectedKb === option" class="h-3.5 w-3.5" />
|
||||
@@ -2748,7 +2749,7 @@ const showChatRating = ref(false);
|
||||
</div>
|
||||
<button
|
||||
@click="toggleBrowserPanel"
|
||||
class="flex items-center gap-1 rounded-lg border border-slate-200 px-3 py-1.5 text-xs font-medium text-slate-600 transition-colors hover:bg-slate-50 dark:border-slate-700 dark:text-slate-300 dark:hover:bg-slate-800"
|
||||
class="flex items-center gap-1 rounded-lg border border-default px-3 py-1.5 text-xs font-medium text-secondary transition-colors hover:bg-surface-soft"
|
||||
>
|
||||
<Globe class="h-3.5 w-3.5 text-brand-500" />
|
||||
{{ browserPanelOpen ? $t('chat.collapseBrowser') : $t('chat.openBrowser') }}
|
||||
@@ -2759,14 +2760,14 @@ const showChatRating = ref(false);
|
||||
:disabled="!input.trim() || isThinking"
|
||||
class="flex h-10 w-10 items-center justify-center rounded-full border shadow-sm transition-all duration-200 disabled:cursor-not-allowed disabled:opacity-50"
|
||||
:class="!input.trim() || isThinking
|
||||
? 'border-slate-200 bg-slate-100 text-slate-400 dark:border-slate-700 dark:bg-slate-800'
|
||||
? 'border-default bg-slate-100 text-muted'
|
||||
: 'border-brand-500 bg-brand-500 text-white shadow-[0_0_0_4px_rgba(59,130,246,0.18)] hover:scale-105 hover:bg-brand-600 hover:shadow-[0_0_0_6px_rgba(59,130,246,0.24)] active:scale-95'"
|
||||
>
|
||||
<Send class="h-4 w-4" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-3 text-center text-[11px] text-slate-400">
|
||||
<div class="mt-3 text-center text-[11px] text-muted">
|
||||
{{ $t('chat.disclaimer') }}
|
||||
</div>
|
||||
</div>
|
||||
@@ -2775,7 +2776,7 @@ const showChatRating = ref(false);
|
||||
|
||||
<div
|
||||
v-if="browserPanelOpen"
|
||||
class="fixed inset-0 z-40 bg-slate-900/40 backdrop-blur-sm lg:hidden"
|
||||
class="fixed inset-0 z-40 bg-overlay backdrop-blur-sm lg:hidden"
|
||||
@click="browserPanelOpen = false"
|
||||
></div>
|
||||
|
||||
@@ -2786,35 +2787,35 @@ const showChatRating = ref(false);
|
||||
>
|
||||
<div
|
||||
class="absolute inset-y-0 left-1/2 w-px -translate-x-1/2 transition-colors"
|
||||
:class="isBrowserResizing ? 'bg-brand-500' : 'bg-slate-200 dark:bg-slate-800'"
|
||||
:class="isBrowserResizing ? 'bg-brand-500' : 'bg-slate-200'"
|
||||
></div>
|
||||
</div>
|
||||
|
||||
<aside
|
||||
v-if="browserPanelOpen"
|
||||
class="fixed inset-y-0 right-0 z-50 flex w-full max-w-[100vw] flex-col border-l border-slate-200 bg-white shadow-2xl dark:border-slate-800 dark:bg-slate-950 sm:w-[420px] lg:static lg:z-0 lg:w-[420px] lg:shadow-none"
|
||||
class="fixed inset-y-0 right-0 z-50 flex w-full max-w-[100vw] flex-col border-l border-default bg-surface shadow-2xl sm:w-[420px] lg:static lg:z-0 lg:w-[420px] lg:shadow-none"
|
||||
:style="browserPanelStyle"
|
||||
>
|
||||
<div class="flex items-center justify-between border-b border-slate-200 px-4 py-3 dark:border-slate-800">
|
||||
<div class="flex items-center gap-2 text-sm font-semibold text-slate-700 dark:text-slate-100">
|
||||
<div class="flex items-center justify-between border-b border-default px-4 py-3">
|
||||
<div class="flex items-center gap-2 text-sm font-semibold text-secondary">
|
||||
<Globe class="h-4 w-4 text-brand-500" />
|
||||
{{ $t('chat.browser') }}
|
||||
</div>
|
||||
<button
|
||||
@click="browserPanelOpen = false"
|
||||
class="rounded-md p-1.5 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-slate-800 dark:hover:text-slate-200"
|
||||
class="rounded-md p-1.5 text-muted transition-colors hover-surface-soft hover:text-secondary"
|
||||
:title="$t('chat.closeBrowser')"
|
||||
>
|
||||
<X class="h-4 w-4" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-2 border-b border-slate-200 px-3 py-3 dark:border-slate-800">
|
||||
<div class="flex items-center gap-2 border-b border-default px-3 py-3">
|
||||
<input
|
||||
v-model="browserDraftUrl"
|
||||
type="text"
|
||||
:placeholder="$t('chat.browserInputPlaceholder')"
|
||||
class="flex-1 rounded-xl border border-slate-200 bg-slate-50 px-3 py-2 text-sm text-slate-800 outline-none transition focus:border-brand-400 focus:bg-white dark:border-slate-700 dark:bg-slate-900 dark:text-slate-100 dark:focus:bg-slate-950"
|
||||
class="flex-1 rounded-xl border border-default bg-surface-soft px-3 py-2 text-sm text-primary outline-none transition focus:border-brand-400 focus:bg-surface"
|
||||
@keydown="handleBrowserUrlEnter"
|
||||
/>
|
||||
<button
|
||||
@@ -2825,24 +2826,24 @@ const showChatRating = ref(false);
|
||||
</button>
|
||||
<button
|
||||
@click="refreshBrowserPage"
|
||||
class="rounded-xl border border-slate-200 p-2 text-slate-500 transition-colors hover:bg-slate-50 hover:text-slate-700 dark:border-slate-700 dark:hover:bg-slate-800 dark:hover:text-slate-200"
|
||||
class="rounded-xl border border-default p-2 text-muted transition-colors hover:bg-surface-soft hover:text-secondary"
|
||||
:title="$t('chat.refresh')"
|
||||
>
|
||||
<RotateCw class="h-4 w-4" />
|
||||
</button>
|
||||
<button
|
||||
@click="openBrowserInNewTab"
|
||||
class="rounded-xl border border-slate-200 p-2 text-slate-500 transition-colors hover:bg-slate-50 hover:text-slate-700 dark:border-slate-700 dark:hover:bg-slate-800 dark:hover:text-slate-200"
|
||||
class="rounded-xl border border-default p-2 text-muted transition-colors hover:bg-surface-soft hover:text-secondary"
|
||||
:title="$t('chat.openInNewTab')"
|
||||
>
|
||||
<ExternalLink class="h-4 w-4" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="min-h-0 flex-1 bg-slate-100 dark:bg-slate-900">
|
||||
<div class="min-h-0 flex-1 bg-slate-100">
|
||||
<div
|
||||
v-if="!browserCurrentUrl"
|
||||
class="flex h-full flex-col items-center justify-center gap-3 px-8 text-center text-sm text-slate-500 dark:text-slate-400"
|
||||
class="flex h-full flex-col items-center justify-center gap-3 px-8 text-center text-sm text-muted"
|
||||
>
|
||||
<Globe class="h-8 w-8 text-brand-500" />
|
||||
<div>{{ $t('chat.browserHint1') }}</div>
|
||||
@@ -2852,15 +2853,15 @@ const showChatRating = ref(false);
|
||||
v-else
|
||||
:key="browserFrameKey"
|
||||
:src="browserCurrentUrl"
|
||||
class="h-full w-full border-0 bg-white dark:bg-slate-950"
|
||||
class="h-full w-full border-0 bg-surface"
|
||||
allow="clipboard-read; clipboard-write"
|
||||
></iframe>
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</ChatShell>
|
||||
|
||||
<FilePreviewModal
|
||||
v-model="filePreviewVisible"
|
||||
@@ -2883,38 +2884,39 @@ const showChatRating = ref(false);
|
||||
/>
|
||||
<div
|
||||
v-if="showLeaveAgentDialog"
|
||||
class="fixed inset-0 z-[100] flex items-center justify-center bg-black/40 backdrop-blur-sm p-4"
|
||||
class="dialog-overlay z-[100] items-center"
|
||||
@click.self="closeLeaveAgentDialog"
|
||||
>
|
||||
<div class="flex w-full max-w-2xl max-h-[80vh] flex-col rounded-2xl bg-white p-6 shadow-2xl dark:bg-slate-900">
|
||||
<div class="mb-4 flex items-center justify-between">
|
||||
<div class="dialog-panel flex max-h-[80vh] max-w-2xl flex-col">
|
||||
<div class="dialog-header">
|
||||
<div>
|
||||
<h3 class="text-lg font-bold text-slate-800 dark:text-slate-100">{{ $t('chat.selectWho', { role: leaveUserSelectRole === 'agent' ? $t('chat.leaveAgent') : $t('chat.leaveApplicant') }) }}</h3>
|
||||
<p class="mt-1 text-sm text-slate-500 dark:text-slate-400">{{ $t('chat.oaDataConnected') }}</p>
|
||||
<h3 class="section-title">{{ $t('chat.selectWho', { role: leaveUserSelectRole === 'agent' ? $t('chat.leaveAgent') : $t('chat.leaveApplicant') }) }}</h3>
|
||||
<p class="section-desc mt-1">{{ $t('chat.oaDataConnected') }}</p>
|
||||
</div>
|
||||
<button @click="closeLeaveAgentDialog" class="text-slate-400 hover:text-slate-600 dark:hover:text-slate-200">
|
||||
<button type="button" class="btn-icon-ds" :aria-label="$t('admin.close')" @click="closeLeaveAgentDialog">
|
||||
<X class="h-5 w-5" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="mb-4 relative shrink-0">
|
||||
<div class="dialog-body space-y-4 border-t-0 pt-4">
|
||||
<div class="relative shrink-0">
|
||||
<input
|
||||
v-model="leaveAgentKeyword"
|
||||
@keydown.enter="handleAgentSearch"
|
||||
type="text"
|
||||
:placeholder="$t('chat.searchByNameOrEmployeeId')"
|
||||
class="w-full rounded-xl border border-slate-200 bg-slate-50 px-4 py-2.5 pr-10 text-sm outline-none transition focus:border-brand-400 dark:border-slate-700 dark:bg-slate-950 dark:text-slate-100"
|
||||
class="input-field pr-10"
|
||||
/>
|
||||
<button @click="handleAgentSearch" class="absolute inset-y-0 right-0 flex w-10 items-center justify-center text-slate-400 hover:text-brand-600">
|
||||
<button type="button" @click="handleAgentSearch" class="absolute inset-y-0 right-0 flex w-10 items-center justify-center text-muted hover:text-brand-600">
|
||||
<Search class="h-4 w-4" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="flex-1 space-y-3 overflow-y-auto pr-2 scrollbar-thin">
|
||||
<div class="max-h-[50vh] flex-1 space-y-3 overflow-y-auto pr-2 scrollbar-thin">
|
||||
<div v-if="leaveAgentLoading && leaveAgentPage === 1" class="flex justify-center py-8">
|
||||
<Loader2 class="h-6 w-6 animate-spin text-brand-500" />
|
||||
</div>
|
||||
<div v-else-if="leaveAgentOptions.length === 0" class="py-8 text-center text-sm text-slate-400">
|
||||
<div v-else-if="leaveAgentOptions.length === 0" class="py-8 text-center text-sm text-muted">
|
||||
{{ $t('chat.noData') }}
|
||||
</div>
|
||||
<template v-else>
|
||||
@@ -2922,14 +2924,14 @@ const showChatRating = ref(false);
|
||||
v-for="option in leaveAgentOptions"
|
||||
:key="option.uid"
|
||||
type="button"
|
||||
class="flex w-full items-center justify-between rounded-2xl border border-slate-200 px-4 py-4 text-left transition hover:border-brand-300 hover:bg-brand-50/50 dark:border-slate-700 dark:hover:border-brand-500/40 dark:hover:bg-brand-500/10"
|
||||
class="flex w-full items-center justify-between rounded-2xl border border-default px-4 py-4 text-left transition hover:border-brand-300 hover:bg-brand-50/50"
|
||||
@click="selectLeaveAgent(option)"
|
||||
>
|
||||
<div class="space-y-1">
|
||||
<div class="text-sm font-semibold text-slate-800 dark:text-slate-100">{{ option.name }}</div>
|
||||
<div class="text-xs text-slate-500 dark:text-slate-400">UID:{{ option.uid }}</div>
|
||||
<div class="text-sm font-semibold text-primary">{{ option.name }}</div>
|
||||
<div class="text-xs text-muted">UID:{{ option.uid }}</div>
|
||||
</div>
|
||||
<div class="text-right text-xs text-slate-500 dark:text-slate-400">
|
||||
<div class="text-right text-xs text-muted">
|
||||
<div>{{ $t('chat.employeeId') }}:{{ option.employeeId }}</div>
|
||||
<div>{{ $t('chat.name') }}:{{ option.name }}</div>
|
||||
</div>
|
||||
@@ -2939,7 +2941,7 @@ const showChatRating = ref(false);
|
||||
<button
|
||||
@click="loadAllAgents"
|
||||
:disabled="leaveAgentLoading"
|
||||
class="text-xs text-slate-500 hover:text-slate-700 disabled:opacity-50 dark:text-slate-400 dark:hover:text-slate-300"
|
||||
class="text-xs text-muted hover:text-secondary disabled:opacity-50"
|
||||
>
|
||||
{{ $t('chat.loadAll') }}
|
||||
</button>
|
||||
@@ -2951,50 +2953,50 @@ const showChatRating = ref(false);
|
||||
{{ leaveAgentLoading ? $t('chat.loading') : $t('chat.loadMore') }}
|
||||
</button>
|
||||
</div>
|
||||
<div v-else class="py-4 text-center text-xs text-slate-400">{{ $t('chat.noMoreData') }}</div>
|
||||
<div v-else class="py-4 text-center text-xs text-muted">{{ $t('chat.noMoreData') }}</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- OA 登录对话框 -->
|
||||
<Teleport to="body">
|
||||
<div v-if="showOALoginDialog" class="fixed inset-0 z-[9999] flex items-center justify-center">
|
||||
<div class="absolute inset-0 bg-black/40" @click="cancelOALogin"></div>
|
||||
<div class="relative w-full max-w-sm rounded-2xl bg-white p-6 shadow-2xl dark:bg-slate-800">
|
||||
<h3 class="mb-4 text-center text-lg font-bold text-slate-800 dark:text-slate-100">{{ $t('chat.loginOaSystem') }}</h3>
|
||||
<div class="space-y-4">
|
||||
<div
|
||||
v-if="showOALoginDialog"
|
||||
class="dialog-overlay z-[9999] items-center"
|
||||
@click.self="cancelOALogin"
|
||||
>
|
||||
<div class="dialog-panel max-w-sm">
|
||||
<div class="dialog-header dialog-header--compact justify-center border-0 pb-2">
|
||||
<h3 class="section-title text-center">{{ $t('chat.loginOaSystem') }}</h3>
|
||||
</div>
|
||||
<div class="dialog-body space-y-4 border-t-0 pt-0">
|
||||
<label class="block space-y-1.5">
|
||||
<span class="text-sm font-medium text-slate-600 dark:text-slate-300">{{ $t('chat.employeeId') }}</span>
|
||||
<span class="label-field">{{ $t('chat.employeeId') }}</span>
|
||||
<input
|
||||
v-model="oaLoginEmployeeId"
|
||||
type="text"
|
||||
disabled
|
||||
class="w-full rounded-xl border border-slate-200 bg-slate-100 px-3 py-2.5 text-sm text-slate-600 outline-none dark:border-slate-600 dark:bg-slate-700 dark:text-slate-300"
|
||||
class="input-field bg-surface-soft"
|
||||
/>
|
||||
</label>
|
||||
<label class="block space-y-1.5">
|
||||
<span class="text-sm font-medium text-slate-600 dark:text-slate-300">{{ $t('login.password') }}</span>
|
||||
<span class="label-field">{{ $t('login.password') }}</span>
|
||||
<input
|
||||
v-model="oaLoginPassword"
|
||||
type="password"
|
||||
:placeholder="$t('chat.enterOaPassword')"
|
||||
class="w-full rounded-xl border border-slate-200 bg-white px-3 py-2.5 text-sm text-slate-800 outline-none focus:border-brand-400 focus:ring-2 focus:ring-brand-100 dark:border-slate-600 dark:bg-slate-900 dark:text-slate-100 dark:focus:border-brand-500 dark:focus:ring-brand-500/20"
|
||||
class="input-field"
|
||||
@keyup.enter="confirmOALogin"
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
<div class="mt-6 flex items-center justify-end gap-3">
|
||||
<button
|
||||
@click="cancelOALogin"
|
||||
class="rounded-xl border border-slate-200 px-4 py-2 text-sm font-medium text-slate-600 transition hover:bg-slate-50 dark:border-slate-600 dark:text-slate-300 dark:hover:bg-slate-700"
|
||||
>
|
||||
<div class="dialog-footer">
|
||||
<button type="button" @click="cancelOALogin" class="btn-secondary">
|
||||
{{ $t('profile.cancel') }}
|
||||
</button>
|
||||
<button
|
||||
@click="confirmOALogin"
|
||||
class="rounded-xl bg-brand-600 px-4 py-2 text-sm font-medium text-white transition hover:bg-brand-700 dark:bg-brand-500 dark:hover:bg-brand-600"
|
||||
>
|
||||
<button type="button" @click="confirmOALogin" class="btn-primary btn-sm">
|
||||
{{ $t('chat.confirmLogin') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user