Merge branch 'dev' of https://gitee.com/justop/hxops into dev
This commit is contained in:
commit
d96008df02
19 files changed
+742
-122
No files matched your search
@@ -53,6 +53,36 @@ export const updateAdminAgent = (id: number, payload: Record<string, unknown>) =
|
||||
requestJson(`/api/admin/agents/${id}`, { method: 'PUT', ...jsonAuth(), body: JSON.stringify(payload) });
|
||||
export const deleteAdminAgent = (id: number) =>
|
||||
requestJson(`/api/admin/agents/${id}`, { method: 'DELETE', ...auth() });
|
||||
|
||||
// Agent Guides
|
||||
export const listAdminAgentGuides = (agentId?: number) => {
|
||||
const url = agentId ? `/api/admin/guides?agent_id=${agentId}` : '/api/admin/guides';
|
||||
return requestJson<any[]>(url, auth());
|
||||
};
|
||||
|
||||
export const createAdminAgentGuide = (payload: Record<string, unknown>) =>
|
||||
requestJson('/api/admin/guides', { method: 'POST', ...jsonAuth(), body: JSON.stringify(payload) });
|
||||
|
||||
export const updateAdminAgentGuide = (id: number, payload: Record<string, unknown>) =>
|
||||
requestJson(`/api/admin/guides/${id}`, { method: 'PUT', ...jsonAuth(), body: JSON.stringify(payload) });
|
||||
|
||||
export const deleteAdminAgentGuide = (id: number) =>
|
||||
requestJson(`/api/admin/guides/${id}`, { method: 'DELETE', ...auth() });
|
||||
|
||||
export const uploadAdminAgentGuideFile = async (file: File) => {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
const response = await fetch('/api/admin/guides/upload', {
|
||||
method: 'POST',
|
||||
headers: getAuthHeaders(),
|
||||
body: formData,
|
||||
});
|
||||
if (!response.ok) {
|
||||
const error = await response.json().catch(() => ({}));
|
||||
throw new Error(error.message || 'Upload failed');
|
||||
}
|
||||
return response.json();
|
||||
};
|
||||
export const testAdminAgent = (id: number) =>
|
||||
requestJson<any>(`/api/admin/agents/${id}/test`, { method: 'POST', ...auth() });
|
||||
export const saveAdminAgentPermissions = (agentId: number, userIds: number[]) =>
|
||||
|
||||
@@ -42,3 +42,5 @@ export const getUserAgent = (agentId: number) =>
|
||||
requestJson<Record<string, any>>(`/api/user/agents/${agentId}`, auth());
|
||||
|
||||
export const listUserAgents = () => requestJson<any[]>('/api/agents', auth());
|
||||
|
||||
export const listAgentGuides = (agentId: number) => requestJson<any[]>(`/api/agents/${agentId}/guides`, auth());
|
||||
@@ -1,110 +1,218 @@
|
||||
/**␍
|
||||
* app/router/routes/admin.routes.ts␍
|
||||
* 管理后台嵌套路由;全部 admin 模块已独立拆分。␍
|
||||
*/␍
|
||||
import type { RouteRecordRaw } from 'vue-router';␍
|
||||
␍
|
||||
const AdminLayout = () => import('@/features/admin/views/AdminLayout.vue');␍
|
||||
const AgentsPage = () => import('@/features/admin/modules/agents/AgentsPage.vue');␍
|
||||
const UsersPage = () => import('@/features/admin/modules/users/UsersPage.vue');␍
|
||||
const DepartmentsPage = () => import('@/features/admin/modules/departments/DepartmentsPage.vue');␍
|
||||
const ApprovalsPage = () => import('@/features/admin/modules/approvals/ApprovalsPage.vue');␍
|
||||
const AnnouncementsPage = () => import('@/features/admin/modules/announcements/AnnouncementsPage.vue');␍
|
||||
const QuestionsPage = () => import('@/features/admin/modules/questions/QuestionsPage.vue');␍
|
||||
const RequestsPage = () => import('@/features/admin/modules/requests/RequestsPage.vue');␍
|
||||
const PermissionsPage = () => import('@/features/admin/modules/permissions/PermissionsPage.vue');␍
|
||||
const DashboardPage = () => import('@/features/admin/modules/dashboard/DashboardPage.vue');␍
|
||||
const SchedulesPage = () => import('@/features/admin/modules/schedules/SchedulesPage.vue');␍
|
||||
const KnowledgeBasePage = () => import('@/features/admin/modules/knowledge-base/KnowledgeBasePage.vue');␍
|
||||
const WecomPage = () => import('@/features/admin/modules/wecom/WecomPage.vue');␍
|
||||
const ReportsPage = () => import('@/features/admin/modules/reports/ReportsPage.vue');␍
|
||||
␍
|
||||
export const adminRoutes: RouteRecordRaw[] = [␍
|
||||
{␍
|
||||
path: '/admin',␍
|
||||
component: AdminLayout,␍
|
||||
meta: { requiresAdmin: true },␍
|
||||
children: [␍
|
||||
{ path: '', redirect: '/admin/dashboard' },␍
|
||||
{␍
|
||||
path: 'dashboard',␍
|
||||
name: 'AdminDashboard',␍
|
||||
component: DashboardPage,␍
|
||||
meta: { requiresAdmin: true, adminModule: 'dashboard', title: '概览' },␍
|
||||
},␍
|
||||
{␍
|
||||
path: 'schedules',␍
|
||||
name: 'AdminSchedules',␍
|
||||
component: SchedulesPage,␍
|
||||
meta: { requiresAdmin: true, adminModule: 'schedules', title: '定时任务' },␍
|
||||
},␍
|
||||
{␍
|
||||
path: 'knowledge-base',␍
|
||||
name: 'AdminKnowledgeBase',␍
|
||||
component: KnowledgeBasePage,␍
|
||||
meta: { requiresAdmin: true, adminModule: 'knowledge_base', title: '知识库' },␍
|
||||
},␍
|
||||
{␍
|
||||
path: 'wecom',␍
|
||||
name: 'AdminWecom',␍
|
||||
component: WecomPage,␍
|
||||
meta: { requiresAdmin: true, adminModule: 'wecom', title: '企业微信' },␍
|
||||
},␍
|
||||
{␍
|
||||
path: 'approvals',␍
|
||||
name: 'AdminApprovals',␍
|
||||
component: ApprovalsPage,␍
|
||||
meta: { requiresAdmin: true, adminModule: 'approvals', title: '用户审批' },␍
|
||||
},␍
|
||||
{␍
|
||||
path: 'agents',␍
|
||||
name: 'AdminAgents',␍
|
||||
component: AgentsPage,␍
|
||||
meta: { requiresAdmin: true, adminModule: 'agents', title: '应用管理' },␍
|
||||
},␍
|
||||
{␍
|
||||
path: 'users',␍
|
||||
name: 'AdminUsers',␍
|
||||
component: UsersPage,␍
|
||||
meta: { requiresAdmin: true, adminModule: 'users', title: '用户管理' },␍
|
||||
},␍
|
||||
{␍
|
||||
path: 'departments',␍
|
||||
name: 'AdminDepartments',␍
|
||||
component: DepartmentsPage,␍
|
||||
meta: { requiresAdmin: true, adminModule: 'departments', title: '部门管理' },␍
|
||||
},␍
|
||||
{␍
|
||||
path: 'announcements',␍
|
||||
name: 'AdminAnnouncements',␍
|
||||
component: AnnouncementsPage,␍
|
||||
meta: { requiresAdmin: true, adminModule: 'announcements', title: '公告管理' },␍
|
||||
},␍
|
||||
{␍
|
||||
path: 'questions',␍
|
||||
name: 'AdminQuestions',␍
|
||||
component: QuestionsPage,␍
|
||||
meta: { requiresAdmin: true, adminModule: 'questions', title: '常用问题' },␍
|
||||
},␍
|
||||
{␍
|
||||
path: 'requests',␍
|
||||
name: 'AdminRequests',␍
|
||||
component: RequestsPage,␍
|
||||
meta: { requiresAdmin: true, adminModule: 'requests', title: '权限申请' },␍
|
||||
},␍
|
||||
{␍
|
||||
path: 'permissions',␍
|
||||
name: 'AdminPermissions',␍
|
||||
component: PermissionsPage,␍
|
||||
meta: { requiresAdmin: true, adminModule: 'permissions', title: '权限管理' },␍
|
||||
},␍
|
||||
{␍
|
||||
path: 'reports/:table?',␍
|
||||
name: 'AdminReports',␍
|
||||
component: ReportsPage,␍
|
||||
meta: { requiresAdmin: true, adminModule: 'reports', title: '报表' },␍
|
||||
},␍
|
||||
],␍
|
||||
},␍
|
||||
];␍
|
||||
␍
|
||||
/**
|
||||
|
||||
* app/router/routes/admin.routes.ts
|
||||
|
||||
* 管理后台嵌套路由;全部 admin 模块已独立拆分。
|
||||
|
||||
*/
|
||||
|
||||
import type { RouteRecordRaw } from 'vue-router';
|
||||
|
||||
|
||||
|
||||
const AdminLayout = () => import('@/features/admin/views/AdminLayout.vue');
|
||||
|
||||
const AgentsPage = () => import('@/features/admin/modules/agents/AgentsPage.vue');
|
||||
|
||||
const UsersPage = () => import('@/features/admin/modules/users/UsersPage.vue');
|
||||
|
||||
const DepartmentsPage = () => import('@/features/admin/modules/departments/DepartmentsPage.vue');
|
||||
|
||||
const ApprovalsPage = () => import('@/features/admin/modules/approvals/ApprovalsPage.vue');
|
||||
|
||||
const AnnouncementsPage = () => import('@/features/admin/modules/announcements/AnnouncementsPage.vue');
|
||||
|
||||
const QuestionsPage = () => import('@/features/admin/modules/questions/QuestionsPage.vue');
|
||||
|
||||
const RequestsPage = () => import('@/features/admin/modules/requests/RequestsPage.vue');
|
||||
|
||||
const PermissionsPage = () => import('@/features/admin/modules/permissions/PermissionsPage.vue');
|
||||
const PlatformAppsPage = () => import('@/features/admin/modules/platform-apps/PlatformAppsPage.vue');
|
||||
const DashboardPage = () => import('@/features/admin/modules/dashboard/DashboardPage.vue');
|
||||
|
||||
const SchedulesPage = () => import('@/features/admin/modules/schedules/SchedulesPage.vue');
|
||||
|
||||
const KnowledgeBasePage = () => import('@/features/admin/modules/knowledge-base/KnowledgeBasePage.vue');
|
||||
|
||||
const WecomPage = () => import('@/features/admin/modules/wecom/WecomPage.vue');
|
||||
|
||||
const ReportsPage = () => import('@/features/admin/modules/reports/ReportsPage.vue');
|
||||
|
||||
|
||||
|
||||
export const adminRoutes: RouteRecordRaw[] = [
|
||||
|
||||
{
|
||||
|
||||
path: '/admin',
|
||||
|
||||
component: AdminLayout,
|
||||
|
||||
meta: { requiresAdmin: true },
|
||||
|
||||
children: [
|
||||
|
||||
{ path: '', redirect: '/admin/dashboard' },
|
||||
|
||||
{
|
||||
|
||||
path: 'dashboard',
|
||||
|
||||
name: 'AdminDashboard',
|
||||
|
||||
component: DashboardPage,
|
||||
|
||||
meta: { requiresAdmin: true, adminModule: 'dashboard', title: '概览' },
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
|
||||
path: 'schedules',
|
||||
|
||||
name: 'AdminSchedules',
|
||||
|
||||
component: SchedulesPage,
|
||||
|
||||
meta: { requiresAdmin: true, adminModule: 'schedules', title: '定时任务' },
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
|
||||
path: 'knowledge-base',
|
||||
|
||||
name: 'AdminKnowledgeBase',
|
||||
|
||||
component: KnowledgeBasePage,
|
||||
|
||||
meta: { requiresAdmin: true, adminModule: 'knowledge_base', title: '知识库' },
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
|
||||
path: 'wecom',
|
||||
|
||||
name: 'AdminWecom',
|
||||
|
||||
component: WecomPage,
|
||||
|
||||
meta: { requiresAdmin: true, adminModule: 'wecom', title: '企业微信' },
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
|
||||
path: 'approvals',
|
||||
|
||||
name: 'AdminApprovals',
|
||||
|
||||
component: ApprovalsPage,
|
||||
|
||||
meta: { requiresAdmin: true, adminModule: 'approvals', title: '用户审批' },
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
|
||||
path: 'agents',
|
||||
|
||||
name: 'AdminAgents',
|
||||
|
||||
component: AgentsPage,
|
||||
|
||||
meta: { requiresAdmin: true, adminModule: 'agents', title: '应用管理' },
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
|
||||
path: 'users',
|
||||
|
||||
name: 'AdminUsers',
|
||||
|
||||
component: UsersPage,
|
||||
|
||||
meta: { requiresAdmin: true, adminModule: 'users', title: '用户管理' },
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
|
||||
path: 'departments',
|
||||
|
||||
name: 'AdminDepartments',
|
||||
|
||||
component: DepartmentsPage,
|
||||
|
||||
meta: { requiresAdmin: true, adminModule: 'departments', title: '部门管理' },
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
|
||||
path: 'announcements',
|
||||
|
||||
name: 'AdminAnnouncements',
|
||||
|
||||
component: AnnouncementsPage,
|
||||
|
||||
meta: { requiresAdmin: true, adminModule: 'announcements', title: '公告管理' },
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
|
||||
path: 'questions',
|
||||
|
||||
name: 'AdminQuestions',
|
||||
|
||||
component: QuestionsPage,
|
||||
|
||||
meta: { requiresAdmin: true, adminModule: 'questions', title: '常用问题' },
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
|
||||
path: 'requests',
|
||||
|
||||
name: 'AdminRequests',
|
||||
|
||||
component: RequestsPage,
|
||||
|
||||
meta: { requiresAdmin: true, adminModule: 'requests', title: '权限申请' },
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
path: 'permissions',
|
||||
name: 'AdminPermissions',
|
||||
component: PermissionsPage,
|
||||
meta: { requiresAdmin: true, adminModule: 'permissions', title: '权限管理' },
|
||||
},
|
||||
{
|
||||
path: 'platform-apps',
|
||||
name: 'AdminPlatformApps',
|
||||
component: PlatformAppsPage,
|
||||
meta: { requiresAdmin: true, adminModule: 'platform_apps', title: '平台应用说明' },
|
||||
},
|
||||
{
|
||||
path: 'reports/:table?',
|
||||
|
||||
name: 'AdminReports',
|
||||
|
||||
component: ReportsPage,
|
||||
|
||||
meta: { requiresAdmin: true, adminModule: 'reports', title: '报表' },
|
||||
|
||||
},
|
||||
|
||||
],
|
||||
|
||||
},
|
||||
|
||||
];
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@ export const config = {
|
||||
questions: true, // 常用问题
|
||||
wecom: true, // 企业微信
|
||||
permissions: true, // 应用权限
|
||||
platform_apps: true, // 平台应用说明
|
||||
requests: true, // 审批权限
|
||||
reports: true, // 数据报表
|
||||
schedules: true, // 定时任务
|
||||
|
||||
@@ -8,7 +8,7 @@ import { useI18n } from 'vue-i18n';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import {
|
||||
LayoutDashboard, UserPlus, UserCog, Building, Bot, FileText,
|
||||
Settings2, Megaphone, MessageCircleQuestion, Link2, Users, ShieldCheck, BarChart2,
|
||||
Settings2, Megaphone, MessageCircleQuestion, Link2, Users, ShieldCheck, BarChart2, AppWindow
|
||||
} from 'lucide-vue-next';
|
||||
import type { Component } from 'vue';
|
||||
import { config } from '@/config';
|
||||
@@ -33,6 +33,7 @@ const iconMap: Record<AdminModuleId, Component> = {
|
||||
questions: MessageCircleQuestion,
|
||||
wecom: Link2,
|
||||
permissions: Users,
|
||||
platform_apps: AppWindow,
|
||||
requests: ShieldCheck,
|
||||
reports: BarChart2,
|
||||
};
|
||||
|
||||
@@ -15,7 +15,7 @@ export interface AdminModuleMeta {
|
||||
|
||||
/** 已独立拆分的模块(全部 admin 模块均已拆分) */
|
||||
export const STANDALONE_ADMIN_MODULES = new Set<AdminModuleId>([
|
||||
'dashboard', 'agents', 'users', 'departments', 'approvals', 'announcements', 'questions', 'requests', 'permissions', 'schedules', 'knowledge_base', 'wecom', 'reports',
|
||||
'dashboard', 'agents', 'users', 'departments', 'approvals', 'announcements', 'questions', 'requests', 'permissions', 'schedules', 'knowledge_base', 'wecom', 'platform_apps', 'reports',
|
||||
]);
|
||||
|
||||
export const ADMIN_MODULE_METAS: AdminModuleMeta[] = [
|
||||
@@ -30,6 +30,7 @@ export const ADMIN_MODULE_METAS: AdminModuleMeta[] = [
|
||||
{ id: 'questions', routeName: 'AdminQuestions', path: 'questions', labelKey: 'admin.nav.questions', configKey: 'questions' },
|
||||
{ id: 'wecom', routeName: 'AdminWecom', path: 'wecom', labelKey: 'admin.nav.wecom', configKey: 'wecom' },
|
||||
{ id: 'permissions', routeName: 'AdminPermissions', path: 'permissions', labelKey: 'admin.nav.permissions', configKey: 'permissions' },
|
||||
{ id: 'platform_apps', routeName: 'AdminPlatformApps', path: 'platform-apps', labelKey: 'admin.nav.platformApps', configKey: 'platform_apps' },
|
||||
{ id: 'requests', routeName: 'AdminRequests', path: 'requests', labelKey: 'admin.nav.requests', configKey: 'requests' },
|
||||
];
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ export type AdminModuleId =
|
||||
| 'wecom'
|
||||
| 'permissions'
|
||||
| 'requests'
|
||||
| 'platform_apps'
|
||||
| 'reports';
|
||||
|
||||
export type AdminReportTableId =
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { createI18n } from 'vue-i18n';
|
||||
import { createI18n } from 'vue-i18n';
|
||||
|
||||
const messages = {
|
||||
'en': {
|
||||
@@ -1693,7 +1693,7 @@ const messages = {
|
||||
title: '文件预览',
|
||||
download: '下载文件',
|
||||
downloading: '下载中...',
|
||||
tooLarge: '文件较大,暂不支持在线预览,请直接点击上方“下载文件”获取原文件。',
|
||||
tooLarge: '文件较大,暂不支持在线预览。',
|
||||
previewFailed: '预览失败:',
|
||||
msg: {
|
||||
downloadFailed: '下载失败: {reason}',
|
||||
@@ -1967,6 +1967,7 @@ const messages = {
|
||||
questions: '常用问题',
|
||||
wecom: '企业微信',
|
||||
permissions: '应用权限',
|
||||
platformApps: '平台应用说明',
|
||||
requests: '权限审批',
|
||||
reports: '数据报表',
|
||||
schedules: '排程管理'
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
import { ref, onMounted, onBeforeUnmount, computed, watch, nextTick } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useChat } from '../composables/useChat';
|
||||
import { Send, Loader2, Plus, Copy, Edit2, RotateCw, Check, X, PanelLeftClose, PanelLeftOpen, ChevronDown, Sparkles, Database, Mic, LogOut, MessageSquareText, Globe, ExternalLink, Search, LayoutGrid, Briefcase, History, Sun, Moon, CalendarDays, Building, Paperclip, Link2 } from 'lucide-vue-next';
|
||||
import { Send, Loader2, Plus, Copy, Edit2, RotateCw, Check, X, PanelLeftClose, PanelLeftOpen, ChevronDown, Sparkles, Database, Mic, LogOut, MessageSquareText, Globe, ExternalLink, Search, LayoutGrid, Briefcase, History, Sun, Moon, CalendarDays, Building, Paperclip, Link2, BookOpen, FileText, Play, Image as ImageIcon } from 'lucide-vue-next';
|
||||
import LocaleToggleButton from '../components/LocaleToggleButton.vue';
|
||||
import { marked } from 'marked';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
@@ -45,6 +45,7 @@ import {
|
||||
submitLeaveWorkflow,
|
||||
getUserAgent,
|
||||
listUserAgents,
|
||||
listAgentGuides,
|
||||
} from '../api/user';
|
||||
|
||||
const { t, locale } = useI18n();
|
||||
@@ -701,6 +702,31 @@ watch(isThinking, (thinking) => {
|
||||
const currentAgent = ref<any>(null);
|
||||
const userAgents = ref<Array<{ id: number; name: string; description: string; icon_url?: string; dify_app_type?: 'chatflow' | 'workflow' }>>([]);
|
||||
const showGeneralFeedbackDialog = ref(false);
|
||||
|
||||
const agentGuides = ref<any[]>([]);
|
||||
const showGuideModal = ref(false);
|
||||
const activeGuideId = ref<number | null>(null);
|
||||
const activeGuide = computed(() => agentGuides.value.find(g => g.id === activeGuideId.value));
|
||||
|
||||
const loadAgentGuides = async () => {
|
||||
try {
|
||||
const res = await listAgentGuides(currentAgentId.value || 0);
|
||||
agentGuides.value = res || [];
|
||||
} catch (error) {
|
||||
console.error('Failed to load agent guides:', error);
|
||||
agentGuides.value = [];
|
||||
}
|
||||
};
|
||||
|
||||
const showGuideSidebar = ref(false);
|
||||
|
||||
const openGuideModal = () => {
|
||||
if (agentGuides.value.length > 0) {
|
||||
activeGuideId.value = agentGuides.value[0].id;
|
||||
showGuideModal.value = true;
|
||||
showGuideSidebar.value = false; // 默认收起
|
||||
}
|
||||
};
|
||||
const showDeleteConfirmDialog = ref(false);
|
||||
const deleteConfirmMessage = ref('');
|
||||
let pendingDeleteAction: (() => Promise<void> | void) | null = null;
|
||||
@@ -2422,6 +2448,7 @@ const startNewChat = () => {
|
||||
const loadAgent = async () => {
|
||||
try {
|
||||
currentAgent.value = await getUserAgent(currentAgentId.value);
|
||||
await loadAgentGuides();
|
||||
} catch (e) {
|
||||
if (e instanceof BusinessError && e.status === 403) {
|
||||
msg.error(t('workspace.permission.denied') || 'Access denied');
|
||||
@@ -2430,6 +2457,7 @@ const loadAgent = async () => {
|
||||
}
|
||||
console.error('Failed to load agent', e);
|
||||
currentAgent.value = { name: t('workspace.unknownAgent') };
|
||||
agentGuides.value = [];
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2653,7 +2681,17 @@ const showChatRating = ref(false);
|
||||
{{ currentAgent?.name === '人事规章' ? 'HR' : 'AI' }}
|
||||
</div>
|
||||
<div class="flex flex-col justify-center min-w-0 flex-1 relative group">
|
||||
<span class="font-bold text-primary truncate">{{ currentAgent?.name || 'AI' }}</span>
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="font-bold text-primary truncate">{{ currentAgent?.name || 'AI' }}</span>
|
||||
<button
|
||||
v-if="agentGuides.length > 0"
|
||||
@click="openGuideModal"
|
||||
class="flex items-center gap-1.5 px-3 py-1.5 text-xs font-bold text-brand-700 bg-brand-100 border border-brand-300 rounded-lg hover:bg-brand-200 hover:border-brand-400 transition-all shadow-sm"
|
||||
>
|
||||
<BookOpen class="w-4 h-4" />
|
||||
新手指南
|
||||
</button>
|
||||
</div>
|
||||
<span v-if="currentAgent?.name === '人事规章'" class="block text-[11px] text-muted mt-1 truncate cursor-help">
|
||||
我是你的7x24小时专属HR政策助手。无需手动检索文档,只需用日常说话的方式提问,我能从公司最新、最全的规章制度中,为你精准提取并总结答案。
|
||||
</span>
|
||||
@@ -2783,6 +2821,14 @@ const showChatRating = ref(false);
|
||||
<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-primary">{{ currentAgent?.name || 'AI' }}</span>
|
||||
<button
|
||||
v-if="agentGuides.length > 0"
|
||||
@click="openGuideModal"
|
||||
class="flex items-center gap-1.5 px-3 py-1.5 text-xs font-bold text-brand-700 bg-brand-100 border border-brand-300 rounded-lg hover:bg-brand-200 hover:border-brand-400 transition-all shadow-sm ml-1"
|
||||
>
|
||||
<BookOpen class="w-4 h-4" />
|
||||
新手指南
|
||||
</button>
|
||||
</div>
|
||||
<div class="flex items-center gap-1">
|
||||
<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')">
|
||||
@@ -3691,6 +3737,81 @@ const showChatRating = ref(false);
|
||||
@cancel="closeDeleteConfirmDialog"
|
||||
/>
|
||||
|
||||
<Teleport to="body">
|
||||
<!-- 新手指南 Modal -->
|
||||
<div v-if="showGuideModal" class="fixed inset-0 z-[9999] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm">
|
||||
<div class="bg-surface rounded-2xl shadow-xl w-full max-w-4xl overflow-hidden flex flex-col h-[85vh]">
|
||||
<div class="px-6 py-4 border-b border-default flex justify-between items-center bg-surface shrink-0">
|
||||
<h3 class="text-lg font-bold text-primary flex items-center gap-2">
|
||||
<BookOpen class="w-5 h-5 text-brand-600" />
|
||||
{{ currentAgent?.name }} - 新手指南
|
||||
</h3>
|
||||
<div class="flex items-center gap-3">
|
||||
<button @click="showGuideSidebar = !showGuideSidebar" class="flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium text-brand-600 hover:text-brand-700 hover:bg-brand-50 rounded-lg transition-colors border border-transparent hover:border-brand-100">
|
||||
<component :is="showGuideSidebar ? PanelLeftClose : PanelLeftOpen" class="w-4 h-4" />
|
||||
{{ showGuideSidebar ? '收起目录' : '展开目录' }}
|
||||
</button>
|
||||
<div class="w-px h-5 bg-default"></div>
|
||||
<button @click="showGuideModal = false" class="text-muted hover:text-primary transition-colors p-1 rounded-lg hover:bg-surface-soft">
|
||||
<X class="w-6 h-6" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex-1 overflow-hidden flex min-h-0 relative">
|
||||
<div
|
||||
class="absolute md:relative z-10 h-full w-64 border-r border-default overflow-y-auto bg-surface-soft p-4 space-y-2 shrink-0 transition-transform duration-300 shadow-xl md:shadow-none"
|
||||
:class="showGuideSidebar ? 'translate-x-0' : '-translate-x-full absolute'"
|
||||
v-show="showGuideSidebar"
|
||||
>
|
||||
<button
|
||||
v-for="guide in agentGuides"
|
||||
:key="guide.id"
|
||||
@click="activeGuideId = guide.id"
|
||||
class="w-full text-left px-4 py-3 rounded-xl transition-all border"
|
||||
:class="activeGuideId === guide.id ? 'bg-brand-50 border-brand-200 text-brand-700 shadow-sm' : 'bg-surface border-transparent hover:border-default hover:shadow-sm'"
|
||||
>
|
||||
<div class="flex items-center gap-2 mb-1">
|
||||
<component :is="guide.file_type === 'video' ? Play : (guide.file_type === 'pdf' ? FileText : ImageIcon)" class="w-4 h-4 shrink-0" />
|
||||
<span class="font-medium text-sm truncate">{{ guide.file_name }}</span>
|
||||
</div>
|
||||
<p v-if="guide.remark" class="text-xs opacity-70 truncate" :class="activeGuideId === guide.id ? 'text-brand-600' : 'text-muted'">{{ guide.remark }}</p>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="flex-1 bg-[#ebedf0] dark:bg-gray-900 flex items-center justify-center relative overflow-hidden">
|
||||
<template v-if="activeGuide">
|
||||
<video
|
||||
v-if="activeGuide.file_type === 'video'"
|
||||
:key="'video-' + activeGuide.id"
|
||||
:src="activeGuide.file_url || activeGuide.file_path"
|
||||
controls
|
||||
autoplay
|
||||
class="w-full h-full object-contain bg-black"
|
||||
></video>
|
||||
<iframe
|
||||
v-else-if="activeGuide.file_type === 'pdf'"
|
||||
:key="'pdf-' + activeGuide.id"
|
||||
:src="activeGuide.file_url || activeGuide.file_path"
|
||||
class="w-full h-full border-none bg-white"
|
||||
></iframe>
|
||||
<img
|
||||
v-else
|
||||
:key="'img-' + activeGuide.id"
|
||||
:src="activeGuide.file_url || activeGuide.file_path"
|
||||
class="max-w-full max-h-full object-contain"
|
||||
/>
|
||||
</template>
|
||||
<div v-else class="text-muted flex flex-col items-center gap-3">
|
||||
<BookOpen class="w-12 h-12 opacity-20" />
|
||||
<p class="text-sm">请选择左侧指南进行查阅</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Teleport>
|
||||
|
||||
</template>
|
||||
<style scoped>
|
||||
:deep(.chat-markdown details) {
|
||||
|
||||
Reference in new issue
Block a user