mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-20 21:18:13 +02:00
feat(model-connections): implement bulk model update endpoint and related schema changes
This commit is contained in:
parent
ad404b2dbc
commit
ced1bb85ed
7 changed files with 538 additions and 168 deletions
|
|
@ -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);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue