Feat: 모델 api 추가

This commit is contained in:
정현조 2024-09-23 15:56:43 +09:00
parent e7cf03593c
commit 722a15be7b

View File

@ -0,0 +1,22 @@
import api from '@/api/axiosConfig';
import { ModelRequest, ModelResponse, ProjectModelsResponse, ModelCategoryResponse } from '@/types';
export async function updateModelName(projectId: number, modelId: number, modelData: ModelRequest) {
return api.put<ModelResponse>(`/api/projects/${projectId}/models/${modelId}`, modelData).then(({ data }) => data);
}
export async function trainModel(projectId: number) {
return api.post(`/api/projects/${projectId}/train`).then(({ data }) => data);
}
export async function getProjectModels(projectId: number) {
return api.get<ProjectModelsResponse>(`/api/projects/${projectId}/models`).then(({ data }) => data);
}
export async function addProjectModel(projectId: number, modelData: ModelRequest) {
return api.post<ModelResponse>(`/api/projects/${projectId}/models`, modelData).then(({ data }) => data);
}
export async function getModelCategories(modelId: number) {
return api.get<ModelCategoryResponse[]>(`/api/models/${modelId}/categories`).then(({ data }) => data);
}