fetching model image, still not working

This commit is contained in:
Jennifer Player
2024-03-05 22:57:05 -05:00
committed by Kent Keirsey
parent c1cdfd132b
commit 2f6964bfa5
14 changed files with 461 additions and 53 deletions

View File

@@ -23,7 +23,16 @@ export type UpdateModelArg = {
body: paths['/api/v2/models/i/{key}']['patch']['requestBody']['content']['application/json'];
};
export type UpdateModelImageArg = {
key: paths['/api/v2/models/i/{key}/image']['patch']['parameters']['path']['key'];
image: paths['/api/v2/models/i/{key}/image']['patch']['formData']['content']['multipart/form-data'];
};
type UpdateModelResponse = paths['/api/v2/models/i/{key}']['patch']['responses']['200']['content']['application/json'];
type UpdateModelImageResponse =
paths['/api/v2/models/i/{key}/image']['patch']['responses']['200']['content']['application/json'];
type GetModelImageResponse =
paths['/api/v2/models/i/{key}/image']['get']['responses']['200']['content']['application/json'];
type GetModelConfigResponse = paths['/api/v2/models/i/{key}']['get']['responses']['200']['content']['application/json'];
@@ -144,6 +153,21 @@ export const modelsApi = api.injectEndpoints({
},
invalidatesTags: ['Model'],
}),
getModelImage: build.query<GetModelImageResponse, string>({
query: (key) => buildModelsUrl(`i/${key}/image`),
}),
updateModelImage: build.mutation<UpdateModelImageResponse, UpdateModelImageArg>({
query: ({ key, image }) => {
const formData = new FormData();
formData.append('image', image);
return {
url: buildModelsUrl(`i/${key}/image`),
method: 'PATCH',
body: formData,
};
},
invalidatesTags: ['Model'],
}),
installModel: build.mutation<InstallModelResponse, InstallModelArg>({
query: ({ source }) => {
return {
@@ -330,7 +354,9 @@ export const {
useGetTextualInversionModelsQuery,
useGetVaeModelsQuery,
useDeleteModelsMutation,
useUpdateModelMutation,
useUpdateModelsMutation,
useGetModelImageQuery,
useUpdateModelImageMutation,
useInstallModelMutation,
useConvertModelMutation,
useSyncModelsMutation,