fix: save chat

This commit is contained in:
archer
2023-07-11 23:39:58 +08:00
parent b2e2f60e0d
commit eb68b35ddf
5 changed files with 112 additions and 2 deletions

View File

@@ -0,0 +1,30 @@
import React from 'react';
import { useChatBox } from '@/components/ChatBox';
import { ChatItemType } from '@/types/chat';
import { Menu, MenuButton, MenuList, MenuItem } from '@chakra-ui/react';
import MyIcon from '@/components/Icon';
const ToolMenu = ({ history }: { history: ChatItemType[] }) => {
const { onExportChat } = useChatBox();
return (
<Menu autoSelect={false} isLazy>
<MenuButton
_hover={{ bg: 'myWhite.600 ' }}
cursor={'pointer'}
borderRadius={'md'}
onClick={(e) => {
e.stopPropagation();
}}
>
<MyIcon name={'more'} w={'14px'} p={2} />
</MenuButton>
<MenuList color={'myGray.700'} minW={`90px !important`}>
<MenuItem onClick={() => onExportChat({ type: 'html', history })}>HTML格式</MenuItem>
<MenuItem onClick={() => onExportChat({ type: 'pdf', history })}>PDF格式</MenuItem>
<MenuItem onClick={() => onExportChat({ type: 'md', history })}>Markdown格式</MenuItem>
</MenuList>
</Menu>
);
};
export default ToolMenu;