fix: delete confirm add
This commit is contained in:
@@ -135,6 +135,13 @@ export const List = () => {
|
||||
onClick={(e) => {
|
||||
// agentStore.deleteData(item.id);
|
||||
message.error('Not implemented');
|
||||
// Modal.confirm({
|
||||
// title: 'Delete',
|
||||
// content: 'Are you sure delete this data?',
|
||||
// onOk: () => {
|
||||
// agentStore.deleteData(item.id);
|
||||
// },
|
||||
// });
|
||||
e.stopPropagation();
|
||||
}}
|
||||
icon={<DeleteOutlined />}></Button>
|
||||
|
||||
@@ -2,14 +2,14 @@ import { useShallow } from 'zustand/react/shallow';
|
||||
import { useAiStore } from './store/ai-store';
|
||||
import { CloseOutlined, HistoryOutlined, PlusOutlined } from '@ant-design/icons';
|
||||
import { Button, Dropdown, Form, Input, message, Modal, Tooltip } from 'antd';
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
import { useEffect, useLayoutEffect, useMemo, useState } from 'react';
|
||||
import { TextArea } from '../container/components/TextArea';
|
||||
import clsx from 'clsx';
|
||||
import { query } from '@/modules';
|
||||
import { nanoid } from 'nanoid';
|
||||
import { ChatMessage } from './module/ChatMessage';
|
||||
import { isObjectNull } from '@/utils/is-null';
|
||||
import { useNavigate } from 'react-router';
|
||||
import { useLocation, useNavigate } from 'react-router';
|
||||
const testId = '60aca66b-4be9-4266-9568-6001032c7e13';
|
||||
const NormalMessage = ({ onSend }: { onSend: any }) => {
|
||||
const [message, setMessage] = useState('');
|
||||
@@ -194,6 +194,8 @@ export const AiMoudle = () => {
|
||||
}),
|
||||
);
|
||||
const [noPrompt, setNoPrompt] = useState(false);
|
||||
const [currentPage, setCurrentPage] = useState('');
|
||||
const location = useLocation();
|
||||
useEffect(() => {
|
||||
if (!aiStore.open) {
|
||||
return;
|
||||
@@ -204,7 +206,6 @@ export const AiMoudle = () => {
|
||||
} else {
|
||||
form.setFieldsValue({ inputs: [] });
|
||||
}
|
||||
console.log('formData', aiStore.formData);
|
||||
}, [aiStore.open, aiStore.formData]);
|
||||
useEffect(() => {
|
||||
if (!aiStore.open) {
|
||||
@@ -214,6 +215,12 @@ export const AiMoudle = () => {
|
||||
}
|
||||
}, [aiStore.open]);
|
||||
const { send } = useListenQuery();
|
||||
useLayoutEffect(() => {
|
||||
if (aiStore.open) {
|
||||
aiStore.setOpen(false);
|
||||
}
|
||||
}, [location.pathname]);
|
||||
|
||||
const onSend = () => {
|
||||
const data = form.getFieldsValue();
|
||||
send({ type: 'messages', data: { ...data, root: true } });
|
||||
@@ -221,11 +228,12 @@ export const AiMoudle = () => {
|
||||
const onSendNoPrompt = (value) => {
|
||||
send({ type: 'messages', data: { message: value, root: true } });
|
||||
};
|
||||
|
||||
const inputs = useMemo(() => {
|
||||
if (!aiStore.open) return [];
|
||||
const inputs = form.getFieldValue('inputs');
|
||||
const inputs = aiStore.formData?.inputs || [];
|
||||
return inputs;
|
||||
}, [aiStore.open]);
|
||||
}, [aiStore.open, aiStore.formData]);
|
||||
const isNotShow = inputs?.length === 0 || !inputs;
|
||||
const OnlyNormalMessage = (
|
||||
<Tooltip title='不需要任何预设prompt'>
|
||||
|
||||
@@ -160,8 +160,15 @@ export const AppVersionList = () => {
|
||||
/> */}
|
||||
<Tooltip title='Delete'>
|
||||
<Button
|
||||
onClick={() => {
|
||||
versionStore.deleteData(item.id);
|
||||
onClick={(e) => {
|
||||
Modal.confirm({
|
||||
title: 'Delete',
|
||||
content: 'Are you sure delete this data?',
|
||||
onOk: () => {
|
||||
versionStore.deleteData(item.id);
|
||||
},
|
||||
});
|
||||
e.stopPropagation();
|
||||
}}
|
||||
icon={<DeleteOutlined />}
|
||||
/>
|
||||
|
||||
@@ -157,7 +157,18 @@ export const List = () => {
|
||||
}}></Button>
|
||||
</Tooltip>
|
||||
<Tooltip title={'Delete'}>
|
||||
<Button icon={<DeleteOutlined />} onClick={() => userAppStore.deleteData(item.id)}></Button>
|
||||
<Button
|
||||
icon={<DeleteOutlined />}
|
||||
onClick={(e) => {
|
||||
Modal.confirm({
|
||||
title: 'Delete',
|
||||
content: 'Are you sure delete this data?',
|
||||
onOk: () => {
|
||||
userAppStore.deleteData(item.id);
|
||||
},
|
||||
});
|
||||
e.stopPropagation();
|
||||
}}></Button>
|
||||
</Tooltip>
|
||||
</Button.Group>
|
||||
</div>
|
||||
|
||||
@@ -141,7 +141,13 @@ export const List = () => {
|
||||
<Tooltip title='Delete'>
|
||||
<Button
|
||||
onClick={(e) => {
|
||||
chatPromptStore.deleteData(item.id);
|
||||
Modal.confirm({
|
||||
title: 'Delete',
|
||||
content: 'Are you sure delete this data?',
|
||||
onOk: () => {
|
||||
chatPromptStore.deleteData(item.id);
|
||||
},
|
||||
});
|
||||
e.stopPropagation();
|
||||
}}
|
||||
icon={<DeleteOutlined />}></Button>
|
||||
|
||||
@@ -2,7 +2,7 @@ import { useShallow } from 'zustand/react/shallow';
|
||||
import { useHistoryStore } from '../store/history';
|
||||
import { useEffect } from 'react';
|
||||
import { CardBlank } from '@/components/card/CardBlank';
|
||||
import { Button, Tooltip } from 'antd';
|
||||
import { Button, Modal, Tooltip } from 'antd';
|
||||
import { DeleteOutlined } from '@ant-design/icons';
|
||||
|
||||
export const List = () => {
|
||||
@@ -33,7 +33,18 @@ export const List = () => {
|
||||
<div className='card-footer mt-3'>
|
||||
<Button.Group>
|
||||
<Tooltip title='Delete'>
|
||||
<Button onClick={() => historyStore.deleteData(item.id)} icon={<DeleteOutlined />}></Button>
|
||||
<Button
|
||||
onClick={(e) => {
|
||||
Modal.confirm({
|
||||
title: 'Delete',
|
||||
content: 'Are you sure delete this data?',
|
||||
onOk: () => {
|
||||
historyStore.deleteData(item.id);
|
||||
},
|
||||
});
|
||||
e.stopPropagation();
|
||||
}}
|
||||
icon={<DeleteOutlined />}></Button>
|
||||
</Tooltip>
|
||||
</Button.Group>
|
||||
</div>
|
||||
|
||||
@@ -121,7 +121,18 @@ export const List = () => {
|
||||
icon={<HistoryOutlined />}></Button>
|
||||
</Tooltip>
|
||||
<Tooltip title='Delete'>
|
||||
<Button onClick={() => sessionStore.deleteData(item.id)} icon={<DeleteOutlined />}></Button>
|
||||
<Button
|
||||
onClick={(e) => {
|
||||
Modal.confirm({
|
||||
title: 'Delete',
|
||||
content: 'Are you sure delete this data?',
|
||||
onOk: () => {
|
||||
sessionStore.deleteData(item.id);
|
||||
},
|
||||
});
|
||||
e.stopPropagation();
|
||||
}}
|
||||
icon={<DeleteOutlined />}></Button>
|
||||
</Tooltip>
|
||||
</Button.Group>
|
||||
</div>
|
||||
|
||||
@@ -6,7 +6,7 @@ import { useShallow } from 'zustand/react/shallow';
|
||||
import { Form } from 'antd';
|
||||
import copy from 'copy-to-clipboard';
|
||||
import { useNavigate } from 'react-router';
|
||||
import { EditOutlined, SettingOutlined, LinkOutlined, SaveOutlined, DeleteOutlined, LeftOutlined, MessageOutlined } from '@ant-design/icons';
|
||||
import { EditOutlined, SettingOutlined, LinkOutlined, SaveOutlined, DeleteOutlined, LeftOutlined, MessageOutlined, PlusOutlined } from '@ant-design/icons';
|
||||
import clsx from 'clsx';
|
||||
import { isObjectNull } from '@/utils/is-null';
|
||||
import { CardBlank } from '@/components/card/CardBlank';
|
||||
@@ -124,7 +124,10 @@ export const ContainerList = () => {
|
||||
containerStore.setShowEdit(true);
|
||||
};
|
||||
return (
|
||||
<div className='w-full h-full flex flex-col'>
|
||||
<div className='w-full h-full flex '>
|
||||
<div className='p-2'>
|
||||
<Button onClick={onAdd} icon={<PlusOutlined />}></Button>
|
||||
</div>
|
||||
<div className='flex flex-grow overflow-hidden h-full'>
|
||||
<div className='flex-grow overflow-auto scrollbar bg-gray-100'>
|
||||
<div className='flex flex-wrap gap-x-10 gap-y-4 rounded pt-10 justify-center'>
|
||||
@@ -180,7 +183,14 @@ export const ContainerList = () => {
|
||||
icon={<LinkOutlined />}></Button>
|
||||
<Button
|
||||
onClick={(e) => {
|
||||
containerStore.deleteData(item.id);
|
||||
e.stopPropagation();
|
||||
Modal.confirm({
|
||||
title: 'Delete',
|
||||
content: 'Are you sure delete this data?',
|
||||
onOk: () => {
|
||||
containerStore.deleteData(item.id);
|
||||
},
|
||||
});
|
||||
e.stopPropagation();
|
||||
}}
|
||||
icon={<DeleteOutlined />}></Button>
|
||||
|
||||
@@ -1,38 +1,5 @@
|
||||
import { PlusOutlined } from '@ant-design/icons';
|
||||
import { Button } from 'antd';
|
||||
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(
|
||||
useShallow((state) => {
|
||||
return {
|
||||
setFormData: state.setFormData,
|
||||
setShowEdit: state.setShowEdit,
|
||||
};
|
||||
}),
|
||||
);
|
||||
const location = useLocation();
|
||||
const isEdit = location.pathname.includes('edit/list');
|
||||
return (
|
||||
<LayoutMain
|
||||
title={
|
||||
<>
|
||||
Container
|
||||
<Button
|
||||
className={!isEdit ? 'hidden' : ''}
|
||||
icon={<PlusOutlined />}
|
||||
onClick={() => {
|
||||
console.log('add');
|
||||
containerStore.setFormData({});
|
||||
containerStore.setShowEdit(true);
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
}></LayoutMain>
|
||||
);
|
||||
return <LayoutMain title={<>Container</>}></LayoutMain>;
|
||||
};
|
||||
|
||||
@@ -5,6 +5,7 @@ import path from 'path-browserify';
|
||||
import prettyBytes from 'pretty-bytes';
|
||||
import clsx from 'clsx';
|
||||
import { isObjectNull } from '@/utils/is-null';
|
||||
import { FileOutlined, FolderOutlined } from '@ant-design/icons';
|
||||
export const CardPath = ({ children }: any) => {
|
||||
const userAppStore = useFileStore(
|
||||
useShallow((state) => {
|
||||
@@ -92,7 +93,9 @@ export const List = () => {
|
||||
onClick={() => {
|
||||
onDirectoryClick(item.prefix);
|
||||
}}>
|
||||
<div>Directory: </div>
|
||||
<div>
|
||||
<FolderOutlined />
|
||||
</div>
|
||||
<div>{showPrefix}</div>
|
||||
</div>
|
||||
);
|
||||
@@ -106,6 +109,9 @@ export const List = () => {
|
||||
onClick={() => {
|
||||
userAppStore.getFile(item.name);
|
||||
}}>
|
||||
<div>
|
||||
<FileOutlined />
|
||||
</div>
|
||||
<div>{name}</div>
|
||||
<div>size: {size}</div>
|
||||
</div>
|
||||
|
||||
@@ -156,7 +156,13 @@ export const List = () => {
|
||||
icon={<EditOutlined />}></Button>
|
||||
<Button
|
||||
onClick={(e) => {
|
||||
userStore.deleteData(item.id);
|
||||
Modal.confirm({
|
||||
title: 'Delete',
|
||||
content: 'Are you sure delete this data?',
|
||||
onOk: () => {
|
||||
userStore.deleteData(item.id);
|
||||
},
|
||||
});
|
||||
e.stopPropagation();
|
||||
}}
|
||||
icon={<DeleteOutlined />}></Button>
|
||||
|
||||
@@ -174,8 +174,15 @@ export const List = () => {
|
||||
</Tooltip>
|
||||
<Tooltip title='delete'>
|
||||
<Button
|
||||
onClick={() => {
|
||||
editStore.deleteData(item.id);
|
||||
onClick={(e) => {
|
||||
Modal.confirm({
|
||||
title: 'Delete',
|
||||
content: 'Are you sure delete this data?',
|
||||
onOk: () => {
|
||||
editStore.deleteData(item.id);
|
||||
},
|
||||
});
|
||||
e.stopPropagation();
|
||||
}}
|
||||
icon={<DeleteOutlined />}
|
||||
/>
|
||||
|
||||
@@ -235,7 +235,14 @@ export const List = () => {
|
||||
icon={<EditOutlined />}></Button>
|
||||
<Button
|
||||
onClick={(e) => {
|
||||
promptStore.deleteData(item.id);
|
||||
e.stopPropagation();
|
||||
Modal.confirm({
|
||||
title: 'Delete',
|
||||
content: 'Are you sure delete this data?',
|
||||
onOk: () => {
|
||||
promptStore.deleteData(item.id);
|
||||
},
|
||||
});
|
||||
e.stopPropagation();
|
||||
}}
|
||||
icon={<DeleteOutlined />}></Button>
|
||||
|
||||
@@ -148,7 +148,13 @@ export const List = () => {
|
||||
icon={<EditOutlined />}></Button>
|
||||
<Button
|
||||
onClick={(e) => {
|
||||
userStore.deleteData(item.id);
|
||||
Modal.confirm({
|
||||
title: 'Delete',
|
||||
content: 'Are you sure delete this data?',
|
||||
onOk: () => {
|
||||
userStore.deleteData(item.id);
|
||||
},
|
||||
});
|
||||
e.stopPropagation();
|
||||
}}
|
||||
icon={<DeleteOutlined />}></Button>
|
||||
|
||||
Reference in New Issue
Block a user