feat: Restore Model Convert Functionality

This commit is contained in:
blessedcoolant
2023-07-12 20:40:58 +12:00
parent 6238a53fdd
commit 2cedf6aed5
4 changed files with 61 additions and 27 deletions

View File

@ -44,6 +44,11 @@ type DeleteMainModelQuery = {
model_name: string;
};
type ConvertMainModelQuery = {
base_model: BaseModelType;
model_name: string;
};
const mainModelsAdapter = createEntityAdapter<MainModelConfigEntity>({
sortComparer: (a, b) => a.name.localeCompare(b.name),
});
@ -138,6 +143,18 @@ export const modelsApi = api.injectEndpoints({
},
invalidatesTags: ['MainModel'],
}),
convertMainModel: build.mutation<
EntityState<MainModelConfigEntity>,
ConvertMainModelQuery
>({
query: ({ base_model, model_name }) => {
return {
url: `models/convert/${base_model}/main/${model_name}`,
method: 'PUT',
};
},
invalidatesTags: ['MainModel'],
}),
getLoRAModels: build.query<EntityState<LoRAModelConfigEntity>, void>({
query: () => ({ url: 'models/', params: { model_type: 'lora' } }),
providesTags: (result, error, arg) => {
@ -283,4 +300,5 @@ export const {
useGetVaeModelsQuery,
useUpdateMainModelsMutation,
useDeleteMainModelsMutation,
useConvertMainModelMutation,
} = modelsApi;