| @@ -127,6 +127,18 @@ type ( | |||||
| } | } | ||||
| /******************Deploy instance*************************/ | /******************Deploy instance*************************/ | ||||
| GetDeployInstanceReq{ | |||||
| AdapterId string `form:"adapterId"` | |||||
| ClusterId string `form:"clusterId"` | |||||
| Id string `form:"id"` | |||||
| InstanceId string `form:"instanceId"` | |||||
| } | |||||
| GetDeployInstanceResp { | |||||
| Instance interface{} `json:"instance"` | |||||
| } | |||||
| DeployInstanceListReq{ | DeployInstanceListReq{ | ||||
| PageInfo | PageInfo | ||||
| } | } | ||||
| @@ -960,6 +960,9 @@ service pcm { | |||||
| group: inference | group: inference | ||||
| ) | ) | ||||
| service pcm { | service pcm { | ||||
| @handler GetDeployInstanceHandler | |||||
| get /inference/getDeployInstance (GetDeployInstanceReq) returns (GetDeployInstanceResp) | |||||
| @handler CreateInferenceTaskHandler | @handler CreateInferenceTaskHandler | ||||
| post /inference/createTask (CreateInferenceTaskReq) returns (CreateInferenceTaskResp) | post /inference/createTask (CreateInferenceTaskReq) returns (CreateInferenceTaskResp) | ||||
| @@ -0,0 +1,28 @@ | |||||
| package inference | |||||
| import ( | |||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/inference" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/internal/types" | |||||
| ) | |||||
| func GetDeployInstanceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| var req types.GetDeployInstanceReq | |||||
| if err := httpx.Parse(r, &req); err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| return | |||||
| } | |||||
| l := inference.NewGetDeployInstanceLogic(r.Context(), svcCtx) | |||||
| resp, err := l.GetDeployInstance(&req) | |||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -1208,6 +1208,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | |||||
| server.AddRoutes( | server.AddRoutes( | ||||
| []rest.Route{ | []rest.Route{ | ||||
| { | |||||
| Method: http.MethodGet, | |||||
| Path: "/inference/getDeployInstance", | |||||
| Handler: inference.GetDeployInstanceHandler(serverCtx), | |||||
| }, | |||||
| { | { | ||||
| Method: http.MethodPost, | Method: http.MethodPost, | ||||
| Path: "/inference/createTask", | Path: "/inference/createTask", | ||||
| @@ -0,0 +1,30 @@ | |||||
| package inference | |||||
| import ( | |||||
| "context" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/internal/types" | |||||
| "github.com/zeromicro/go-zero/core/logx" | |||||
| ) | |||||
| type GetDeployInstanceLogic struct { | |||||
| logx.Logger | |||||
| ctx context.Context | |||||
| svcCtx *svc.ServiceContext | |||||
| } | |||||
| func NewGetDeployInstanceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetDeployInstanceLogic { | |||||
| return &GetDeployInstanceLogic{ | |||||
| Logger: logx.WithContext(ctx), | |||||
| ctx: ctx, | |||||
| svcCtx: svcCtx, | |||||
| } | |||||
| } | |||||
| func (l *GetDeployInstanceLogic) GetDeployInstance(req *types.GetDeployInstanceReq) (resp *types.GetDeployInstanceResp, err error) { | |||||
| // todo: add your logic here and delete this line | |||||
| return | |||||
| } | |||||
| @@ -6250,6 +6250,17 @@ type TextToImageInferenceResp struct { | |||||
| Result []byte `json:"result"` | Result []byte `json:"result"` | ||||
| } | } | ||||
| type GetDeployInstanceReq struct { | |||||
| AdapterId string `form:"adapterId"` | |||||
| ClusterId string `form:"clusterId"` | |||||
| Id string `form:"id"` | |||||
| InstanceId string `form:"instanceId"` | |||||
| } | |||||
| type GetDeployInstanceResp struct { | |||||
| Instance interface{} `json:"instance"` | |||||
| } | |||||
| type DeployInstanceListReq struct { | type DeployInstanceListReq struct { | ||||
| PageInfo | PageInfo | ||||
| } | } | ||||