feat: translate FileManager #345 (#558)

### What problem does this PR solve?
#345
feat: translate FileManager
feat: batch delete files from the file table in the knowledge base

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2024-04-26 17:22:23 +08:00
committed by GitHub
parent f69ff39fa0
commit eb62c669ae
20 changed files with 212 additions and 69 deletions

View File

@ -1,3 +1,4 @@
import { useTranslate } from '@/hooks/commonHooks';
import { useFetchKnowledgeList } from '@/hooks/knowledgeHook';
import { IModalProps } from '@/interfaces/common';
import { Form, Modal, Select, SelectProps } from 'antd';
@ -8,9 +9,11 @@ const ConnectToKnowledgeModal = ({
hideModal,
onOk,
initialValue,
loading,
}: IModalProps<string[]> & { initialValue: string[] }) => {
const [form] = Form.useForm();
const { list, fetchList } = useFetchKnowledgeList();
const { t } = useTranslate('fileManager');
const options: SelectProps['options'] = list?.map((item) => ({
label: item.name,
@ -32,10 +35,11 @@ const ConnectToKnowledgeModal = ({
return (
<Modal
title="Add to Knowledge Base"
title={t('addToKnowledge')}
open={visible}
onOk={handleOk}
onCancel={hideModal}
confirmLoading={loading}
>
<Form form={form}>
<Form.Item name="knowledgeIds" noStyle>
@ -43,7 +47,7 @@ const ConnectToKnowledgeModal = ({
mode="multiple"
allowClear
style={{ width: '100%' }}
placeholder="Please select"
placeholder={t('pleaseSelect')}
options={options}
/>
</Form.Item>