Skip to content

Commit

Permalink
feat: Add KnowledgeGraphModal infiniflow#162
Browse files Browse the repository at this point in the history
  • Loading branch information
cike8899 committed Aug 1, 2024
1 parent b9a50ef commit f4ff348
Show file tree
Hide file tree
Showing 14 changed files with 655 additions and 251 deletions.
46 changes: 40 additions & 6 deletions web/src/components/chunk-method-modal/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,59 @@ const ParserListMap = new Map([
'presentation',
'one',
'qa',
'knowledge_graph',
],
],
[
['doc', 'docx'],
['naive', 'resume', 'book', 'laws', 'one', 'qa', 'manual'],
[
'naive',
'resume',
'book',
'laws',
'one',
'qa',
'manual',
'knowledge_graph',
],
],
[
['xlsx', 'xls'],
['naive', 'qa', 'table', 'one'],
['naive', 'qa', 'table', 'one', 'knowledge_graph'],
],
[['ppt', 'pptx'], ['presentation']],
[
['jpg', 'jpeg', 'png', 'gif', 'bmp', 'tif', 'tiff', 'webp', 'svg', 'ico'],
['picture'],
],
[['txt'], ['naive', 'resume', 'book', 'laws', 'one', 'qa', 'table']],
[['csv'], ['naive', 'resume', 'book', 'laws', 'one', 'qa', 'table']],
[['md'], ['naive', 'qa']],
[['json'], ['naive']],
[
['txt'],
[
'naive',
'resume',
'book',
'laws',
'one',
'qa',
'table',
'knowledge_graph',
],
],
[
['csv'],
[
'naive',
'resume',
'book',
'laws',
'one',
'qa',
'table',
'knowledge_graph',
],
],
[['md'], ['naive', 'qa', 'knowledge_graph']],
[['json'], ['naive', 'knowledge_graph']],
]);

const getParserList = (
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/chunk-method-modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ const ChunkMethodModal: React.FC<IProps> = ({
<Space size={[0, 8]} wrap>
<Form.Item label={t('chunkMethod')} className={styles.chunkMethod}>
<Select
style={{ width: 120 }}
style={{ width: 160 }}
onChange={handleChange}
value={selectedTag}
options={parserList}
Expand Down
19 changes: 19 additions & 0 deletions web/src/hooks/chunk-hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,3 +206,22 @@ export const useFetchChunk = (chunkId?: string): ResponseType<any> => {

return data;
};

export const useFetchKnowledgeGraph = (): ResponseType<any> => {
const { documentId } = useGetKnowledgeSearchParams();

const { data } = useQuery({
queryKey: ['fetchKnowledgeGraph', documentId],
initialData: true,
gcTime: 0,
queryFn: async () => {
const data = await kbService.knowledge_graph({
doc_id: documentId,
});

return data;
},
});

return data;
};

This file was deleted.

Loading

0 comments on commit f4ff348

Please sign in to comment.