mirror of
https://github.com/labring/FastGPT.git
synced 2025-08-06 15:36:21 +00:00
fix: save chat
This commit is contained in:
30
client/src/pages/chat/components/ToolMenu.tsx
Normal file
30
client/src/pages/chat/components/ToolMenu.tsx
Normal 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;
|
@@ -32,12 +32,13 @@ import { useChatStore } from '@/store/chat';
|
||||
import { useLoading } from '@/hooks/useLoading';
|
||||
|
||||
import ChatBox, { type ComponentRef, type StartChatFnProps } from '@/components/ChatBox';
|
||||
import { ChatHistoryItemType } from '@/types/chat';
|
||||
import PageContainer from '@/components/PageContainer';
|
||||
import SideBar from '@/components/SideBar';
|
||||
import ChatHistorySlider from './components/ChatHistorySlider';
|
||||
import SliderApps from './components/SliderApps';
|
||||
import Tag from '@/components/Tag';
|
||||
import { ChatHistoryItemType } from '@/types/chat';
|
||||
import ToolMenu from './components/ToolMenu';
|
||||
|
||||
const Chat = () => {
|
||||
const router = useRouter();
|
||||
@@ -316,6 +317,8 @@ const Chat = () => {
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
<Box flex={1} />
|
||||
<ToolMenu history={chatData.history} />
|
||||
</Flex>
|
||||
{/* chat box */}
|
||||
<Box flex={1}>
|
||||
|
Reference in New Issue
Block a user