side-bar.tsx 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. import UserBar from '@/new-components/layout/UserBar';
  2. import Icon, { AppstoreOutlined, BuildOutlined, ConsoleSqlOutlined, ForkOutlined, MessageOutlined, PartitionOutlined, SearchOutlined } from '@ant-design/icons';
  3. import cls from 'classnames';
  4. import 'moment/locale/zh-cn';
  5. import Image from 'next/image';
  6. import Link from 'next/link';
  7. import { useRouter } from 'next/router';
  8. import { ModelSvg } from '@/components/icons';
  9. function SideBar() {
  10. const { pathname } = useRouter();
  11. const menus = [
  12. {
  13. key: 'explore',
  14. name: '探索',
  15. isActive: pathname === '/',
  16. icon: <SearchOutlined />,
  17. path: '/',
  18. },
  19. {
  20. key: 'app',
  21. name: '应用程序',
  22. path: '/construct/app',
  23. isActive: pathname === '/construct/app',
  24. icon: <AppstoreOutlined />,
  25. },
  26. {
  27. key: 'flow',
  28. name: 'AWEL 工作流',
  29. icon: <ForkOutlined />,
  30. isActive: pathname === '/construct/flow',
  31. path: '/construct/flow',
  32. },
  33. {
  34. key: 'models',
  35. name: '模型管理',
  36. path: '/construct/models',
  37. isActive: pathname === '/construct/models',
  38. icon: <Icon component={ModelSvg} />,
  39. },
  40. {
  41. key: 'database',
  42. name: '数据库',
  43. icon: <ConsoleSqlOutlined />,
  44. isActive: pathname === '/construct/database',
  45. path: '/construct/database',
  46. },
  47. {
  48. key: 'knowledge',
  49. name: '知识库',
  50. icon: <PartitionOutlined />,
  51. isActive: pathname === '/construct/knowledge',
  52. path: '/construct/knowledge',
  53. },
  54. {
  55. key: 'prompt',
  56. name: '提示词',
  57. icon: <MessageOutlined />,
  58. isActive: pathname === '/construct/prompt',
  59. path: '/construct/prompt',
  60. },
  61. ];
  62. return (
  63. <div
  64. className={`
  65. flex flex-col
  66. justify-between
  67. h-screen px-4
  68. pt-4
  69. bg-[#fff]
  70. animate-fade
  71. animate-duration-300`
  72. }
  73. >
  74. <div>
  75. <Link href='/' className=' flex items-center justify-center p-2 pb-4'>
  76. <Image src={'/LOGO_PVC-removebg-preview.png'} alt='PVC-CHAT' width={40} height={40} />
  77. <span className={'ml-2 text-lg font-bold'}>PVC-GPT</span>
  78. </Link>
  79. <div className='gap-2 flex flex-col '>
  80. {menus.map(item => (
  81. <Link
  82. href={item.path}
  83. key={item.path}
  84. style={{
  85. backgroundColor: item.isActive ? '#7288FA' : '',
  86. color: item.isActive ? '#fff' : '',
  87. }}
  88. className={cls(
  89. 'flex items-center w-full h-12 px-4 cursor-pointer dark:hover:bg-theme-dark hover:rounded-xl',
  90. {
  91. 'rounded-xl': item.isActive,
  92. 'hover:bg-[#d8d8d8]': !item.isActive,
  93. 'hover:text-[#3d8dfc]': !item.isActive,
  94. }
  95. )}
  96. >
  97. <div className='mr-3'>{item.icon}</div>
  98. <span className='text-sm'>{(item.name as any)}</span>
  99. </Link>
  100. )
  101. )}
  102. </div>
  103. </div>
  104. <div className='mb-4'>
  105. <UserBar />
  106. </div>
  107. </div>
  108. );
  109. }
  110. export default SideBar;