mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-03 06:17:29 +08:00
Fix: Login page type error. (#14156)
### What problem does this PR solve? Fix: Login page type error. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import { useHandleFilterSubmit } from '@/components/list-filter-bar/use-handle-filter-submit';
|
||||
import { post } from '@/utils/next-request';
|
||||
|
||||
import message from '@/components/ui/message';
|
||||
import { RunningStatus } from '@/constants/knowledge';
|
||||
@@ -21,7 +20,7 @@ import kbService, {
|
||||
renameDocument,
|
||||
uploadDocument,
|
||||
} from '@/services/knowledge-service';
|
||||
import api, { restAPIv1, webAPI } from '@/utils/api';
|
||||
import { restAPIv1, webAPI } from '@/utils/api';
|
||||
import { getSearchValue } from '@/utils/common-util';
|
||||
import { buildChunkHighlights } from '@/utils/document-util';
|
||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
||||
@@ -564,26 +563,3 @@ export const useFetchDocumentThumbnailsByIds = () => {
|
||||
|
||||
return { data, setDocumentIds };
|
||||
};
|
||||
|
||||
export const useParseDocument = () => {
|
||||
const {
|
||||
data,
|
||||
isPending: loading,
|
||||
mutateAsync,
|
||||
} = useMutation({
|
||||
mutationKey: [DocumentApiAction.ParseDocument],
|
||||
mutationFn: async (url: string) => {
|
||||
try {
|
||||
const { data } = await post(api.parse, { url });
|
||||
if (data?.code === 0) {
|
||||
message.success(i18n.t('message.uploaded'));
|
||||
}
|
||||
return data;
|
||||
} catch (error) {
|
||||
message.error('error');
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
return { parseDocument: mutateAsync, data, loading };
|
||||
};
|
||||
|
||||
@@ -5,7 +5,6 @@ import {
|
||||
IMcpServer,
|
||||
IMcpServerListResponse,
|
||||
IMCPTool,
|
||||
IMCPToolRecord,
|
||||
} from '@/interfaces/database/mcp';
|
||||
import {
|
||||
IImportMcpServersRequestBody,
|
||||
@@ -17,7 +16,6 @@ import mcpServerService, {
|
||||
} from '@/services/mcp-server-service';
|
||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
||||
import { useDebounce } from 'ahooks';
|
||||
import { useState } from 'react';
|
||||
import {
|
||||
useGetPaginationWithRouter,
|
||||
useHandleSearchChange,
|
||||
@@ -33,7 +31,6 @@ export const enum McpApiAction {
|
||||
ExportMcpServer = 'exportMcpServer',
|
||||
ListMcpServerTools = 'listMcpServerTools',
|
||||
TestMcpServerTool = 'testMcpServerTool',
|
||||
CacheMcpServerTool = 'cacheMcpServerTool',
|
||||
TestMcpServer = 'testMcpServer',
|
||||
}
|
||||
|
||||
@@ -202,22 +199,6 @@ export const useExportMcpServer = () => {
|
||||
return { data, loading, exportMcpServer: mutateAsync };
|
||||
};
|
||||
|
||||
export const useListMcpServerTools = () => {
|
||||
const [ids, setIds] = useState<string[]>([]);
|
||||
const { data, isFetching: loading } = useQuery<IMCPToolRecord>({
|
||||
queryKey: [McpApiAction.ListMcpServerTools],
|
||||
initialData: {} as IMCPToolRecord,
|
||||
gcTime: 0,
|
||||
enabled: ids.length > 0,
|
||||
queryFn: async () => {
|
||||
const { data } = await mcpServerService.listTools({ mcp_ids: ids });
|
||||
return data?.data ?? {};
|
||||
},
|
||||
});
|
||||
|
||||
return { data, loading, setIds };
|
||||
};
|
||||
|
||||
export const useTestMcpServer = () => {
|
||||
const {
|
||||
data,
|
||||
@@ -234,37 +215,3 @@ export const useTestMcpServer = () => {
|
||||
|
||||
return { data, loading, testMcpServer: mutateAsync };
|
||||
};
|
||||
|
||||
export const useCacheMcpServerTool = () => {
|
||||
const {
|
||||
data,
|
||||
isPending: loading,
|
||||
mutateAsync,
|
||||
} = useMutation({
|
||||
mutationKey: [McpApiAction.CacheMcpServerTool],
|
||||
mutationFn: async (params: Record<string, any>) => {
|
||||
const { data = {} } = await mcpServerService.cacheTool(params);
|
||||
|
||||
return data;
|
||||
},
|
||||
});
|
||||
|
||||
return { data, loading, cacheMcpServerTool: mutateAsync };
|
||||
};
|
||||
|
||||
export const useTestMcpServerTool = () => {
|
||||
const {
|
||||
data,
|
||||
isPending: loading,
|
||||
mutateAsync,
|
||||
} = useMutation({
|
||||
mutationKey: [McpApiAction.TestMcpServerTool],
|
||||
mutationFn: async (params: Record<string, any>) => {
|
||||
const { data = {} } = await mcpServerService.testTool(params);
|
||||
|
||||
return data;
|
||||
},
|
||||
});
|
||||
|
||||
return { data, loading, testMcpServerTool: mutateAsync };
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user