feat(project): init
This commit is contained in:
86
components/label/api/scheme/index.ts
Normal file
86
components/label/api/scheme/index.ts
Normal file
@@ -0,0 +1,86 @@
|
||||
import httpFetch from "@/api/fetch"
|
||||
import { usePermissionStore } from "../../store/auth"
|
||||
import { BASE_LABEL_API } from "../label"
|
||||
import { Scheme } from "./typing"
|
||||
|
||||
// 获取标注方案列表
|
||||
export const getLabelSchemeList = (params: Scheme.ListRequest) => {
|
||||
return httpFetch<Scheme.ListResponse>({
|
||||
url: BASE_LABEL_API + "/api/v1/label_server/label_schema/list",
|
||||
method: "get",
|
||||
data: params,
|
||||
headerAttr: {
|
||||
["Token"]: usePermissionStore.getState().token,
|
||||
["Refresh-Token"]: usePermissionStore.getState().refresh_token,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// 新增标注方案
|
||||
export const addNewPlan = (data: Scheme.CreateProps) => {
|
||||
return httpFetch({
|
||||
url: BASE_LABEL_API + "/api/v1/label_server/label_schema/add",
|
||||
method: "post",
|
||||
body: JSON.stringify(data),
|
||||
headerAttr: {
|
||||
["Token"]: usePermissionStore.getState().token,
|
||||
["Refresh-Token"]: usePermissionStore.getState().refresh_token,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// 获取某一标注方案版本列表
|
||||
export const getAllVersionByName = (name: string) => {
|
||||
return httpFetch<Scheme.VersionListResponse>({
|
||||
url:
|
||||
BASE_LABEL_API +
|
||||
`/api/v1/label_server/label_schema/version/list?name=${name}`,
|
||||
method: "get",
|
||||
headerAttr: {
|
||||
["Token"]: usePermissionStore.getState().token,
|
||||
["Refresh-Token"]: usePermissionStore.getState().refresh_token,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// 删除标注方案
|
||||
export const deleteLabelPlan = (data: { name: string; version?: string }) => {
|
||||
return httpFetch({
|
||||
url: BASE_LABEL_API + "/api/v1/label_server/label_schema/delete",
|
||||
method: "delete",
|
||||
body: JSON.stringify(data),
|
||||
headerAttr: {
|
||||
["Token"]: usePermissionStore.getState().token,
|
||||
["Refresh-Token"]: usePermissionStore.getState().refresh_token,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// 保存错词库
|
||||
export const saveWrongWordList = (data: {
|
||||
data: { error: string; correct: string }[]
|
||||
}) => {
|
||||
return httpFetch({
|
||||
url: BASE_LABEL_API + "/api/v1/label_server/error_repository/save",
|
||||
method: "post",
|
||||
body: JSON.stringify(data),
|
||||
headerAttr: {
|
||||
["Token"]: usePermissionStore.getState().token,
|
||||
["Refresh-Token"]: usePermissionStore.getState().refresh_token,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// 查询错词库
|
||||
export const getWrongWordList = () => {
|
||||
return httpFetch<{
|
||||
data: { error: string; correct: string }[]
|
||||
}>({
|
||||
url: BASE_LABEL_API + "/api/v1/label_server/error_repository/query",
|
||||
method: "get",
|
||||
headerAttr: {
|
||||
["Token"]: usePermissionStore.getState().token,
|
||||
["Refresh-Token"]: usePermissionStore.getState().refresh_token,
|
||||
},
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user