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:
chanx
2026-06-03 11:59:57 +08:00
committed by GitHub
parent 76fc1d547f
commit c41855da81
16 changed files with 160 additions and 27 deletions

View File

@@ -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 {