mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-01 05:23:47 +08:00
Fix: Model provider add verify and fixed form in modal not resetting issue (#15520)
### What problem does this PR solve? Fix: Model provider add verify and fixed form in modal not resetting issue ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@@ -32,6 +32,7 @@ export const enum LLMApiAction {
|
||||
AddedProviders = 'addedProviders',
|
||||
AddProvider = 'addProvider',
|
||||
AddProviderInstance = 'addProviderInstance',
|
||||
VerifyProviderConnection = 'verifyProviderConnection',
|
||||
AddInstanceModel = 'addInstanceModel',
|
||||
DeleteProviderInstance = 'deleteProviderInstance',
|
||||
ListDefaultModels = 'listDefaultModels',
|
||||
@@ -238,6 +239,27 @@ export const useAddProviderInstance = () => {
|
||||
return { data, loading, addProviderInstance: mutateAsync };
|
||||
};
|
||||
|
||||
export const useVerifyProviderConnection = () => {
|
||||
const {
|
||||
data,
|
||||
isPending: loading,
|
||||
mutateAsync,
|
||||
} = useMutation({
|
||||
mutationKey: [LLMApiAction.VerifyProviderConnection],
|
||||
mutationFn: async (params: {
|
||||
provider_name: string;
|
||||
api_key: string;
|
||||
base_url?: string;
|
||||
region?: string;
|
||||
}) => {
|
||||
const { data } = await llmService.verifyProviderConnection(params);
|
||||
return data;
|
||||
},
|
||||
});
|
||||
|
||||
return { data, loading, verifyProviderConnection: mutateAsync };
|
||||
};
|
||||
|
||||
export const useAddInstanceModel = () => {
|
||||
const queryClient = useQueryClient();
|
||||
const {
|
||||
|
||||
Reference in New Issue
Block a user