mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
feat: remove KnowledgeSearching and add knowledge configuration page and add a run button to the document (#64)
* feat: add a run button to the document * feat: add knowledge configuration page * feat: remove KnowledgeSearching
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import showDeleteConfirm from '@/components/deleting-confirm';
|
||||
import { IKnowledge } from '@/interfaces/database/knowledge';
|
||||
import { useCallback } from 'react';
|
||||
import { IKnowledge, ITenantInfo } from '@/interfaces/database/knowledge';
|
||||
import { useCallback, useEffect, useMemo } from 'react';
|
||||
import { useDispatch, useSearchParams, useSelector } from 'umi';
|
||||
|
||||
export const useKnowledgeBaseId = (): string => {
|
||||
@ -77,3 +77,50 @@ export const useDeleteChunkByIds = (): {
|
||||
removeChunk: onRemoveChunk,
|
||||
};
|
||||
};
|
||||
|
||||
export const useSelectParserList = (): Array<{
|
||||
value: string;
|
||||
label: string;
|
||||
}> => {
|
||||
const tenantIfo: Nullable<ITenantInfo> = useSelector(
|
||||
(state: any) => state.settingModel.tenantIfo,
|
||||
);
|
||||
|
||||
const parserList = useMemo(() => {
|
||||
const parserArray: Array<string> = tenantIfo?.parser_ids.split(',') ?? [];
|
||||
return parserArray.map((x) => {
|
||||
const arr = x.split(':');
|
||||
return { value: arr[0], label: arr[1] };
|
||||
});
|
||||
}, [tenantIfo]);
|
||||
|
||||
return parserList;
|
||||
};
|
||||
|
||||
export const useFetchParserList = () => {
|
||||
const dispatch = useDispatch();
|
||||
|
||||
useEffect(() => {
|
||||
dispatch({
|
||||
type: 'settingModel/getTenantInfo',
|
||||
});
|
||||
}, [dispatch]);
|
||||
};
|
||||
|
||||
export const useFetchKnowledgeBaseConfiguration = () => {
|
||||
const dispatch = useDispatch();
|
||||
const knowledgeBaseId = useKnowledgeBaseId();
|
||||
|
||||
const fetchKnowledgeBaseConfiguration = useCallback(() => {
|
||||
dispatch({
|
||||
type: 'kSModel/getKbDetail',
|
||||
payload: {
|
||||
kb_id: knowledgeBaseId,
|
||||
},
|
||||
});
|
||||
}, [dispatch, knowledgeBaseId]);
|
||||
|
||||
useEffect(() => {
|
||||
fetchKnowledgeBaseConfiguration();
|
||||
}, [fetchKnowledgeBaseConfiguration]);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user