diff --git a/config/routes.ts b/config/routes.ts
index 256b8db2..2b692ae9 100644
--- a/config/routes.ts
+++ b/config/routes.ts
@@ -5,13 +5,17 @@ export default [
name: 'dashboard',
path: '/dashboard',
key: 'dashboard',
- icon: 'AppstoreOutlined',
+ icon: 'icon-dashboard',
+ selectedIcon: 'icon-dashboard-filled',
+ defaultIcon: 'icon-dashboard',
access: 'canSeeAdmin',
component: './dashboard'
},
{
name: 'playground',
- icon: 'ExperimentOutlined',
+ icon: 'icon-experiment',
+ selectedIcon: 'icon-experiment-filled',
+ defaultIcon: 'icon-experiment',
path: '/playground',
key: 'playground',
routes: [
@@ -65,7 +69,9 @@ export default [
name: 'modelCatalog',
path: '/models/catalog',
key: 'modelsCatalog',
- icon: 'icon-catalog',
+ icon: 'icon-layers',
+ selectedIcon: 'icon-layers-filled',
+ defaultIcon: 'icon-layers',
access: 'canSeeAdmin',
component: './llmodels/catalog'
},
@@ -73,7 +79,9 @@ export default [
name: 'models',
path: '/models/list',
key: 'models',
- icon: 'Block',
+ icon: 'icon-model',
+ selectedIcon: 'icon-model-filled',
+ defaultIcon: 'icon-model',
access: 'canSeeAdmin',
component: './llmodels/index'
},
@@ -81,7 +89,9 @@ export default [
name: 'resources',
path: '/resources',
key: 'resources',
- icon: 'CloudServer',
+ icon: 'icon-resources',
+ selectedIcon: 'icon-resources-filled',
+ defaultIcon: 'icon-resources',
access: 'canSeeAdmin',
component: './resources'
},
@@ -89,14 +99,18 @@ export default [
name: 'apikeys',
path: '/api-keys',
key: 'apikeys',
- icon: 'KeyOutlined',
+ selectedIcon: 'icon-key-filled',
+ icon: 'icon-key',
+ defaultIcon: 'icon-key',
component: './api-keys'
},
{
name: 'users',
path: '/users',
key: 'users',
- icon: 'Team',
+ icon: 'icon-users',
+ selectedIcon: 'icon-users-filled',
+ defaultIcon: 'icon-users',
access: 'canSeeAdmin',
component: './users'
},
diff --git a/src/assets/styles/common.less b/src/assets/styles/common.less
index 64deea17..8b44ff2b 100644
--- a/src/assets/styles/common.less
+++ b/src/assets/styles/common.less
@@ -204,6 +204,10 @@
font-size: 20px;
}
+.font-size-18 {
+ font-size: 18px;
+}
+
.font-size-24 {
font-size: 24px;
}
diff --git a/src/components/icon-font/index.tsx b/src/components/icon-font/index.tsx
index f8024ec9..7d1a1df8 100644
--- a/src/components/icon-font/index.tsx
+++ b/src/components/icon-font/index.tsx
@@ -2,7 +2,7 @@ import { createFromIconfontCN } from '@ant-design/icons';
// import './iconfont/iconfont.js';
const IconFont = createFromIconfontCN({
- scriptUrl: '//at.alicdn.com/t/c/font_4613488_njee9tsv0mp.js'
+ scriptUrl: '//at.alicdn.com/t/c/font_4613488_w50kuuord8o.js'
});
export default IconFont;
diff --git a/src/config/theme/light.ts b/src/config/theme/light.ts
index 832cb3fb..fe43d0cd 100644
--- a/src/config/theme/light.ts
+++ b/src/config/theme/light.ts
@@ -33,7 +33,7 @@ export default {
iconMarginInlineEnd: 12,
itemBorderRadius: 4,
itemSelectedColor: '#007BFF',
- itemHeight: 44,
+ itemHeight: 36,
groupTitleColor: 'rgba(0,0,0,1)',
itemHoverColor: 'rgba(0,0,0,1)',
itemColor: 'rgba(0,0,0,1)',
diff --git a/src/global.less b/src/global.less
index 4e77151b..5beb0fa5 100644
--- a/src/global.less
+++ b/src/global.less
@@ -313,19 +313,20 @@ body {
.ant-menu {
.ant-menu-item {
- color: var(--ant-color-text) !important;
+ // color: var(--ant-color-text) !important;
&:active {
- background-color: var(--ant-menu-item-selected-bg);
+ // background-color: var(--ant-menu-item-selected-bg);
}
}
.ant-menu-item:not(.ant-menu-item-selected) {
- color: var(--ant-color-text);
+ // color: var(--ant-color-text);
}
.ant-menu-item.ant-menu-item-selected {
- color: var(--ant-color-primary) !important;
+ // color: var(--ant-color-primary) !important;
+ font-weight: 400;
}
}
}
@@ -368,7 +369,7 @@ body {
.ant-menu {
.ant-menu-submenu-title {
- color: var(--ant-color-text) !important;
+ // color: var(--ant-color-text) !important;
}
}
@@ -376,7 +377,7 @@ body {
.user-avatar.ant-menu-submenu {
.ant-menu-submenu-title {
padding-left: 10px;
- color: var(--ant-color-text) !important;
+ // color: var(--ant-color-text) !important;
}
}
@@ -385,7 +386,7 @@ body {
display: flex;
justify-content: center;
align-items: center;
- color: var(--ant-color-text) !important;
+ // color: var(--ant-color-text) !important;
padding-inline: unset !important;
width: 100%;
margin-inline: 0 !important;
@@ -412,7 +413,7 @@ body {
display: flex;
justify-content: flex-start;
align-items: center;
- color: var(--ant-color-text) !important;
+ // color: var(--ant-color-text) !important;
}
}
diff --git a/src/layouts/index.tsx b/src/layouts/index.tsx
index 34caed32..52023208 100644
--- a/src/layouts/index.tsx
+++ b/src/layouts/index.tsx
@@ -3,6 +3,7 @@
import { routeCacheAtom, setRouteCache } from '@/atoms/route-cache';
import { GPUStackVersionAtom, UpdateCheckAtom, userAtom } from '@/atoms/user';
import DarkMask from '@/components/dark-mask';
+import IconFont from '@/components/icon-font';
import ShortCuts, {
modalConfig as ShortCutsConfig
} from '@/components/short-cuts';
@@ -14,7 +15,6 @@ import useUserSettings from '@/hooks/use-user-settings';
import { logout } from '@/pages/login/apis';
import { useAccessMarkedRoutes } from '@@/plugin-access';
import { useModel } from '@@/plugin-model';
-import { MenuFoldOutlined, MenuUnfoldOutlined } from '@ant-design/icons';
import { ProLayout } from '@ant-design/pro-components';
import {
Link,
@@ -32,7 +32,7 @@ import { Button, ConfigProvider, Modal, theme } from 'antd';
import 'driver.js/dist/driver.css';
import { useAtom } from 'jotai';
import 'overlayscrollbars/overlayscrollbars.css';
-import { useCallback, useEffect, useMemo, useState } from 'react';
+import { useEffect, useMemo, useState } from 'react';
import Exception from './Exception';
import './Layout.css';
import { LogoIcon, SLogoIcon } from './Logo';
@@ -256,53 +256,51 @@ export default (props: any) => {
return () => clearTimeout(timeout);
}, [initializeMenu, matchedRoute, location]);
- const renderMenuHeader = useCallback(
- (logo, title) => {
- return (
- <>
- {logo}
-
-
-
- >
- );
- },
- [collapsed]
- );
+ const renderMenuHeader = (logo, title) => {
+ return (
+ <>
+ {logo}
+
+
+
+ >
+ );
+ };
- const actionRender = useCallback(
- (layoutProps) => {
- const dom = getRightRenderContent({
- runtimeConfig,
- loading,
- initialState,
- setInitialState,
- intl,
- isDarkTheme: userSettings.isDarkTheme,
- siderWidth: layoutProps.siderWidth,
- collapsed: layoutProps.collapsed,
- showUpgrade
- });
+ const actionRender = (layoutProps) => {
+ const dom = getRightRenderContent({
+ runtimeConfig,
+ loading,
+ initialState,
+ setInitialState,
+ intl,
+ isDarkTheme: userSettings.isDarkTheme,
+ siderWidth: layoutProps.siderWidth,
+ collapsed: layoutProps.collapsed,
+ showUpgrade
+ });
- return dom;
- },
- [intl, showUpgrade, userSettings.theme, userSettings.isDarkTheme]
- );
+ return dom;
+ };
- const itemRender = useCallback((route, _, routes) => {
+ const itemRender = (route, _, routes) => {
const { breadcrumbName, title, path } = route;
const label = title || breadcrumbName;
const last = routes[routes.length - 1];
@@ -312,63 +310,81 @@ export default (props: any) => {
}
}
return {label};
- }, []);
+ };
- const menuItemRender = useCallback(
- (menuItemProps, defaultDom) => {
- if (menuItemProps.isUrl || menuItemProps.children) {
- return defaultDom;
- }
- if (menuItemProps.path && location.pathname !== menuItemProps.path) {
- return (
-
- {defaultDom}
-
+ const menuItemRender = (menuItemProps, defaultDom) => {
+ if (menuItemProps.isUrl || menuItemProps.children) {
+ return defaultDom;
+ }
+ if (menuItemProps.path && location.pathname !== menuItemProps.path) {
+ return (
+
+ {defaultDom}
+
+ );
+ }
+ return <>{defaultDom}>;
+ };
+
+ const menuDataRender = (menuData) => {
+ const currentItem = menuData.find((s) => location.pathname === s.path);
+ return menuData.map((item) => {
+ const newItem = { ...item };
+
+ const selected =
+ location.pathname === newItem.path ||
+ location.pathname.indexOf(newItem.path) > -1;
+
+ if (newItem.icon) {
+ newItem.icon = selected ? (
+
+ ) : (
+
);
}
- return <>{defaultDom}>;
- },
- [location.pathname]
- );
+ if (newItem.children) {
+ newItem.children = menuDataRender(newItem.children);
- const onPageChange = useCallback(
- (route) => {
- const { location } = history;
- const { pathname } = location;
-
- initRouteCacheValue(pathname);
- dropRouteCache(pathname);
-
- // if user is not change password, redirect to change password page
- if (
- location.pathname !== loginPath &&
- userInfo?.require_password_change
- ) {
- history.push(loginPath);
- return;
+ if (selected) {
+ newItem.icon = ;
+ }
}
+ return newItem;
+ });
+ };
- // if user is not logged in, redirect to login page
- if (!initialState?.currentUser && location.pathname !== loginPath) {
- history.push(loginPath);
- } else if (location.pathname === '/') {
- const pathname = initialState?.currentUser?.is_admin
- ? '/dashboard'
- : '/playground';
- history.push(pathname);
- }
- },
- [userInfo?.require_password_change, initialState?.currentUser]
- );
+ const onPageChange = (route) => {
+ const { location } = history;
+ const { pathname } = location;
- const onMenuHeaderClick = useCallback((e) => {
+ initRouteCacheValue(pathname);
+ dropRouteCache(pathname);
+
+ // if user is not change password, redirect to change password page
+ if (location.pathname !== loginPath && userInfo?.require_password_change) {
+ history.push(loginPath);
+ return;
+ }
+
+ // if user is not logged in, redirect to login page
+ if (!initialState?.currentUser && location.pathname !== loginPath) {
+ history.push(loginPath);
+ } else if (location.pathname === '/') {
+ const pathname = initialState?.currentUser?.is_admin
+ ? '/dashboard'
+ : '/playground';
+ history.push(pathname);
+ }
+ };
+
+ const onMenuHeaderClick = (e) => {
e.stopPropagation();
e.preventDefault();
navigate('/dashboard');
- }, []);
+ };
const onCollapse = (value) => {
setCollapsed(value);
@@ -417,7 +433,6 @@ export default (props: any) => {
: theme.defaultAlgorithm,
...themeData
};
- console.log('currentTheme====', data);
return data;
}, [userSettings.isDarkTheme, themeData]);
@@ -461,6 +476,7 @@ export default (props: any) => {
logo={collapsed ? SLogoIcon : LogoIcon}
menuItemRender={menuItemRender}
itemRender={itemRender}
+ menuDataRender={menuDataRender}
disableContentMargin
fixSiderbar
fixedHeader
diff --git a/src/layouts/rightRender.tsx b/src/layouts/rightRender.tsx
index 4b80895b..1ab6317d 100644
--- a/src/layouts/rightRender.tsx
+++ b/src/layouts/rightRender.tsx
@@ -6,12 +6,11 @@ import langConfigMap from '@/locales/lang-config-map';
import {
DiscordOutlined,
GithubOutlined,
- GlobalOutlined,
HomeOutlined,
InfoCircleOutlined,
LogoutOutlined,
MoonOutlined,
- QuestionCircleOutlined,
+ MoreOutlined,
ReadOutlined,
SettingOutlined,
SunOutlined
@@ -140,7 +139,7 @@ export const getRightRenderContent = (opts: {
items: [
{
key: 'help',
- icon: ,
+ icon: ,
label: (
@@ -213,7 +212,7 @@ export const getRightRenderContent = (opts: {
items: [
{
key: 'lang',
- icon: ,
+ icon: ,
label: (
{intl?.formatMessage?.({ id: 'common.settings.language' })}
@@ -265,7 +264,7 @@ export const getRightRenderContent = (opts: {
? 'user-menu-container user-menu-collapsed'
: 'user-menu-container',
mode: 'vertical',
- expandIcon: false,
+ expandIcon: collapsed ? false : ,
// inlineCollapsed: collapsed,
triggerSubMenuAction: 'hover',
items: [
@@ -274,7 +273,7 @@ export const getRightRenderContent = (opts: {
key: 'user',
className: 'user-avatar',
icon: (
-
+
= ({ paddingRight }) => {
})}
style={{ width: 160 }}
>
+
+ }
+ onClick={handleExport}
+ >
+
diff --git a/src/pages/dashboard/components/usage-inner/request-token-inner.tsx b/src/pages/dashboard/components/usage-inner/request-token-inner.tsx
index bc133b6a..0700485f 100644
--- a/src/pages/dashboard/components/usage-inner/request-token-inner.tsx
+++ b/src/pages/dashboard/components/usage-inner/request-token-inner.tsx
@@ -1,7 +1,6 @@
import CardWrapper from '@/components/card-wrapper';
import { SimpleCard } from '@/components/card-wrapper/simple-card';
import MixLineBar from '@/components/echarts/mix-line-bar';
-import { ExportOutlined } from '@ant-design/icons';
import { useIntl } from '@umijs/max';
import { Button } from 'antd';
import dayjs from 'dayjs';
@@ -79,14 +78,14 @@ const RequestTokenInner: React.FC = (props) => {
return (
- }
size="small"
onClick={onExport}
>
{intl.formatMessage({ id: 'common.button.export' })}
-
+ */}
= ({
);
}
diff --git a/src/pages/playground/components/multiple-chat/model-item.tsx b/src/pages/playground/components/multiple-chat/model-item.tsx
index 49fd357e..6c734779 100644
--- a/src/pages/playground/components/multiple-chat/model-item.tsx
+++ b/src/pages/playground/components/multiple-chat/model-item.tsx
@@ -288,7 +288,7 @@ const ModelItem: React.FC = forwardRef((props, ref) => {
>