refactor API endpoints; remove projectId from createDataSet and createAlgorithm paths, add new endpoints for model and container operations

Signed-off-by: jagger <cossjie@foxmail.com>
This commit is contained in:
jagger 2025-07-30 09:35:56 +08:00
parent b574a80516
commit 3185981438
3 changed files with 42 additions and 8 deletions

View File

@ -338,7 +338,7 @@ service pcm {
@doc "创建数据集"
@handler CreateDataSetHandler
post /ai/createDataSet/:projectId (CreateDataSetReq) returns (CreateDataSetResp)
post /ai/createDataSet (CreateDataSetReq) returns (CreateDataSetResp)
@doc "删除数据集"
@handler DeleteDataSetHandler
@ -362,7 +362,7 @@ service pcm {
@doc "创建算法"
@handler CreateAlgorithmHandler
post /ai/CreateAlgorithm/:projectId (CreateAlgorithmReq) returns (CreateAlgorithmResp)
post /ai/createAlgorithm (CreateAlgorithmReq) returns (CreateAlgorithmResp)
@doc "查询创建算法列表"
@handler ListAlgorithms

View File

@ -103,7 +103,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
{
// 创建算法
Method: http.MethodPost,
Path: "/ai/CreateAlgorithm/:projectId",
Path: "/ai/createAlgorithm",
Handler: ai.CreateAlgorithmHandler(serverCtx),
},
{
@ -223,9 +223,22 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
{
// 创建数据集
Method: http.MethodPost,
Path: "/ai/createDataSet/:projectId",
Path: "/ai/createDataSet",
Handler: ai.CreateDataSetHandler(serverCtx),
},
{
// 创建模型
Method: http.MethodPost,
Path: "/ai/createModel",
Handler: ai.CreateModelHandler(serverCtx),
},
{
// 创建模型
Method: http.MethodPost,
Path: "/ai/task/sync",
Handler: ai.TaskResultSyncHandler(serverCtx),
},
{
// 创建notebook
Method: http.MethodPost,
@ -368,6 +381,24 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Path: "/task/list",
Handler: cloud.CloudListHandler(serverCtx),
},
{
// 创建容器
Method: http.MethodPost,
Path: "/cloud/container/create",
Handler: cloud.ContainerCreateHandler(serverCtx),
},
{
// 删除容器
Method: http.MethodDelete,
Path: "/cloud/container/delete",
Handler: cloud.ContainerDeleteHandler(serverCtx),
},
{
// 获取容器
Method: http.MethodGet,
Path: "/cloud/container/get",
Handler: cloud.ContainerGetHandler(serverCtx),
},
},
rest.WithPrefix("/pcm/v1"),
)

View File

@ -728,13 +728,14 @@ type ClusterCreateReq struct {
Version string `json:"version,optional"`
Label string `json:"label,optional"`
OwnerId string `json:"ownerId,omitempty,optional"`
AuthType string `json:"authType,optional"`
AuthType int32 `json:"authType,optional"`
ProducerDict string `json:"producerDict,optional"`
RegionDict string `json:"regionDict,optional"`
RegionName string `json:"regionName,optional"`
Environment map[string]string `json:"environment,optional"`
CostType string `json:"costType,optional"`
Price int `json:"price,optional"`
Status string `json:"status,optional"`
}
type ClusterData struct {
@ -766,7 +767,7 @@ type ClusterInfo struct {
Version string `json:"version,omitempty" db:"version"`
Label string `json:"label,omitempty" db:"label"`
OwnerId string `json:"ownerId,omitempty" db:"owner_id"`
AuthType string `json:"authType,omitempty" db:"auth_type"`
AuthType int32 `json:"authType,omitempty" db:"auth_type"`
ProducerDict string `json:"producerDict,omitempty" db:"producer_dict"`
RegionDict string `json:"regionDict,omitempty" db:"region_dict"`
Location string `json:"location,omitempty" db:"location"`
@ -778,6 +779,7 @@ type ClusterInfo struct {
ProxyAddress string `json:"proxyAddress,omitempty" db:"proxy_address"`
ProxyEnable string `json:"proxyEnable,omitempty" db:"proxy_enable"`
Driver string `json:"driver,omitempty" db:"driver"`
Status string `json:"status,omitempty" db:"status"`
}
type ClusterListResp struct {
@ -833,7 +835,7 @@ type ClusterRelationInfo struct {
CVersion string `json:"cVersion,omitempty" db:"version"`
CLabel string `json:"cLabel,omitempty" db:"label"`
COwnerId string `json:"cOwnerId,omitempty" db:"owner_id"`
CAuthType string `json:"cAuthType,omitempty" db:"auth_type"`
CAuthType int32 `json:"cAuthType,omitempty" db:"auth_type"`
CRegionDict string `json:"cRegionDict,omitempty" db:"-"`
CProducerDict string `json:"cProducerDict,omitempty" db:"-"`
CCreateTime string `json:"cCreateTime,omitempty" db:"created_time" gorm:"autoCreateTime"`
@ -2153,7 +2155,8 @@ type EditResourceReq struct {
CpuUnit string `json:"cpuUnit,optional"`
MemoryValue string `json:"memoryValue,optional"`
MemoryUnit string `json:"memoryUnit,optional"`
UserId int64 `json:"userId,optional"`
UserId int64 `json:"userId,optional"`
}
type EndpointsReq struct {