UpdateModelRuntime godoc @Security ApiKey @Summary Set model runtime frameworks @Description set model runtime frameworks @Tags RuntimeFramework @Accept json @Produce json @Param id path int true "runtime framework id" @Param deploy_type query int false "deploy
(ctx *gin.Context)
| 1017 | // @Failure 500 {object} types.APIInternalServerError "Internal server error" |
| 1018 | // @Router /runtime_framework/{id} [post] |
| 1019 | func (h *ModelHandler) UpdateModelRuntimeFrameworks(ctx *gin.Context) { |
| 1020 | currentUser := httpbase.GetCurrentUser(ctx) |
| 1021 | if currentUser == "" { |
| 1022 | httpbase.UnauthorizedError(ctx, component.ErrUserNotFound) |
| 1023 | return |
| 1024 | } |
| 1025 | |
| 1026 | var req types.RuntimeFrameworkModels |
| 1027 | if err := ctx.ShouldBindJSON(&req); err != nil { |
| 1028 | slog.Error("Bad request format", "error", err) |
| 1029 | httpbase.BadRequest(ctx, err.Error()) |
| 1030 | return |
| 1031 | } |
| 1032 | |
| 1033 | id, err := strconv.ParseInt(ctx.Param("id"), 10, 64) |
| 1034 | if err != nil { |
| 1035 | slog.Error("Bad request format", "error", err) |
| 1036 | httpbase.BadRequest(ctx, err.Error()) |
| 1037 | return |
| 1038 | } |
| 1039 | |
| 1040 | deployTypeStr := ctx.Query("deploy_type") |
| 1041 | if deployTypeStr == "" { |
| 1042 | // backward compatibility for inferences |
| 1043 | deployTypeStr = strconv.Itoa(types.InferenceType) |
| 1044 | } |
| 1045 | deployType, err := strconv.Atoi(deployTypeStr) |
| 1046 | if err != nil { |
| 1047 | slog.Error("Bad request format", "error", err) |
| 1048 | httpbase.BadRequest(ctx, err.Error()) |
| 1049 | return |
| 1050 | } |
| 1051 | |
| 1052 | slog.Info("update runtime frameworks models", slog.Any("req", req), slog.Any("runtime framework id", id), slog.Any("deployType", deployType)) |
| 1053 | |
| 1054 | list, err := h.c.SetRuntimeFrameworkModes(ctx, currentUser, deployType, id, req.Models) |
| 1055 | if err != nil { |
| 1056 | slog.Error("Failed to set models runtime framework", slog.Any("error", err)) |
| 1057 | httpbase.ServerError(ctx, err) |
| 1058 | return |
| 1059 | } |
| 1060 | |
| 1061 | httpbase.OK(ctx, list) |
| 1062 | } |
| 1063 | |
| 1064 | // UpdateModelRuntime godoc |
| 1065 | // @Security ApiKey |
nothing calls this directly
no test coverage detected