import { ReactNode } from 'react'; import { Button, Tooltip } from 'antd'; import { FileTextOutlined, SearchOutlined, SettingOutlined, ArrowLeftOutlined, DatabaseOutlined, } from '@ant-design/icons'; import type { Dataset } from '~/api/dify-dataset/type/datasetTypes'; /** * 菜单项类型 */ export type MenuTab = 'documents' | 'retrieve' | 'settings'; interface DatasetLayoutProps { /** 知识库信息 */ dataset: Dataset | null; /** 当前激活的菜单 */ activeTab: MenuTab; /** 菜单切换回调 */ onTabChange: (tab: MenuTab) => void; /** 是否显示返回按钮(在文档详情页时显示) */ showBackButton?: boolean; /** 返回按钮点击回调 */ onBack?: () => void; /** 子组件 */ children: ReactNode; } /** * 知识库布局组件 * 包含左侧菜单栏和右侧内容区 */ export default function DatasetLayout({ dataset, activeTab, onTabChange, showBackButton = false, onBack, children, }: DatasetLayoutProps) { const menuItems: { key: MenuTab; icon: ReactNode; label: string }[] = [ { key: 'documents', icon: , label: '文档' }, { key: 'retrieve', icon: , label: '召回测试' }, { key: 'settings', icon: , label: '设置' }, ]; return (
{/* 左侧侧边栏 */} {/* 右侧内容区 */}
{/* 返回按钮 */} {showBackButton && onBack && (
)} {children}
); }