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:
balibabu
2026-04-16 18:46:52 +08:00
committed by GitHub
parent 901023a80a
commit 4cf4d444d2
7 changed files with 14 additions and 215 deletions

View File

@@ -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 };
};

View File

@@ -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 };
};