feat: add chat history and session

This commit is contained in:
2024-10-01 00:46:26 +08:00
parent 441b94a061
commit 7d4e6bd299
25 changed files with 1133 additions and 221 deletions

View File

@@ -7,9 +7,10 @@ import { getContainerData } from '@/modules/deck-to-flow/deck';
import { usePanelStore } from '../store';
import { useShallow } from 'zustand/react/shallow';
import { TextArea } from '@/pages/container/components/TextArea';
import { CloseOutlined, SaveOutlined, SelectOutlined } from '@ant-design/icons';
import { CloseOutlined, MessageOutlined, SaveOutlined, SelectOutlined } from '@ant-design/icons';
import { useDeckPageStore } from './deck-store';
import { FormModal } from './Model.tsx';
import { useAiStore } from '@/pages/ai-chat/index.tsx';
export const useListener = (id?: string, opts?: any) => {
const { refresh } = opts || {};
const connected = useStore((state) => state.connected);
@@ -75,6 +76,14 @@ export const Deck = () => {
const deckPageStore = useDeckPageStore();
const { code, setCode } = deckPageStore;
const { selected, setSelected } = deckPageStore;
const aiStore = useAiStore(
useShallow((state) => {
return {
setOpen: state.setOpen,
setKey: state.setKey,
};
}),
);
const panelStore = usePanelStore(
useShallow((state) => {
return {
@@ -281,7 +290,7 @@ export const Deck = () => {
return (
<div className='w-full h-full relative'>
<div className='w-full h-full bg-gray-200 '>
<div className='text-center mb-10 font-bold text-4xl mt-4 flex items-center justify-center group'>
<div className='text-center mb-10 font-bold text-4xl pt-4 flex items-center justify-center group'>
Deck
<Tooltip>
<Button
@@ -313,6 +322,14 @@ export const Deck = () => {
}}
icon={<CloseOutlined />}></Button>
</Tooltip>
<Tooltip title='Ai Chat'>
<Button
onClick={() => {
aiStore.setOpen(true);
aiStore.setKey(location.pathname);
}}
icon={<MessageOutlined />}></Button>
</Tooltip>
<Tooltip title='Save'>
<Button
onClick={() => {