package ai import ( "context" "github.com/jinzhu/copier" "github.com/pkg/errors" "gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/utils" "gitlink.org.cn/jcce-pcm/pcm-participant-modelarts/modelarts" "gitlink.org.cn/jcce-pcm/utils/result" "gitlink.org.cn/jcce-pcm/utils/xerr" "k8s.io/apimachinery/pkg/util/json" "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" "github.com/zeromicro/go-zero/core/logx" ) type ShowAlgorithmByUuidLogic struct { logx.Logger ctx context.Context svcCtx *svc.ServiceContext } func NewShowAlgorithmByUuidLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ShowAlgorithmByUuidLogic { return &ShowAlgorithmByUuidLogic{ Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx, } } func (l *ShowAlgorithmByUuidLogic) ShowAlgorithmByUuid(req *types.ShowAlgorithmByUuidReq) (resp *types.ShowAlgorithmByUuidResp, err error) { modelartsReq := &modelarts.ShowAlgorithmByUuidReq{} err = copier.CopyWithOption(modelartsReq, req, copier.Option{Converters: utils.Converters}) ShowAlgorithmByUuidResp, err := l.svcCtx.ModelArtsRpc.ShowAlgorithmByUuid(l.ctx, modelartsReq) if err != nil { return nil, errors.Wrapf(xerr.NewErrMsg("Failed to get db DataSet list"), "Failed to get db DataSet list err : %v ,req:%+v", err, req) } marshal, err := json.Marshal(&ShowAlgorithmByUuidResp) if err != nil { return nil, result.NewDefaultError(err.Error()) } json.Unmarshal(marshal, &resp) err = copier.CopyWithOption(&resp, &ShowAlgorithmByUuidResp, copier.Option{Converters: utils.Converters}) return resp, nil }