balibabu
commited on
Commit
·
d3812ff
1
Parent(s):
1903239
fix: fixed an issue where an error was reported when fetching the file list after changing the parsing type (#150)
Browse files
web/src/pages/add-knowledge/components/knowledge-dataset/knowledge-upload-file/index.tsx
CHANGED
@@ -44,6 +44,7 @@ import {
|
|
44 |
} from 'react';
|
45 |
import { Link, useDispatch, useNavigate } from 'umi';
|
46 |
|
|
|
47 |
import styles from './index.less';
|
48 |
|
49 |
const { Dragger } = Upload;
|
@@ -66,21 +67,14 @@ const UploaderItem = ({
|
|
66 |
const { parserConfig, defaultParserId } = useGetDocumentDefaultParser();
|
67 |
const { removeDocument } = useDeleteDocumentById();
|
68 |
const [value, setValue] = useState(defaultParserId);
|
69 |
-
const
|
70 |
|
71 |
const documentId = file?.response?.id;
|
72 |
|
73 |
const parserList = useSelectParserList();
|
74 |
|
75 |
const saveParser = (parserId: string) => {
|
76 |
-
|
77 |
-
type: 'kFModel/document_change_parser',
|
78 |
-
payload: {
|
79 |
-
parser_id: parserId,
|
80 |
-
doc_id: documentId,
|
81 |
-
parser_config: parserConfig,
|
82 |
-
},
|
83 |
-
});
|
84 |
};
|
85 |
|
86 |
const onChange = (e: RadioChangeEvent) => {
|
|
|
44 |
} from 'react';
|
45 |
import { Link, useDispatch, useNavigate } from 'umi';
|
46 |
|
47 |
+
import { useSetDocumentParser } from '@/hooks/documentHooks';
|
48 |
import styles from './index.less';
|
49 |
|
50 |
const { Dragger } = Upload;
|
|
|
67 |
const { parserConfig, defaultParserId } = useGetDocumentDefaultParser();
|
68 |
const { removeDocument } = useDeleteDocumentById();
|
69 |
const [value, setValue] = useState(defaultParserId);
|
70 |
+
const setDocumentParser = useSetDocumentParser();
|
71 |
|
72 |
const documentId = file?.response?.id;
|
73 |
|
74 |
const parserList = useSelectParserList();
|
75 |
|
76 |
const saveParser = (parserId: string) => {
|
77 |
+
setDocumentParser(parserId, documentId, parserConfig as any);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
};
|
79 |
|
80 |
const onChange = (e: RadioChangeEvent) => {
|