diff --git a/frontend/src/api/modelApi.ts b/frontend/src/api/modelApi.ts new file mode 100644 index 0000000..644465a --- /dev/null +++ b/frontend/src/api/modelApi.ts @@ -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(`/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(`/api/projects/${projectId}/models`).then(({ data }) => data); +} + +export async function addProjectModel(projectId: number, modelData: ModelRequest) { + return api.post(`/api/projects/${projectId}/models`, modelData).then(({ data }) => data); +} + +export async function getModelCategories(modelId: number) { + return api.get(`/api/models/${modelId}/categories`).then(({ data }) => data); +}