balibabu commited on
Commit
c22c6b5
·
1 Parent(s): 004756c

feat: add hooks for document table and refactor document-related modal (#141)

Browse files

* feat: add hooks for document table

* refactor: refactor document-related modal

web/src/hooks/documentHooks.ts CHANGED
@@ -1,8 +1,10 @@
1
- import { IChunk } from '@/interfaces/database/knowledge';
2
  import { api_host } from '@/utils/api';
3
  import { buildChunkHighlights } from '@/utils/documentUtils';
4
- import { useMemo } from 'react';
5
  import { IHighlight } from 'react-pdf-highlighter';
 
 
6
 
7
  export const useGetDocumentUrl = (documentId: string) => {
8
  const url = useMemo(() => {
@@ -19,3 +21,139 @@ export const useGetChunkHighlights = (selectedChunk: IChunk): IHighlight[] => {
19
 
20
  return highlights;
21
  };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { IChunk, IKnowledgeFile } from '@/interfaces/database/knowledge';
2
  import { api_host } from '@/utils/api';
3
  import { buildChunkHighlights } from '@/utils/documentUtils';
4
+ import { useCallback, useMemo } from 'react';
5
  import { IHighlight } from 'react-pdf-highlighter';
6
+ import { useDispatch, useSelector } from 'umi';
7
+ import { useGetKnowledgeSearchParams } from './routeHook';
8
 
9
  export const useGetDocumentUrl = (documentId: string) => {
10
  const url = useMemo(() => {
 
21
 
22
  return highlights;
23
  };
24
+
25
+ export const useFetchDocumentList = () => {
26
+ const { knowledgeId } = useGetKnowledgeSearchParams();
27
+
28
+ const dispatch = useDispatch();
29
+
30
+ const fetchKfList = useCallback(() => {
31
+ return dispatch<any>({
32
+ type: 'kFModel/getKfList',
33
+ payload: {
34
+ kb_id: knowledgeId,
35
+ },
36
+ });
37
+ }, [dispatch, knowledgeId]);
38
+
39
+ return fetchKfList;
40
+ };
41
+
42
+ export const useSetDocumentStatus = () => {
43
+ const dispatch = useDispatch();
44
+ const { knowledgeId } = useGetKnowledgeSearchParams();
45
+
46
+ const setDocumentStatus = useCallback(
47
+ (status: boolean, documentId: string) => {
48
+ dispatch({
49
+ type: 'kFModel/updateDocumentStatus',
50
+ payload: {
51
+ doc_id: documentId,
52
+ status: Number(status),
53
+ kb_id: knowledgeId,
54
+ },
55
+ });
56
+ },
57
+ [dispatch, knowledgeId],
58
+ );
59
+
60
+ return setDocumentStatus;
61
+ };
62
+
63
+ export const useSelectDocumentList = () => {
64
+ const list: IKnowledgeFile[] = useSelector(
65
+ (state: any) => state.kFModel.data,
66
+ );
67
+ return list;
68
+ };
69
+
70
+ export const useSaveDocumentName = () => {
71
+ const dispatch = useDispatch();
72
+ const { knowledgeId } = useGetKnowledgeSearchParams();
73
+
74
+ const saveName = useCallback(
75
+ (documentId: string, name: string) => {
76
+ return dispatch<any>({
77
+ type: 'kFModel/document_rename',
78
+ payload: {
79
+ doc_id: documentId,
80
+ name: name,
81
+ kb_id: knowledgeId,
82
+ },
83
+ });
84
+ },
85
+ [dispatch, knowledgeId],
86
+ );
87
+
88
+ return saveName;
89
+ };
90
+
91
+ export const useCreateDocument = () => {
92
+ const dispatch = useDispatch();
93
+ const { knowledgeId } = useGetKnowledgeSearchParams();
94
+
95
+ const createDocument = useCallback(
96
+ (name: string) => {
97
+ try {
98
+ return dispatch<any>({
99
+ type: 'kFModel/document_create',
100
+ payload: {
101
+ name,
102
+ kb_id: knowledgeId,
103
+ },
104
+ });
105
+ } catch (errorInfo) {
106
+ console.log('Failed:', errorInfo);
107
+ }
108
+ },
109
+ [dispatch, knowledgeId],
110
+ );
111
+
112
+ return createDocument;
113
+ };
114
+
115
+ export const useSetDocumentParser = () => {
116
+ const dispatch = useDispatch();
117
+ const { knowledgeId } = useGetKnowledgeSearchParams();
118
+
119
+ const setDocumentParser = useCallback(
120
+ (parserId: string, documentId: string) => {
121
+ try {
122
+ return dispatch<any>({
123
+ type: 'kFModel/document_change_parser',
124
+ payload: {
125
+ parser_id: parserId,
126
+ doc_id: documentId,
127
+ kb_id: knowledgeId,
128
+ },
129
+ });
130
+ } catch (errorInfo) {
131
+ console.log('Failed:', errorInfo);
132
+ }
133
+ },
134
+ [dispatch, knowledgeId],
135
+ );
136
+
137
+ return setDocumentParser;
138
+ };
139
+
140
+ export const useRemoveDocument = (documentId: string) => {
141
+ const dispatch = useDispatch();
142
+ const { knowledgeId } = useGetKnowledgeSearchParams();
143
+
144
+ const removeDocument = useCallback(() => {
145
+ try {
146
+ return dispatch<any>({
147
+ type: 'kFModel/document_rm',
148
+ payload: {
149
+ doc_id: documentId,
150
+ kb_id: knowledgeId,
151
+ },
152
+ });
153
+ } catch (errorInfo) {
154
+ console.log('Failed:', errorInfo);
155
+ }
156
+ }, [dispatch, knowledgeId, documentId]);
157
+
158
+ return removeDocument;
159
+ };
web/src/pages/add-knowledge/components/knowledge-file/{segmentSetModal.tsx → chunk-method-modal.tsx} RENAMED
@@ -1,86 +1,69 @@
1
- import {
2
- useFetchTenantInfo,
3
- useSelectParserList,
4
- } from '@/hooks/userSettingHook';
5
- import { Modal, Space, Tag } from 'antd';
6
- import React, { useEffect, useState } from 'react';
7
- import { useDispatch, useSelector } from 'umi';
8
- import styles from './index.less';
9
- const { CheckableTag } = Tag;
10
- interface kFProps {
11
- getKfList: () => void;
12
- parser_id: string;
13
- doc_id: string;
14
- }
15
- const SegmentSetModal: React.FC<kFProps> = ({
16
- getKfList,
17
- parser_id,
18
- doc_id,
19
- }) => {
20
- const dispatch = useDispatch();
21
- const kFModel = useSelector((state: any) => state.kFModel);
22
- const [selectedTag, setSelectedTag] = useState('');
23
- const { isShowSegmentSetModal } = kFModel;
24
- const parserList = useSelectParserList();
25
-
26
- useFetchTenantInfo();
27
-
28
- useEffect(() => {
29
- setSelectedTag(parser_id);
30
- }, [parser_id]);
31
-
32
- const handleCancel = () => {
33
- dispatch({
34
- type: 'kFModel/updateState',
35
- payload: {
36
- isShowSegmentSetModal: false,
37
- },
38
- });
39
- };
40
-
41
- const handleOk = async () => {
42
- const retcode = await dispatch<any>({
43
- type: 'kFModel/document_change_parser',
44
- payload: {
45
- parser_id: selectedTag,
46
- doc_id,
47
- },
48
- });
49
-
50
- if (retcode === 0 && getKfList) {
51
- getKfList();
52
- handleCancel();
53
- }
54
- };
55
-
56
- const handleChange = (tag: string, checked: boolean) => {
57
- const nextSelectedTag = checked ? tag : selectedTag;
58
- setSelectedTag(nextSelectedTag);
59
- };
60
-
61
- return (
62
- <Modal
63
- title="Category"
64
- open={isShowSegmentSetModal}
65
- onOk={handleOk}
66
- onCancel={handleCancel}
67
- >
68
- <Space size={[0, 8]} wrap>
69
- <div className={styles.tags}>
70
- {parserList.map((x) => {
71
- return (
72
- <CheckableTag
73
- key={x.value}
74
- checked={selectedTag === x.value}
75
- onChange={(checked) => handleChange(x.value, checked)}
76
- >
77
- {x.label}
78
- </CheckableTag>
79
- );
80
- })}
81
- </div>
82
- </Space>
83
- </Modal>
84
- );
85
- };
86
- export default SegmentSetModal;
 
1
+ import { IModalManagerChildrenProps } from '@/components/modal-manager';
2
+ import {
3
+ useFetchTenantInfo,
4
+ useSelectParserList,
5
+ } from '@/hooks/userSettingHook';
6
+ import { Modal, Space, Tag } from 'antd';
7
+ import React, { useEffect, useState } from 'react';
8
+
9
+ import styles from './index.less';
10
+
11
+ const { CheckableTag } = Tag;
12
+
13
+ interface IProps extends Omit<IModalManagerChildrenProps, 'showModal'> {
14
+ loading: boolean;
15
+ onOk: (parserId: string) => void;
16
+ showModal?(): void;
17
+ parser_id: string;
18
+ }
19
+
20
+ const ChunkMethodModal: React.FC<IProps> = ({
21
+ parser_id,
22
+ onOk,
23
+ hideModal,
24
+ visible,
25
+ }) => {
26
+ const [selectedTag, setSelectedTag] = useState('');
27
+ const parserList = useSelectParserList();
28
+
29
+ useFetchTenantInfo();
30
+
31
+ useEffect(() => {
32
+ setSelectedTag(parser_id);
33
+ }, [parser_id]);
34
+
35
+ const handleOk = async () => {
36
+ onOk(selectedTag);
37
+ };
38
+
39
+ const handleChange = (tag: string, checked: boolean) => {
40
+ const nextSelectedTag = checked ? tag : selectedTag;
41
+ setSelectedTag(nextSelectedTag);
42
+ };
43
+
44
+ return (
45
+ <Modal
46
+ title="Chunk Method"
47
+ open={visible}
48
+ onOk={handleOk}
49
+ onCancel={hideModal}
50
+ >
51
+ <Space size={[0, 8]} wrap>
52
+ <div className={styles.tags}>
53
+ {parserList.map((x) => {
54
+ return (
55
+ <CheckableTag
56
+ key={x.value}
57
+ checked={selectedTag === x.value}
58
+ onChange={(checked) => handleChange(x.value, checked)}
59
+ >
60
+ {x.label}
61
+ </CheckableTag>
62
+ );
63
+ })}
64
+ </div>
65
+ </Space>
66
+ </Modal>
67
+ );
68
+ };
69
+ export default ChunkMethodModal;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
web/src/pages/add-knowledge/components/knowledge-file/{createEFileModal.tsx → create-file-modal.tsx} RENAMED
@@ -1,78 +1,49 @@
1
- import { Form, Input, Modal } from 'antd';
2
- import React from 'react';
3
- import { useTranslation } from 'react-i18next';
4
- import { useDispatch, useSelector } from 'umi';
5
-
6
- type FieldType = {
7
- name?: string;
8
- };
9
- interface kFProps {
10
- getKfList: () => void;
11
- kb_id: string;
12
- }
13
-
14
- const FileCreatingModal: React.FC<kFProps> = ({ getKfList, kb_id }) => {
15
- const dispatch = useDispatch();
16
- const [form] = Form.useForm();
17
- const kFModel = useSelector((state: any) => state.kFModel);
18
- const { isShowCEFwModal } = kFModel;
19
- const { t } = useTranslation();
20
-
21
- const handleCancel = () => {
22
- dispatch({
23
- type: 'kFModel/updateState',
24
- payload: {
25
- isShowCEFwModal: false,
26
- },
27
- });
28
- };
29
-
30
- const createDocument = async () => {
31
- try {
32
- const values = await form.validateFields();
33
- const retcode = await dispatch<any>({
34
- type: 'kFModel/document_create',
35
- payload: {
36
- name: values.name,
37
- kb_id,
38
- },
39
- });
40
- if (retcode === 0) {
41
- getKfList && getKfList();
42
- }
43
- } catch (errorInfo) {
44
- console.log('Failed:', errorInfo);
45
- }
46
- };
47
-
48
- const handleOk = async () => {
49
- createDocument();
50
- };
51
-
52
- return (
53
- <Modal
54
- title="File Name"
55
- open={isShowCEFwModal}
56
- onOk={handleOk}
57
- onCancel={handleCancel}
58
- >
59
- <Form
60
- form={form}
61
- name="validateOnly"
62
- labelCol={{ span: 4 }}
63
- wrapperCol={{ span: 20 }}
64
- style={{ maxWidth: 600 }}
65
- autoComplete="off"
66
- >
67
- <Form.Item<FieldType>
68
- label="File Name"
69
- name="name"
70
- rules={[{ required: true, message: 'Please input name!' }]}
71
- >
72
- <Input />
73
- </Form.Item>
74
- </Form>
75
- </Modal>
76
- );
77
- };
78
- export default FileCreatingModal;
 
1
+ import { IModalManagerChildrenProps } from '@/components/modal-manager';
2
+ import { Form, Input, Modal } from 'antd';
3
+ import React from 'react';
4
+
5
+ type FieldType = {
6
+ name?: string;
7
+ };
8
+
9
+ interface IProps extends Omit<IModalManagerChildrenProps, 'showModal'> {
10
+ loading: boolean;
11
+ onOk: (name: string) => void;
12
+ showModal?(): void;
13
+ }
14
+
15
+ const FileCreatingModal: React.FC<IProps> = ({ visible, hideModal, onOk }) => {
16
+ const [form] = Form.useForm();
17
+
18
+ const handleOk = async () => {
19
+ const values = await form.validateFields();
20
+ onOk(values.name);
21
+ };
22
+
23
+ return (
24
+ <Modal
25
+ title="File Name"
26
+ open={visible}
27
+ onOk={handleOk}
28
+ onCancel={hideModal}
29
+ >
30
+ <Form
31
+ form={form}
32
+ name="validateOnly"
33
+ labelCol={{ span: 4 }}
34
+ wrapperCol={{ span: 20 }}
35
+ style={{ maxWidth: 600 }}
36
+ autoComplete="off"
37
+ >
38
+ <Form.Item<FieldType>
39
+ label="File Name"
40
+ name="name"
41
+ rules={[{ required: true, message: 'Please input name!' }]}
42
+ >
43
+ <Input />
44
+ </Form.Item>
45
+ </Form>
46
+ </Modal>
47
+ );
48
+ };
49
+ export default FileCreatingModal;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
web/src/pages/add-knowledge/components/knowledge-file/hooks.ts ADDED
@@ -0,0 +1,241 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useSetModalState } from '@/hooks/commonHooks';
2
+ import {
3
+ useCreateDocument,
4
+ useFetchDocumentList,
5
+ useSaveDocumentName,
6
+ useSetDocumentParser,
7
+ } from '@/hooks/documentHooks';
8
+ import { useGetKnowledgeSearchParams } from '@/hooks/routeHook';
9
+ import { useOneNamespaceEffectsLoading } from '@/hooks/storeHooks';
10
+ import { useFetchTenantInfo } from '@/hooks/userSettingHook';
11
+ import { Pagination } from '@/interfaces/common';
12
+ import { IKnowledgeFile } from '@/interfaces/database/knowledge';
13
+ import { PaginationProps } from 'antd';
14
+ import { useCallback, useEffect, useMemo, useState } from 'react';
15
+ import { useDispatch, useNavigate, useSelector } from 'umi';
16
+ import { KnowledgeRouteKey } from './constant';
17
+
18
+ export const useFetchDocumentListOnMount = () => {
19
+ const { knowledgeId } = useGetKnowledgeSearchParams();
20
+ const fetchDocumentList = useFetchDocumentList();
21
+ const dispatch = useDispatch();
22
+
23
+ useFetchTenantInfo();
24
+
25
+ useEffect(() => {
26
+ if (knowledgeId) {
27
+ fetchDocumentList();
28
+ dispatch({
29
+ type: 'kFModel/pollGetDocumentList-start',
30
+ payload: knowledgeId,
31
+ });
32
+ }
33
+ return () => {
34
+ dispatch({
35
+ type: 'kFModel/pollGetDocumentList-stop',
36
+ });
37
+ };
38
+ }, [knowledgeId, dispatch, fetchDocumentList]);
39
+
40
+ return { fetchDocumentList };
41
+ };
42
+
43
+ export const useGetPagination = (fetchDocumentList: () => void) => {
44
+ const dispatch = useDispatch();
45
+ const kFModel = useSelector((state: any) => state.kFModel);
46
+
47
+ const setPagination = useCallback(
48
+ (pageNumber = 1, pageSize?: number) => {
49
+ const pagination: Pagination = {
50
+ current: pageNumber,
51
+ } as Pagination;
52
+ if (pageSize) {
53
+ pagination.pageSize = pageSize;
54
+ }
55
+ dispatch({
56
+ type: 'kFModel/setPagination',
57
+ payload: pagination,
58
+ });
59
+ },
60
+ [dispatch],
61
+ );
62
+
63
+ const onPageChange: PaginationProps['onChange'] = useCallback(
64
+ (pageNumber: number, pageSize: number) => {
65
+ setPagination(pageNumber, pageSize);
66
+ fetchDocumentList();
67
+ },
68
+ [fetchDocumentList, setPagination],
69
+ );
70
+
71
+ const pagination: PaginationProps = useMemo(() => {
72
+ return {
73
+ showQuickJumper: true,
74
+ total: kFModel.total,
75
+ showSizeChanger: true,
76
+ current: kFModel.pagination.currentPage,
77
+ pageSize: kFModel.pagination.pageSize,
78
+ pageSizeOptions: [1, 2, 10, 20, 50, 100],
79
+ onChange: onPageChange,
80
+ };
81
+ }, [kFModel, onPageChange]);
82
+
83
+ return {
84
+ pagination,
85
+ setPagination,
86
+ total: kFModel.total,
87
+ searchString: kFModel.searchString,
88
+ };
89
+ };
90
+
91
+ export const useSelectDocumentListLoading = () => {
92
+ return useOneNamespaceEffectsLoading('kFModel', [
93
+ 'getKfList',
94
+ 'updateDocumentStatus',
95
+ ]);
96
+ };
97
+
98
+ export const useNavigateToOtherPage = () => {
99
+ const navigate = useNavigate();
100
+ const { knowledgeId } = useGetKnowledgeSearchParams();
101
+
102
+ const linkToUploadPage = useCallback(() => {
103
+ navigate(`/knowledge/dataset/upload?id=${knowledgeId}`);
104
+ }, [navigate, knowledgeId]);
105
+
106
+ const toChunk = useCallback(
107
+ (id: string) => {
108
+ navigate(
109
+ `/knowledge/${KnowledgeRouteKey.Dataset}/chunk?id=${knowledgeId}&doc_id=${id}`,
110
+ );
111
+ },
112
+ [navigate, knowledgeId],
113
+ );
114
+
115
+ return { linkToUploadPage, toChunk };
116
+ };
117
+
118
+ export const useHandleSearchChange = (setPagination: () => void) => {
119
+ const dispatch = useDispatch();
120
+ const { knowledgeId } = useGetKnowledgeSearchParams();
121
+
122
+ const throttledGetDocumentList = useCallback(() => {
123
+ dispatch({
124
+ type: 'kFModel/throttledGetDocumentList',
125
+ payload: knowledgeId,
126
+ });
127
+ }, [dispatch, knowledgeId]);
128
+
129
+ const handleInputChange = useCallback(
130
+ (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {
131
+ const value = e.target.value;
132
+ dispatch({ type: 'kFModel/setSearchString', payload: value });
133
+ setPagination();
134
+ throttledGetDocumentList();
135
+ },
136
+ [setPagination, throttledGetDocumentList, dispatch],
137
+ );
138
+
139
+ return { handleInputChange };
140
+ };
141
+
142
+ export const useSetSelectedRecord = () => {
143
+ const [currentRecord, setCurrentRecord] = useState<IKnowledgeFile>(
144
+ {} as IKnowledgeFile,
145
+ );
146
+
147
+ const setRecord = (record: IKnowledgeFile) => () => {
148
+ setCurrentRecord(record);
149
+ };
150
+
151
+ return { currentRecord, setRecord };
152
+ };
153
+
154
+ export const useRenameDocument = (documentId: string) => {
155
+ const saveName = useSaveDocumentName();
156
+
157
+ const {
158
+ visible: renameVisible,
159
+ hideModal: hideRenameModal,
160
+ showModal: showRenameModal,
161
+ } = useSetModalState();
162
+ const loading = useOneNamespaceEffectsLoading('kFModel', ['document_rename']);
163
+
164
+ const onRenameOk = useCallback(
165
+ async (name: string) => {
166
+ const ret = await saveName(documentId, name);
167
+ if (ret === 0) {
168
+ hideRenameModal();
169
+ }
170
+ },
171
+ [hideRenameModal, saveName, documentId],
172
+ );
173
+
174
+ return {
175
+ renameLoading: loading,
176
+ onRenameOk,
177
+ renameVisible,
178
+ hideRenameModal,
179
+ showRenameModal,
180
+ };
181
+ };
182
+
183
+ export const useCreateEmptyDocument = () => {
184
+ const createDocument = useCreateDocument();
185
+
186
+ const {
187
+ visible: createVisible,
188
+ hideModal: hideCreateModal,
189
+ showModal: showCreateModal,
190
+ } = useSetModalState();
191
+ const loading = useOneNamespaceEffectsLoading('kFModel', ['document_create']);
192
+
193
+ const onCreateOk = useCallback(
194
+ async (name: string) => {
195
+ const ret = await createDocument(name);
196
+ if (ret === 0) {
197
+ hideCreateModal();
198
+ }
199
+ },
200
+ [hideCreateModal, createDocument],
201
+ );
202
+
203
+ return {
204
+ createLoading: loading,
205
+ onCreateOk,
206
+ createVisible,
207
+ hideCreateModal,
208
+ showCreateModal,
209
+ };
210
+ };
211
+
212
+ export const useChangeDocumentParser = (documentId: string) => {
213
+ const setDocumentParser = useSetDocumentParser();
214
+
215
+ const {
216
+ visible: changeParserVisible,
217
+ hideModal: hideChangeParserModal,
218
+ showModal: showChangeParserModal,
219
+ } = useSetModalState();
220
+ const loading = useOneNamespaceEffectsLoading('kFModel', [
221
+ 'document_change_parser',
222
+ ]);
223
+
224
+ const onChangeParserOk = useCallback(
225
+ async (parserId: string) => {
226
+ const ret = await setDocumentParser(parserId, documentId);
227
+ if (ret === 0) {
228
+ hideChangeParserModal();
229
+ }
230
+ },
231
+ [hideChangeParserModal, setDocumentParser, documentId],
232
+ );
233
+
234
+ return {
235
+ changeParserLoading: loading,
236
+ onChangeParserOk,
237
+ changeParserVisible,
238
+ hideChangeParserModal,
239
+ showChangeParserModal,
240
+ };
241
+ };
web/src/pages/add-knowledge/components/knowledge-file/index.tsx CHANGED
@@ -1,12 +1,9 @@
1
- import { KnowledgeRouteKey } from '@/constants/knowledge';
2
- import { useKnowledgeBaseId } from '@/hooks/knowledgeHook';
3
  import {
4
- useFetchTenantInfo,
5
- useSelectParserList,
6
- } from '@/hooks/userSettingHook';
7
- import { Pagination } from '@/interfaces/common';
8
  import { IKnowledgeFile } from '@/interfaces/database/knowledge';
9
- import { getOneNamespaceEffectsLoading } from '@/utils/storeUtil';
10
  import {
11
  FileOutlined,
12
  FileTextOutlined,
@@ -25,133 +22,57 @@ import {
25
  Tag,
26
  } from 'antd';
27
  import type { ColumnsType } from 'antd/es/table';
28
- import { PaginationProps } from 'antd/lib';
29
- import React, { useCallback, useEffect, useMemo, useState } from 'react';
30
- import { useDispatch, useNavigate, useSelector } from 'umi';
31
- import CreateEPModal from './createEFileModal';
32
- import styles from './index.less';
 
 
 
 
 
 
 
 
33
  import ParsingActionCell from './parsing-action-cell';
34
  import ParsingStatusCell from './parsing-status-cell';
35
  import RenameModal from './rename-modal';
36
- import SegmentSetModal from './segmentSetModal';
37
 
38
- const KnowledgeFile = () => {
39
- const dispatch = useDispatch();
40
- const kFModel = useSelector((state: any) => state.kFModel);
41
- const effects = useSelector((state: any) => state.loading.effects);
42
- const { data, total } = kFModel;
43
- const knowledgeBaseId = useKnowledgeBaseId();
44
 
45
- const loading = getOneNamespaceEffectsLoading('kFModel', effects, [
46
- 'getKfList',
47
- 'updateDocumentStatus',
48
- ]);
49
- const [doc_id, setDocId] = useState('0');
50
- const [parser_id, setParserId] = useState('0');
51
- let navigate = useNavigate();
52
  const parserList = useSelectParserList();
53
-
54
- const getKfList = useCallback(() => {
55
- const payload = {
56
- kb_id: knowledgeBaseId,
57
- };
58
-
59
- dispatch({
60
- type: 'kFModel/getKfList',
61
- payload,
62
- });
63
- }, [dispatch, knowledgeBaseId]);
64
-
65
- const throttledGetDocumentList = () => {
66
- dispatch({
67
- type: 'kFModel/throttledGetDocumentList',
68
- payload: knowledgeBaseId,
69
- });
70
- };
71
-
72
- const setPagination = useCallback(
73
- (pageNumber = 1, pageSize?: number) => {
74
- const pagination: Pagination = {
75
- current: pageNumber,
76
- } as Pagination;
77
- if (pageSize) {
78
- pagination.pageSize = pageSize;
79
- }
80
- dispatch({
81
- type: 'kFModel/setPagination',
82
- payload: pagination,
83
- });
84
- },
85
- [dispatch],
86
- );
87
-
88
- const onPageChange: PaginationProps['onChange'] = useCallback(
89
- (pageNumber: number, pageSize: number) => {
90
- setPagination(pageNumber, pageSize);
91
- getKfList();
92
- },
93
- [getKfList, setPagination],
94
- );
95
-
96
- const pagination: PaginationProps = useMemo(() => {
97
- return {
98
- showQuickJumper: true,
99
- total,
100
- showSizeChanger: true,
101
- current: kFModel.pagination.currentPage,
102
- pageSize: kFModel.pagination.pageSize,
103
- pageSizeOptions: [1, 2, 10, 20, 50, 100],
104
- onChange: onPageChange,
105
- };
106
- }, [total, kFModel.pagination, onPageChange]);
107
-
108
- useEffect(() => {
109
- if (knowledgeBaseId) {
110
- getKfList();
111
- dispatch({
112
- type: 'kFModel/pollGetDocumentList-start',
113
- payload: knowledgeBaseId,
114
- });
115
- }
116
- return () => {
117
- dispatch({
118
- type: 'kFModel/pollGetDocumentList-stop',
119
- });
120
- };
121
- }, [knowledgeBaseId, dispatch, getKfList]);
122
-
123
- const handleInputChange = (
124
- e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>,
125
- ) => {
126
- const value = e.target.value;
127
- dispatch({ type: 'kFModel/setSearchString', payload: value });
128
- setPagination();
129
- throttledGetDocumentList();
130
- };
131
-
132
- const onChangeStatus = (e: boolean, doc_id: string) => {
133
- dispatch({
134
- type: 'kFModel/updateDocumentStatus',
135
- payload: {
136
- doc_id,
137
- status: Number(e),
138
- kb_id: knowledgeBaseId,
139
- },
140
- });
141
- };
142
-
143
- const showCEFModal = useCallback(() => {
144
- dispatch({
145
- type: 'kFModel/updateState',
146
- payload: {
147
- isShowCEFwModal: true,
148
- },
149
- });
150
- }, [dispatch]);
151
-
152
- const linkToUploadPage = useCallback(() => {
153
- navigate(`/knowledge/dataset/upload?id=${knowledgeBaseId}`);
154
- }, [navigate, knowledgeBaseId]);
155
 
156
  const actionItems: MenuProps['items'] = useMemo(() => {
157
  return [
@@ -172,7 +93,7 @@ const KnowledgeFile = () => {
172
  { type: 'divider' },
173
  {
174
  key: '2',
175
- onClick: showCEFModal,
176
  label: (
177
  <div>
178
  <Button type="link">
@@ -184,18 +105,7 @@ const KnowledgeFile = () => {
184
  // disabled: true,
185
  },
186
  ];
187
- }, [linkToUploadPage, showCEFModal]);
188
-
189
- const toChunk = (id: string) => {
190
- navigate(
191
- `/knowledge/${KnowledgeRouteKey.Dataset}/chunk?id=${knowledgeBaseId}&doc_id=${id}`,
192
- );
193
- };
194
-
195
- const setDocumentAndParserId = (record: IKnowledgeFile) => () => {
196
- setDocId(record.id);
197
- setParserId(record.parser_id);
198
- };
199
 
200
  const columns: ColumnsType<IKnowledgeFile> = [
201
  {
@@ -255,8 +165,12 @@ const KnowledgeFile = () => {
255
  key: 'action',
256
  render: (_, record) => (
257
  <ParsingActionCell
258
- knowledgeBaseId={knowledgeBaseId}
259
- setDocumentAndParserId={setDocumentAndParserId(record)}
 
 
 
 
260
  record={record}
261
  ></ParsingActionCell>
262
  ),
@@ -268,8 +182,6 @@ const KnowledgeFile = () => {
268
  className: `${styles.column}`,
269
  }));
270
 
271
- useFetchTenantInfo();
272
-
273
  return (
274
  <div className={styles.datasetWrapper}>
275
  <h3>Dataset</h3>
@@ -283,7 +195,7 @@ const KnowledgeFile = () => {
283
  <Space>
284
  <Input
285
  placeholder="Seach your files"
286
- value={kFModel.searchString}
287
  style={{ width: 220 }}
288
  allowClear
289
  onChange={handleInputChange}
@@ -305,13 +217,26 @@ const KnowledgeFile = () => {
305
  pagination={pagination}
306
  scroll={{ scrollToFirstRowOnChange: true, x: 1300, y: 'fill' }}
307
  />
308
- <CreateEPModal getKfList={getKfList} kb_id={knowledgeBaseId} />
309
- <SegmentSetModal
310
- getKfList={getKfList}
311
- parser_id={parser_id}
312
- doc_id={doc_id}
 
 
 
 
 
 
 
313
  />
314
- <RenameModal></RenameModal>
 
 
 
 
 
 
315
  </div>
316
  );
317
  };
 
 
 
1
  import {
2
+ useSelectDocumentList,
3
+ useSetDocumentStatus,
4
+ } from '@/hooks/documentHooks';
5
+ import { useSelectParserList } from '@/hooks/userSettingHook';
6
  import { IKnowledgeFile } from '@/interfaces/database/knowledge';
 
7
  import {
8
  FileOutlined,
9
  FileTextOutlined,
 
22
  Tag,
23
  } from 'antd';
24
  import type { ColumnsType } from 'antd/es/table';
25
+ import { useMemo } from 'react';
26
+ import ChunkMethodModal from './chunk-method-modal';
27
+ import CreateFileModal from './create-file-modal';
28
+ import {
29
+ useChangeDocumentParser,
30
+ useCreateEmptyDocument,
31
+ useFetchDocumentListOnMount,
32
+ useGetPagination,
33
+ useHandleSearchChange,
34
+ useNavigateToOtherPage,
35
+ useRenameDocument,
36
+ useSetSelectedRecord,
37
+ } from './hooks';
38
  import ParsingActionCell from './parsing-action-cell';
39
  import ParsingStatusCell from './parsing-status-cell';
40
  import RenameModal from './rename-modal';
 
41
 
42
+ import styles from './index.less';
 
 
 
 
 
43
 
44
+ const KnowledgeFile = () => {
45
+ const data = useSelectDocumentList();
46
+ const { fetchDocumentList } = useFetchDocumentListOnMount();
 
 
 
 
47
  const parserList = useSelectParserList();
48
+ const { pagination, setPagination, total, searchString } =
49
+ useGetPagination(fetchDocumentList);
50
+ const onChangeStatus = useSetDocumentStatus();
51
+ const { linkToUploadPage, toChunk } = useNavigateToOtherPage();
52
+
53
+ const { handleInputChange } = useHandleSearchChange(setPagination);
54
+ const { currentRecord, setRecord } = useSetSelectedRecord();
55
+ const {
56
+ renameLoading,
57
+ onRenameOk,
58
+ renameVisible,
59
+ hideRenameModal,
60
+ showRenameModal,
61
+ } = useRenameDocument(currentRecord.id);
62
+ const {
63
+ createLoading,
64
+ onCreateOk,
65
+ createVisible,
66
+ hideCreateModal,
67
+ showCreateModal,
68
+ } = useCreateEmptyDocument();
69
+ const {
70
+ changeParserLoading,
71
+ onChangeParserOk,
72
+ changeParserVisible,
73
+ hideChangeParserModal,
74
+ showChangeParserModal,
75
+ } = useChangeDocumentParser(currentRecord.id);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
 
77
  const actionItems: MenuProps['items'] = useMemo(() => {
78
  return [
 
93
  { type: 'divider' },
94
  {
95
  key: '2',
96
+ onClick: showCreateModal,
97
  label: (
98
  <div>
99
  <Button type="link">
 
105
  // disabled: true,
106
  },
107
  ];
108
+ }, [linkToUploadPage, showCreateModal]);
 
 
 
 
 
 
 
 
 
 
 
109
 
110
  const columns: ColumnsType<IKnowledgeFile> = [
111
  {
 
165
  key: 'action',
166
  render: (_, record) => (
167
  <ParsingActionCell
168
+ setDocumentAndParserId={setRecord(record)}
169
+ showRenameModal={() => {
170
+ setRecord(record)();
171
+ showRenameModal();
172
+ }}
173
+ showChangeParserModal={showChangeParserModal}
174
  record={record}
175
  ></ParsingActionCell>
176
  ),
 
182
  className: `${styles.column}`,
183
  }));
184
 
 
 
185
  return (
186
  <div className={styles.datasetWrapper}>
187
  <h3>Dataset</h3>
 
195
  <Space>
196
  <Input
197
  placeholder="Seach your files"
198
+ value={searchString}
199
  style={{ width: 220 }}
200
  allowClear
201
  onChange={handleInputChange}
 
217
  pagination={pagination}
218
  scroll={{ scrollToFirstRowOnChange: true, x: 1300, y: 'fill' }}
219
  />
220
+ <CreateFileModal
221
+ visible={createVisible}
222
+ hideModal={hideCreateModal}
223
+ loading={createLoading}
224
+ onOk={onCreateOk}
225
+ />
226
+ <ChunkMethodModal
227
+ parser_id={currentRecord.parser_id}
228
+ onOk={onChangeParserOk}
229
+ visible={changeParserVisible}
230
+ hideModal={hideChangeParserModal}
231
+ loading={changeParserLoading}
232
  />
233
+ <RenameModal
234
+ visible={renameVisible}
235
+ onOk={onRenameOk}
236
+ loading={renameLoading}
237
+ hideModal={hideRenameModal}
238
+ initialName={currentRecord.name}
239
+ ></RenameModal>
240
  </div>
241
  );
242
  };
web/src/pages/add-knowledge/components/knowledge-file/model.ts CHANGED
@@ -164,6 +164,10 @@ const model: DvaModel<KFModelState> = {
164
  const { data } = yield call(kbService.document_create, payload);
165
  const { retcode } = data;
166
  if (retcode === 0) {
 
 
 
 
167
  put({
168
  type: 'kFModel/updateState',
169
  payload: {
@@ -192,9 +196,16 @@ const model: DvaModel<KFModelState> = {
192
  return retcode;
193
  },
194
  *document_change_parser({ payload = {} }, { call, put }) {
195
- const { data } = yield call(kbService.document_change_parser, payload);
 
 
 
196
  const { retcode } = data;
197
  if (retcode === 0) {
 
 
 
 
198
  put({
199
  type: 'updateState',
200
  payload: {
 
164
  const { data } = yield call(kbService.document_create, payload);
165
  const { retcode } = data;
166
  if (retcode === 0) {
167
+ put({
168
+ type: 'getKfList',
169
+ payload: { kb_id: payload.kb_id },
170
+ });
171
  put({
172
  type: 'kFModel/updateState',
173
  payload: {
 
196
  return retcode;
197
  },
198
  *document_change_parser({ payload = {} }, { call, put }) {
199
+ const { data } = yield call(
200
+ kbService.document_change_parser,
201
+ omit(payload, ['kb_id']),
202
+ );
203
  const { retcode } = data;
204
  if (retcode === 0) {
205
+ put({
206
+ type: 'getKfList',
207
+ payload: { kb_id: payload.kb_id },
208
+ });
209
  put({
210
  type: 'updateState',
211
  payload: {
web/src/pages/add-knowledge/components/knowledge-file/parsing-action-cell/index.tsx CHANGED
@@ -1,5 +1,8 @@
1
  import showDeleteConfirm from '@/components/deleting-confirm';
 
2
  import { IKnowledgeFile } from '@/interfaces/database/knowledge';
 
 
3
  import {
4
  DeleteOutlined,
5
  DownloadOutlined,
@@ -7,37 +10,27 @@ import {
7
  ToolOutlined,
8
  } from '@ant-design/icons';
9
  import { Button, Dropdown, MenuProps, Space, Tooltip } from 'antd';
10
- import { useDispatch } from 'umi';
11
  import { isParserRunning } from '../utils';
12
 
13
- import { api_host } from '@/utils/api';
14
- import { downloadFile } from '@/utils/fileUtil';
15
  import styles from './index.less';
16
 
17
  interface IProps {
18
- knowledgeBaseId: string;
19
  record: IKnowledgeFile;
20
  setDocumentAndParserId: () => void;
 
 
21
  }
22
 
23
  const ParsingActionCell = ({
24
- knowledgeBaseId,
25
  record,
26
  setDocumentAndParserId,
 
 
27
  }: IProps) => {
28
- const dispatch = useDispatch();
29
  const documentId = record.id;
30
  const isRunning = isParserRunning(record.run);
31
 
32
- const removeDocument = () => {
33
- dispatch({
34
- type: 'kFModel/document_rm',
35
- payload: {
36
- doc_id: documentId,
37
- kb_id: knowledgeBaseId,
38
- },
39
- });
40
- };
41
 
42
  const onRmDocument = () => {
43
  if (!isRunning) {
@@ -52,39 +45,13 @@ const ParsingActionCell = ({
52
  });
53
  };
54
 
55
- const setCurrentRecord = () => {
56
- dispatch({
57
- type: 'kFModel/setCurrentRecord',
58
- payload: record,
59
- });
60
- };
61
-
62
- const showSegmentSetModal = () => {
63
- dispatch({
64
- type: 'kFModel/updateState',
65
- payload: {
66
- isShowSegmentSetModal: true,
67
- },
68
- });
69
- };
70
-
71
- const showRenameModal = () => {
72
- if (!isRunning) {
73
- setCurrentRecord();
74
- dispatch({
75
- type: 'kFModel/setIsShowRenameModal',
76
- payload: true,
77
- });
78
- }
79
- };
80
-
81
  const chunkItems: MenuProps['items'] = [
82
  {
83
  key: '1',
84
  label: (
85
  <div>
86
- <Button type="link" onClick={showSegmentSetModal}>
87
- Category
88
  </Button>
89
  </div>
90
  ),
 
1
  import showDeleteConfirm from '@/components/deleting-confirm';
2
+ import { useRemoveDocument } from '@/hooks/documentHooks';
3
  import { IKnowledgeFile } from '@/interfaces/database/knowledge';
4
+ import { api_host } from '@/utils/api';
5
+ import { downloadFile } from '@/utils/fileUtil';
6
  import {
7
  DeleteOutlined,
8
  DownloadOutlined,
 
10
  ToolOutlined,
11
  } from '@ant-design/icons';
12
  import { Button, Dropdown, MenuProps, Space, Tooltip } from 'antd';
 
13
  import { isParserRunning } from '../utils';
14
 
 
 
15
  import styles from './index.less';
16
 
17
  interface IProps {
 
18
  record: IKnowledgeFile;
19
  setDocumentAndParserId: () => void;
20
+ showRenameModal: () => void;
21
+ showChangeParserModal: () => void;
22
  }
23
 
24
  const ParsingActionCell = ({
 
25
  record,
26
  setDocumentAndParserId,
27
+ showRenameModal,
28
+ showChangeParserModal,
29
  }: IProps) => {
 
30
  const documentId = record.id;
31
  const isRunning = isParserRunning(record.run);
32
 
33
+ const removeDocument = useRemoveDocument(documentId);
 
 
 
 
 
 
 
 
34
 
35
  const onRmDocument = () => {
36
  if (!isRunning) {
 
45
  });
46
  };
47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  const chunkItems: MenuProps['items'] = [
49
  {
50
  key: '1',
51
  label: (
52
  <div>
53
+ <Button type="link" onClick={showChangeParserModal}>
54
+ Chunk Method
55
  </Button>
56
  </div>
57
  ),
web/src/pages/add-knowledge/components/knowledge-file/rename-modal/index.tsx CHANGED
@@ -1,46 +1,30 @@
1
- import { useKnowledgeBaseId } from '@/hooks/knowledgeHook';
2
  import { Form, Input, Modal } from 'antd';
3
  import { useEffect } from 'react';
4
- import { useDispatch, useSelector } from 'umi';
5
 
6
- const RenameModal = () => {
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  const [form] = Form.useForm();
8
- const dispatch = useDispatch();
9
- const kFModel = useSelector((state: any) => state.kFModel);
10
- const loading = useSelector(
11
- (state: any) => state.loading.effects['kFModel/document_rename'],
12
- );
13
- const knowledgeBaseId = useKnowledgeBaseId();
14
- const isModalOpen = kFModel.isShowRenameModal;
15
- const initialName = kFModel.currentRecord?.name;
16
- const documentId = kFModel.currentRecord?.id;
17
 
18
  type FieldType = {
19
  name?: string;
20
  };
21
 
22
- const closeModal = () => {
23
- dispatch({
24
- type: 'kFModel/setIsShowRenameModal',
25
- payload: false,
26
- });
27
- };
28
-
29
  const handleOk = async () => {
30
  const ret = await form.validateFields();
31
-
32
- dispatch({
33
- type: 'kFModel/document_rename',
34
- payload: {
35
- doc_id: documentId,
36
- name: ret.name,
37
- kb_id: knowledgeBaseId,
38
- },
39
- });
40
- };
41
-
42
- const handleCancel = () => {
43
- closeModal();
44
  };
45
 
46
  const onFinish = (values: any) => {
@@ -52,17 +36,17 @@ const RenameModal = () => {
52
  };
53
 
54
  useEffect(() => {
55
- if (isModalOpen) {
56
  form.setFieldValue('name', initialName);
57
  }
58
- }, [initialName, documentId, form, isModalOpen]);
59
 
60
  return (
61
  <Modal
62
  title="Rename"
63
- open={isModalOpen}
64
  onOk={handleOk}
65
- onCancel={handleCancel}
66
  okButtonProps={{ loading }}
67
  >
68
  <Form
 
1
+ import { IModalManagerChildrenProps } from '@/components/modal-manager';
2
  import { Form, Input, Modal } from 'antd';
3
  import { useEffect } from 'react';
 
4
 
5
+ interface IProps extends Omit<IModalManagerChildrenProps, 'showModal'> {
6
+ loading: boolean;
7
+ initialName: string;
8
+ onOk: (name: string) => void;
9
+ showModal?(): void;
10
+ }
11
+
12
+ const RenameModal = ({
13
+ visible,
14
+ onOk,
15
+ loading,
16
+ initialName,
17
+ hideModal,
18
+ }: IProps) => {
19
  const [form] = Form.useForm();
 
 
 
 
 
 
 
 
 
20
 
21
  type FieldType = {
22
  name?: string;
23
  };
24
 
 
 
 
 
 
 
 
25
  const handleOk = async () => {
26
  const ret = await form.validateFields();
27
+ onOk(ret.name);
 
 
 
 
 
 
 
 
 
 
 
 
28
  };
29
 
30
  const onFinish = (values: any) => {
 
36
  };
37
 
38
  useEffect(() => {
39
+ if (visible) {
40
  form.setFieldValue('name', initialName);
41
  }
42
+ }, [initialName, form, visible]);
43
 
44
  return (
45
  <Modal
46
  title="Rename"
47
+ open={visible}
48
  onOk={handleOk}
49
+ onCancel={hideModal}
50
  okButtonProps={{ loading }}
51
  >
52
  <Form
web/src/pages/add-knowledge/components/knowledge-setting/category-panel.tsx CHANGED
@@ -35,7 +35,11 @@ const CategoryPanel = ({ chunkMethod }: { chunkMethod: string }) => {
35
  <Title level={5} className={styles.topTitle}>
36
  {item.title} Category
37
  </Title>
38
- <Text>{item.description}</Text>
 
 
 
 
39
  <Title level={5}>{item.title} Image Examples</Title>
40
  <Text>
41
  We've prepared detailed visual guides to make understanding easier
 
35
  <Title level={5} className={styles.topTitle}>
36
  {item.title} Category
37
  </Title>
38
+ <p
39
+ dangerouslySetInnerHTML={{
40
+ __html: item.description,
41
+ }}
42
+ ></p>
43
  <Title level={5}>{item.title} Image Examples</Title>
44
  <Text>
45
  We've prepared detailed visual guides to make understanding easier
web/src/pages/add-knowledge/components/knowledge-setting/index.tsx CHANGED
@@ -21,10 +21,10 @@ const Configuration = () => {
21
  <Divider></Divider>
22
  <Spin spinning={loading}>
23
  <Row gutter={32}>
24
- <Col span={12}>
25
  <ConfigurationForm form={form}></ConfigurationForm>
26
  </Col>
27
- <Col span={12}>
28
  <CategoryPanel chunkMethod={chunkMethod}></CategoryPanel>
29
  </Col>
30
  </Row>
 
21
  <Divider></Divider>
22
  <Spin spinning={loading}>
23
  <Row gutter={32}>
24
+ <Col span={8}>
25
  <ConfigurationForm form={form}></ConfigurationForm>
26
  </Col>
27
+ <Col span={16}>
28
  <CategoryPanel chunkMethod={chunkMethod}></CategoryPanel>
29
  </Col>
30
  </Row>
web/src/pages/chat/index.tsx CHANGED
@@ -1,4 +1,5 @@
1
  import { ReactComponent as ChatAppCube } from '@/assets/svg/chat-app-cube.svg';
 
2
  import { DeleteOutlined, EditOutlined, FormOutlined } from '@ant-design/icons';
3
  import {
4
  Avatar,
@@ -34,7 +35,6 @@ import {
34
  useSelectFirstDialogOnMount,
35
  } from './hooks';
36
 
37
- import RenameModal from '@/components/rename-modal';
38
  import styles from './index.less';
39
 
40
  const Chat = () => {
 
1
  import { ReactComponent as ChatAppCube } from '@/assets/svg/chat-app-cube.svg';
2
+ import RenameModal from '@/components/rename-modal';
3
  import { DeleteOutlined, EditOutlined, FormOutlined } from '@ant-design/icons';
4
  import {
5
  Avatar,
 
35
  useSelectFirstDialogOnMount,
36
  } from './hooks';
37
 
 
38
  import styles from './index.less';
39
 
40
  const Chat = () => {