balibabu
commited on
Commit
·
657bc8a
1
Parent(s):
365a2ed
feat: add UserSetting and set height of MoreIcon to 24px and replace logo (#111)
Browse files* feat: replace logo
* feat: set height of MoreIcon to 24px
* feat: add UserSetting
- web/src/assets/svg/logo.svg +28 -4
- web/src/constants/setting.ts +17 -0
- web/src/layouts/components/header/index.less +4 -0
- web/src/layouts/components/header/index.tsx +7 -3
- web/src/layouts/components/user/index.tsx +1 -1
- web/src/less/mixins.less +4 -0
- web/src/pages/add-knowledge/constant.ts +0 -1
- web/src/pages/chat/chat-container/index.tsx +1 -1
- web/src/pages/knowledge/knowledge-card/index.less +4 -0
- web/src/pages/knowledge/knowledge-card/index.tsx +9 -10
- web/src/pages/user-setting/constants.tsx +16 -0
- web/src/pages/user-setting/index.tsx +14 -0
- web/src/pages/user-setting/setting-model/index.tsx +5 -0
- web/src/pages/user-setting/setting-password/index.tsx +5 -0
- web/src/pages/user-setting/setting-profile/index.tsx +5 -0
- web/src/pages/user-setting/setting-team/index.tsx +5 -0
- web/src/pages/user-setting/sidebar/index.tsx +57 -0
- web/src/routes.ts +23 -0
web/src/assets/svg/logo.svg
CHANGED
|
|
web/src/constants/setting.ts
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
export const UserSettingBaseKey = 'user-setting';
|
2 |
+
|
3 |
+
export enum UserSettingRouteKey {
|
4 |
+
Profile = 'profile',
|
5 |
+
Password = 'password',
|
6 |
+
Model = 'model',
|
7 |
+
Team = 'team',
|
8 |
+
Logout = 'logout',
|
9 |
+
}
|
10 |
+
|
11 |
+
export const UserSettingRouteMap = {
|
12 |
+
[UserSettingRouteKey.Profile]: 'Profile',
|
13 |
+
[UserSettingRouteKey.Password]: 'Password',
|
14 |
+
[UserSettingRouteKey.Model]: 'Model Providers',
|
15 |
+
[UserSettingRouteKey.Team]: 'Team',
|
16 |
+
[UserSettingRouteKey.Logout]: 'Log out',
|
17 |
+
};
|
web/src/layouts/components/header/index.less
CHANGED
@@ -12,6 +12,10 @@
|
|
12 |
border-color: #1677ff;
|
13 |
}
|
14 |
|
|
|
|
|
|
|
|
|
15 |
.appIcon {
|
16 |
vertical-align: middle;
|
17 |
}
|
|
|
12 |
border-color: #1677ff;
|
13 |
}
|
14 |
|
15 |
+
.logoWrapper {
|
16 |
+
.pointerCursor;
|
17 |
+
}
|
18 |
+
|
19 |
.appIcon {
|
20 |
vertical-align: middle;
|
21 |
}
|
web/src/layouts/components/header/index.tsx
CHANGED
@@ -6,7 +6,7 @@ import Toolbar from '../right-toolbar';
|
|
6 |
|
7 |
import styles from './index.less';
|
8 |
|
9 |
-
import { useMemo } from 'react';
|
10 |
import { useLocation, useNavigate } from 'umi';
|
11 |
|
12 |
const { Header } = Layout;
|
@@ -37,6 +37,10 @@ const RagHeader = () => {
|
|
37 |
navigate(path);
|
38 |
};
|
39 |
|
|
|
|
|
|
|
|
|
40 |
return (
|
41 |
<Header
|
42 |
style={{
|
@@ -48,9 +52,9 @@ const RagHeader = () => {
|
|
48 |
height: '72px',
|
49 |
}}
|
50 |
>
|
51 |
-
<Space size={12}>
|
52 |
<Logo className={styles.appIcon}></Logo>
|
53 |
-
<
|
54 |
</Space>
|
55 |
<Space size={[0, 8]} wrap>
|
56 |
<Radio.Group
|
|
|
6 |
|
7 |
import styles from './index.less';
|
8 |
|
9 |
+
import { useCallback, useMemo } from 'react';
|
10 |
import { useLocation, useNavigate } from 'umi';
|
11 |
|
12 |
const { Header } = Layout;
|
|
|
37 |
navigate(path);
|
38 |
};
|
39 |
|
40 |
+
const handleLogoClick = useCallback(() => {
|
41 |
+
navigate('/');
|
42 |
+
}, [navigate]);
|
43 |
+
|
44 |
return (
|
45 |
<Header
|
46 |
style={{
|
|
|
52 |
height: '72px',
|
53 |
}}
|
54 |
>
|
55 |
+
<Space size={12} onClick={handleLogoClick} className={styles.logoWrapper}>
|
56 |
<Logo className={styles.appIcon}></Logo>
|
57 |
+
<span className={styles.appName}>RagFlow</span>
|
58 |
</Space>
|
59 |
<Space size={[0, 8]} wrap>
|
60 |
<Radio.Group
|
web/src/layouts/components/user/index.tsx
CHANGED
@@ -24,7 +24,7 @@ const App: React.FC = () => {
|
|
24 |
}, [logout]);
|
25 |
|
26 |
const toSetting = () => {
|
27 |
-
history.push('/setting');
|
28 |
};
|
29 |
|
30 |
const items: MenuProps['items'] = useMemo(() => {
|
|
|
24 |
}, [logout]);
|
25 |
|
26 |
const toSetting = () => {
|
27 |
+
history.push('/user-setting');
|
28 |
};
|
29 |
|
30 |
const items: MenuProps['items'] = useMemo(() => {
|
web/src/less/mixins.less
CHANGED
@@ -29,3 +29,7 @@
|
|
29 |
background-color: #f2f2f2;
|
30 |
}
|
31 |
}
|
|
|
|
|
|
|
|
|
|
29 |
background-color: #f2f2f2;
|
30 |
}
|
31 |
}
|
32 |
+
|
33 |
+
.pointerCursor() {
|
34 |
+
cursor: pointer;
|
35 |
+
}
|
web/src/pages/add-knowledge/constant.ts
CHANGED
@@ -4,7 +4,6 @@ export const routeMap = {
|
|
4 |
[KnowledgeRouteKey.Dataset]: 'Dataset',
|
5 |
[KnowledgeRouteKey.Testing]: 'Retrieval testing',
|
6 |
[KnowledgeRouteKey.Configuration]: 'Configuration',
|
7 |
-
[KnowledgeRouteKey.TempTesting]: 'Testing',
|
8 |
};
|
9 |
|
10 |
export enum KnowledgeDatasetRouteKey {
|
|
|
4 |
[KnowledgeRouteKey.Dataset]: 'Dataset',
|
5 |
[KnowledgeRouteKey.Testing]: 'Retrieval testing',
|
6 |
[KnowledgeRouteKey.Configuration]: 'Configuration',
|
|
|
7 |
};
|
8 |
|
9 |
export enum KnowledgeDatasetRouteKey {
|
web/src/pages/chat/chat-container/index.tsx
CHANGED
@@ -36,7 +36,7 @@ import styles from './index.less';
|
|
36 |
|
37 |
const reg = /(#{2}\d+\${2})/g;
|
38 |
|
39 |
-
const getChunkIndex = (match: string) => Number(match.slice(2,
|
40 |
|
41 |
const rehypeWrapReference = () => {
|
42 |
return function wrapTextTransform(tree: any) {
|
|
|
36 |
|
37 |
const reg = /(#{2}\d+\${2})/g;
|
38 |
|
39 |
+
const getChunkIndex = (match: string) => Number(match.slice(2, -2));
|
40 |
|
41 |
const rehypeWrapReference = () => {
|
42 |
return function wrapTextTransform(tree: any) {
|
web/src/pages/knowledge/knowledge-card/index.less
CHANGED
@@ -4,6 +4,10 @@
|
|
4 |
flex-direction: column;
|
5 |
justify-content: space-between;
|
6 |
|
|
|
|
|
|
|
|
|
7 |
.content {
|
8 |
display: flex;
|
9 |
justify-content: space-between;
|
|
|
4 |
flex-direction: column;
|
5 |
justify-content: space-between;
|
6 |
|
7 |
+
.delete {
|
8 |
+
height: 24px;
|
9 |
+
}
|
10 |
+
|
11 |
.content {
|
12 |
display: flex;
|
13 |
justify-content: space-between;
|
web/src/pages/knowledge/knowledge-card/index.tsx
CHANGED
@@ -64,17 +64,16 @@ const KnowledgeCard = ({ item }: IProps) => {
|
|
64 |
<div className={styles.container}>
|
65 |
<div className={styles.content}>
|
66 |
<Avatar size={34} icon={<UserOutlined />} src={item.avatar} />
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
>
|
75 |
<MoreIcon />
|
76 |
-
</
|
77 |
-
</
|
78 |
</div>
|
79 |
<div className={styles.titleWrapper}>
|
80 |
<span className={styles.title}>{item.name}</span>
|
|
|
64 |
<div className={styles.container}>
|
65 |
<div className={styles.content}>
|
66 |
<Avatar size={34} icon={<UserOutlined />} src={item.avatar} />
|
67 |
+
<Dropdown
|
68 |
+
menu={{
|
69 |
+
items,
|
70 |
+
onClick: handleDropdownMenuClick,
|
71 |
+
}}
|
72 |
+
>
|
73 |
+
<span className={styles.delete}>
|
|
|
74 |
<MoreIcon />
|
75 |
+
</span>
|
76 |
+
</Dropdown>
|
77 |
</div>
|
78 |
<div className={styles.titleWrapper}>
|
79 |
<span className={styles.title}>{item.name}</span>
|
web/src/pages/user-setting/constants.tsx
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { UserSettingRouteKey } from '@/constants/setting';
|
2 |
+
import {
|
3 |
+
ContainerOutlined,
|
4 |
+
DesktopOutlined,
|
5 |
+
PieChartOutlined,
|
6 |
+
} from '@ant-design/icons';
|
7 |
+
|
8 |
+
export const UserSettingIconMap = {
|
9 |
+
[UserSettingRouteKey.Profile]: <PieChartOutlined />,
|
10 |
+
[UserSettingRouteKey.Password]: <DesktopOutlined />,
|
11 |
+
[UserSettingRouteKey.Model]: <ContainerOutlined />,
|
12 |
+
[UserSettingRouteKey.Team]: <ContainerOutlined />,
|
13 |
+
[UserSettingRouteKey.Logout]: <ContainerOutlined />,
|
14 |
+
};
|
15 |
+
|
16 |
+
export * from '@/constants/setting';
|
web/src/pages/user-setting/index.tsx
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { Flex } from 'antd';
|
2 |
+
import { Outlet } from 'umi';
|
3 |
+
import SideBar from './sidebar';
|
4 |
+
|
5 |
+
const UserSetting = () => {
|
6 |
+
return (
|
7 |
+
<Flex>
|
8 |
+
<SideBar></SideBar>
|
9 |
+
<Outlet></Outlet>
|
10 |
+
</Flex>
|
11 |
+
);
|
12 |
+
};
|
13 |
+
|
14 |
+
export default UserSetting;
|
web/src/pages/user-setting/setting-model/index.tsx
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
const UserSettingModel = () => {
|
2 |
+
return <div>UserSettingModel</div>;
|
3 |
+
};
|
4 |
+
|
5 |
+
export default UserSettingModel;
|
web/src/pages/user-setting/setting-password/index.tsx
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
const UserSettingPassword = () => {
|
2 |
+
return <div>UserSettingPassword</div>;
|
3 |
+
};
|
4 |
+
|
5 |
+
export default UserSettingPassword;
|
web/src/pages/user-setting/setting-profile/index.tsx
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
const UserSettingProfile = () => {
|
2 |
+
return <div>UserSettingProfile</div>;
|
3 |
+
};
|
4 |
+
|
5 |
+
export default UserSettingProfile;
|
web/src/pages/user-setting/setting-team/index.tsx
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
const UserSettingTeam = () => {
|
2 |
+
return <div>UserSettingTeam</div>;
|
3 |
+
};
|
4 |
+
|
5 |
+
export default UserSettingTeam;
|
web/src/pages/user-setting/sidebar/index.tsx
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { useSecondPathName } from '@/hooks/routeHook';
|
2 |
+
import type { MenuProps } from 'antd';
|
3 |
+
import { Menu } from 'antd';
|
4 |
+
import React, { useMemo } from 'react';
|
5 |
+
import { useNavigate } from 'umi';
|
6 |
+
import {
|
7 |
+
UserSettingBaseKey,
|
8 |
+
UserSettingIconMap,
|
9 |
+
UserSettingRouteKey,
|
10 |
+
UserSettingRouteMap,
|
11 |
+
} from '../constants';
|
12 |
+
|
13 |
+
type MenuItem = Required<MenuProps>['items'][number];
|
14 |
+
|
15 |
+
function getItem(
|
16 |
+
label: React.ReactNode,
|
17 |
+
key: React.Key,
|
18 |
+
icon?: React.ReactNode,
|
19 |
+
children?: MenuItem[],
|
20 |
+
type?: 'group',
|
21 |
+
): MenuItem {
|
22 |
+
return {
|
23 |
+
key,
|
24 |
+
icon,
|
25 |
+
children,
|
26 |
+
label,
|
27 |
+
type,
|
28 |
+
} as MenuItem;
|
29 |
+
}
|
30 |
+
|
31 |
+
const items: MenuItem[] = Object.values(UserSettingRouteKey).map((value) =>
|
32 |
+
getItem(UserSettingRouteMap[value], value, UserSettingIconMap[value]),
|
33 |
+
);
|
34 |
+
|
35 |
+
const SideBar = () => {
|
36 |
+
const navigate = useNavigate();
|
37 |
+
const pathName = useSecondPathName();
|
38 |
+
|
39 |
+
const handleMenuClick: MenuProps['onClick'] = ({ key }) => {
|
40 |
+
navigate(`/${UserSettingBaseKey}/${key}`);
|
41 |
+
};
|
42 |
+
|
43 |
+
const selectedKeys = useMemo(() => {
|
44 |
+
return [pathName];
|
45 |
+
}, [pathName]);
|
46 |
+
|
47 |
+
return (
|
48 |
+
<Menu
|
49 |
+
selectedKeys={selectedKeys}
|
50 |
+
mode="inline"
|
51 |
+
items={items}
|
52 |
+
onClick={handleMenuClick}
|
53 |
+
/>
|
54 |
+
);
|
55 |
+
};
|
56 |
+
|
57 |
+
export default SideBar;
|
web/src/routes.ts
CHANGED
@@ -56,6 +56,29 @@ const routes = [
|
|
56 |
path: '/setting',
|
57 |
component: '@/pages/setting',
|
58 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
{
|
60 |
path: '/file',
|
61 |
component: '@/pages/file',
|
|
|
56 |
path: '/setting',
|
57 |
component: '@/pages/setting',
|
58 |
},
|
59 |
+
{
|
60 |
+
path: '/user-setting',
|
61 |
+
component: '@/pages/user-setting',
|
62 |
+
routes: [
|
63 |
+
{ path: '/user-setting', redirect: '/user-setting/profile' },
|
64 |
+
{
|
65 |
+
path: '/user-setting/profile',
|
66 |
+
component: '@/pages/user-setting/setting-profile',
|
67 |
+
},
|
68 |
+
{
|
69 |
+
path: '/user-setting/password',
|
70 |
+
component: '@/pages/user-setting/setting-password',
|
71 |
+
},
|
72 |
+
{
|
73 |
+
path: '/user-setting/model',
|
74 |
+
component: '@/pages/user-setting/setting-model',
|
75 |
+
},
|
76 |
+
{
|
77 |
+
path: '/user-setting/team',
|
78 |
+
component: '@/pages/user-setting/setting-team',
|
79 |
+
},
|
80 |
+
],
|
81 |
+
},
|
82 |
{
|
83 |
path: '/file',
|
84 |
component: '@/pages/file',
|