feat: render message reference and add avatar to MessageItem (#73)

* feat: add temporary conversation

* feat: add avatar to MessageItem

* feat: render message reference
This commit is contained in:
balibabu
2024-02-26 18:38:54 +08:00
committed by GitHub
parent 17d751d2d1
commit d1417102b6
15 changed files with 1165 additions and 154 deletions

View File

@ -19,17 +19,20 @@ const RagHeader = () => {
const navigate = useNavigate();
const { pathname } = useLocation();
const tagsData = [
{ path: '/knowledge', name: 'Knowledge Base', icon: KnowledgeBaseIcon },
{ path: '/chat', name: 'Chat', icon: StarIon },
{ path: '/file', name: 'File Management', icon: FileIcon },
];
const tagsData = useMemo(
() => [
{ path: '/knowledge', name: 'Knowledge Base', icon: KnowledgeBaseIcon },
{ path: '/chat', name: 'Chat', icon: StarIon },
{ path: '/file', name: 'File Management', icon: FileIcon },
],
[],
);
const currentPath = useMemo(() => {
return (
tagsData.find((x) => pathname.startsWith(x.path))?.name || 'knowledge'
);
}, [pathname]);
}, [pathname, tagsData]);
const handleChange = (path: string) => {
navigate(path);
@ -48,7 +51,7 @@ const RagHeader = () => {
>
<Space size={12}>
<Logo className={styles.appIcon}></Logo>
<label className={styles.appName}>Infinity flow</label>
<label className={styles.appName}>RagFlow</label>
</Space>
<Space size={[0, 8]} wrap>
<Radio.Group

View File

@ -1,3 +1,4 @@
import { useFetchUserInfo, useSelectUserInfo } from '@/hooks/userSettingHook';
import authorizationUtil from '@/utils/authorizationUtil';
import type { MenuProps } from 'antd';
import { Avatar, Button, Dropdown } from 'antd';
@ -7,6 +8,7 @@ import { history } from 'umi';
const App: React.FC = () => {
const { t } = useTranslation();
const userInfo = useSelectUserInfo();
const logout = () => {
authorizationUtil.removeAll();
@ -36,13 +38,18 @@ const App: React.FC = () => {
),
},
];
}, []);
}, [t]);
useFetchUserInfo();
return (
<Dropdown menu={{ items }} placement="bottomLeft" arrow>
<Avatar
size={32}
src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
src={
userInfo.avatar ??
'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png'
}
/>
</Dropdown>
);