Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add KnowledgeGraphModal #162 #1766

Merged
merged 2 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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