fix: update ListSpecifications of modelarts
This commit is contained in:
parent
72c3fb7a03
commit
dd8723a5ef
|
@ -3,14 +3,11 @@ package modelartsservicelogic
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitlink.org.cn/JointCloud/pcm-modelarts/internal/util"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"strconv"
|
||||
|
||||
"gitlink.org.cn/JointCloud/pcm-modelarts/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-modelarts/modelarts"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"gitlink.org.cn/JointCloud/pcm-modelarts/internal/svc"
|
||||
"gitlink.org.cn/JointCloud/pcm-modelarts/internal/util"
|
||||
"gitlink.org.cn/JointCloud/pcm-modelarts/modelarts"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
)
|
||||
|
||||
type ListSpecificationsLogic struct {
|
||||
|
@ -29,20 +26,12 @@ func NewListSpecificationsLogic(ctx context.Context, svcCtx *svc.ServiceContext)
|
|||
|
||||
func (l *ListSpecificationsLogic) ListSpecifications(in *modelarts.ListSpecificationsReq) (*modelarts.ListSpecificationsResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
var resp modelarts.ListSpecificationsResp
|
||||
platform, err := util.GetModelArtsConfWithPlatform(l.svcCtx.Config.ModelArtsConf.Platform)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var resp modelarts.ListSpecificationsResp
|
||||
offset := strconv.Itoa(int(in.OffSet))
|
||||
judgeLimit := strconv.Itoa(int(in.Limit))
|
||||
var limit string
|
||||
if judgeLimit != "0" {
|
||||
limit = strconv.Itoa(int(in.Limit))
|
||||
} else {
|
||||
limit = "10"
|
||||
}
|
||||
url := fmt.Sprintf("%sv1/%s/services/specifications?offset=%s&limit=%s&is_personal_cluster=%s&infer_type=%s", platform.Endpoint, platform.ProjectId, offset, limit, in.IsPersonalCluster, in.InferType)
|
||||
url := fmt.Sprintf("%sv1/%s/services/specifications?is_personal_cluster=%s&infer_type=%s", platform.Endpoint, platform.ProjectId, in.IsPersonalCluster, in.InferType)
|
||||
body, err := util.SendRequest("GET", url,
|
||||
nil, l.svcCtx.Config.ModelArtsConf.Platform)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue