mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-24 23:46:52 +08:00
* feat: add loading to all pages * fix: disable sending messages if both application and conversation are empty * feat: add chatSpin class to Spin of chat
34 lines
856 B
TypeScript
34 lines
856 B
TypeScript
import { KnowledgeSearchParams } from '@/constants/knowledge';
|
|
import { useLocation, useSearchParams } from 'umi';
|
|
|
|
export enum SegmentIndex {
|
|
Second = '2',
|
|
Third = '3',
|
|
}
|
|
|
|
export const useSegmentedPathName = (index: SegmentIndex) => {
|
|
const { pathname } = useLocation();
|
|
|
|
const pathArray = pathname.split('/');
|
|
return pathArray[index] || '';
|
|
};
|
|
|
|
export const useSecondPathName = () => {
|
|
return useSegmentedPathName(SegmentIndex.Second);
|
|
};
|
|
|
|
export const useThirdPathName = () => {
|
|
return useSegmentedPathName(SegmentIndex.Third);
|
|
};
|
|
|
|
export const useGetKnowledgeSearchParams = () => {
|
|
const [currentQueryParameters] = useSearchParams();
|
|
|
|
return {
|
|
documentId:
|
|
currentQueryParameters.get(KnowledgeSearchParams.DocumentId) || '',
|
|
knowledgeId:
|
|
currentQueryParameters.get(KnowledgeSearchParams.KnowledgeId) || '',
|
|
};
|
|
};
|