feat: add chat history and edit
This commit is contained in:
@@ -10,6 +10,7 @@ import { EditOutlined, SettingOutlined, LinkOutlined, SaveOutlined, DeleteOutlin
|
||||
import clsx from 'clsx';
|
||||
import { isObjectNull } from '@/utils/is-null';
|
||||
import { CardBlank } from '@/components/card/CardBlank';
|
||||
import { useAiStore } from '@/pages/ai-chat';
|
||||
const FormModal = () => {
|
||||
const [form] = Form.useForm();
|
||||
const containerStore = useContainerStore(
|
||||
@@ -103,6 +104,15 @@ export const ContainerList = () => {
|
||||
};
|
||||
}),
|
||||
);
|
||||
const aiStore = useAiStore(
|
||||
useShallow((state) => {
|
||||
return {
|
||||
open: state.open,
|
||||
setOpen: state.setOpen,
|
||||
setData: state.setData,
|
||||
};
|
||||
}),
|
||||
);
|
||||
const [codeEdit, setCodeEdit] = useState(false);
|
||||
const [code, setCode] = useState('');
|
||||
useEffect(() => {
|
||||
@@ -212,7 +222,12 @@ export const ContainerList = () => {
|
||||
icon={<LinkOutlined />}></Button>
|
||||
</Tooltip>
|
||||
<Tooltip title='ai编程'>
|
||||
<Button onClick={(e) => {}} icon={<MessageOutlined />}></Button>
|
||||
<Button
|
||||
onClick={(e) => {
|
||||
aiStore.setOpen(true);
|
||||
// aiStore.setData({ ...containerStore.formData });
|
||||
}}
|
||||
icon={<MessageOutlined />}></Button>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -4,6 +4,8 @@ import { Outlet, useLocation } from 'react-router';
|
||||
import { useContainerStore } from '../store';
|
||||
import { useEffect } from 'react';
|
||||
import { useShallow } from 'zustand/react/shallow';
|
||||
import { AiMoudle } from '@/pages/ai-chat';
|
||||
import { LayoutMain } from '@/modules/layout';
|
||||
|
||||
export const Main = () => {
|
||||
const containerStore = useContainerStore(
|
||||
@@ -17,30 +19,20 @@ export const Main = () => {
|
||||
const location = useLocation();
|
||||
const isEdit = location.pathname.includes('edit/list');
|
||||
return (
|
||||
<div className='flex w-full h-full flex-col'>
|
||||
<div className='layout-menu'>
|
||||
Container
|
||||
<Button
|
||||
className={!isEdit ? 'hidden' : ''}
|
||||
icon={<PlusOutlined />}
|
||||
onClick={() => {
|
||||
console.log('add');
|
||||
containerStore.setFormData({});
|
||||
containerStore.setShowEdit(true);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
className='flex'
|
||||
style={{
|
||||
height: 'calc(100vh - 3rem)',
|
||||
}}>
|
||||
<div className='flex-grow overflow-hidden'>
|
||||
<div className='w-full h-full rounded-lg'>
|
||||
<Outlet />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<LayoutMain
|
||||
title={
|
||||
<>
|
||||
Container
|
||||
<Button
|
||||
className={!isEdit ? 'hidden' : ''}
|
||||
icon={<PlusOutlined />}
|
||||
onClick={() => {
|
||||
console.log('add');
|
||||
containerStore.setFormData({});
|
||||
containerStore.setShowEdit(true);
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
}></LayoutMain>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user