feat(model-connections): implement bulk model update endpoint and related schema changes

This commit is contained in:
Anish Sarkar 2026-06-12 09:43:56 +05:30
parent ad404b2dbc
commit ced1bb85ed
7 changed files with 538 additions and 168 deletions

View file

@ -10,12 +10,14 @@ import {
type ModelProviderRead,
type ModelRead,
type ModelRoles,
type ModelsBulkUpdateRequest,
type ModelUpdateRequest,
modelCreateRequest,
modelProviderListResponse,
modelListResponse,
modelProviderListResponse,
modelRead,
modelRoles,
modelsBulkUpdateRequest,
modelUpdateRequest,
type VerifyConnectionResponse,
verifyConnectionResponse,
@ -97,6 +99,25 @@ class ModelConnectionsApiService {
});
};
bulkUpdateModels = async (
connectionId: number,
request: ModelsBulkUpdateRequest
): Promise<ModelRead[]> => {
const parsed = modelsBulkUpdateRequest.safeParse(request);
if (!parsed.success) {
throw new ValidationError(parsed.error.issues.map((issue) => issue.message).join(", "));
}
return baseApiService.request(
`/api/v1/model-connections/${connectionId}/models`,
modelListResponse,
{
method: "PATCH",
headers: { "Content-Type": "application/json" },
body: parsed.data,
}
);
};
testModel = async (id: number): Promise<VerifyConnectionResponse> => {
return baseApiService.post(`/api/v1/models/${id}/test`, verifyConnectionResponse);
};