updated getRunninginstances logic

Former-commit-id: 437d3a36b7ff32d08a2760cc360856f784115775
This commit is contained in:
tzwang 2024-08-26 15:02:01 +08:00
parent da674642ea
commit aaf7cf3cb5
3 changed files with 10 additions and 12 deletions

View File

@ -1,28 +1,25 @@
package inference
import (
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/tzwang/pcm-coordinator/internal/logic/inference"
"gitlink.org.cn/tzwang/pcm-coordinator/internal/svc"
"gitlink.org.cn/tzwang/pcm-coordinator/internal/types"
"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 GetRunningInstanceByModelHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetRunningInstanceReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
result.ParamErrorResult(r, w, err)
return
}
l := inference.NewGetRunningInstanceByModelLogic(r.Context(), svcCtx)
resp, err := l.GetRunningInstanceByModel(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
result.HttpResult(r, w, resp, err)
}
}

View File

@ -3,8 +3,8 @@ package inference
import (
"context"
"gitlink.org.cn/tzwang/pcm-coordinator/internal/svc"
"gitlink.org.cn/tzwang/pcm-coordinator/internal/types"
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
@ -24,7 +24,7 @@ func NewGetRunningInstanceByModelLogic(ctx context.Context, svcCtx *svc.ServiceC
}
func (l *GetRunningInstanceByModelLogic) GetRunningInstanceByModel(req *types.GetRunningInstanceReq) (resp *types.GetRunningInstanceResp, err error) {
// todo: add your logic here and delete this line
resp = &types.GetRunningInstanceResp{}
return
}

View File

@ -82,6 +82,7 @@ var (
"image_classification": {"imagenet_resnet50"},
"text_to_text": {"chatGLM_6B"},
"image_to_text": {"blip-image-captioning-base"},
"text_to_image": {"stable-diffusion-xl-base-1.0"},
}
AITYPE = map[string]string{
"1": OCTOPUS,