From aaf7cf3cb58031e55e44c262bdb1301e5076b6fd Mon Sep 17 00:00:00 2001 From: tzwang Date: Mon, 26 Aug 2024 15:02:01 +0800 Subject: [PATCH] updated getRunninginstances logic Former-commit-id: 437d3a36b7ff32d08a2760cc360856f784115775 --- .../inference/getrunninginstancebymodelhandler.go | 15 ++++++--------- .../inference/getrunninginstancebymodellogic.go | 6 +++--- internal/storeLink/storeLink.go | 1 + 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/internal/handler/inference/getrunninginstancebymodelhandler.go b/internal/handler/inference/getrunninginstancebymodelhandler.go index 534796c9..8075a73e 100644 --- a/internal/handler/inference/getrunninginstancebymodelhandler.go +++ b/internal/handler/inference/getrunninginstancebymodelhandler.go @@ -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) } } diff --git a/internal/logic/inference/getrunninginstancebymodellogic.go b/internal/logic/inference/getrunninginstancebymodellogic.go index 7ffef4c7..1e598dad 100644 --- a/internal/logic/inference/getrunninginstancebymodellogic.go +++ b/internal/logic/inference/getrunninginstancebymodellogic.go @@ -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 } diff --git a/internal/storeLink/storeLink.go b/internal/storeLink/storeLink.go index a59591ca..8c7dc042 100644 --- a/internal/storeLink/storeLink.go +++ b/internal/storeLink/storeLink.go @@ -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,