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)
| 1077 | // @Failure 500 {object} types.APIInternalServerError "Internal server error" |
| 1078 | // @Router /runtime_framework/{id} [delete] |
| 1079 | func (h *ModelHandler) DeleteModelRuntimeFrameworks(ctx *gin.Context) { |
| 1080 | currentUser := httpbase.GetCurrentUser(ctx) |
| 1081 | if currentUser == "" { |
| 1082 | httpbase.UnauthorizedError(ctx, component.ErrUserNotFound) |
| 1083 | return |
| 1084 | } |
| 1085 | |
| 1086 | var req types.RuntimeFrameworkModels |
| 1087 | if err := ctx.ShouldBindJSON(&req); err != nil { |
| 1088 | slog.Error("Bad request format", "error", err) |
| 1089 | httpbase.BadRequest(ctx, err.Error()) |
| 1090 | return |
| 1091 | } |
| 1092 | |
| 1093 | id, err := strconv.ParseInt(ctx.Param("id"), 10, 64) |
| 1094 | if err != nil { |
| 1095 | slog.Error("Bad request format", "error", err) |
| 1096 | httpbase.BadRequest(ctx, err.Error()) |
| 1097 | return |
| 1098 | } |
| 1099 | |
| 1100 | deployTypeStr := ctx.Query("deploy_type") |
| 1101 | if deployTypeStr == "" { |
| 1102 | // backward compatibility for inferences |
| 1103 | deployTypeStr = strconv.Itoa(types.InferenceType) |
| 1104 | } |
| 1105 | deployType, err := strconv.Atoi(deployTypeStr) |
| 1106 | if err != nil { |
| 1107 | slog.Error("Bad request format", "error", err) |
| 1108 | httpbase.BadRequest(ctx, err.Error()) |
| 1109 | return |
| 1110 | } |
| 1111 | |
| 1112 | slog.Info("update runtime frameworks models", slog.Any("req", req), slog.Any("runtime framework id", id), slog.Any("deployType", deployType)) |
| 1113 | |
| 1114 | list, err := h.c.DeleteRuntimeFrameworkModes(ctx, currentUser, deployType, id, req.Models) |
| 1115 | if err != nil { |
| 1116 | slog.Error("Failed to set models runtime framework", slog.Any("error", err)) |
| 1117 | httpbase.ServerError(ctx, err) |
| 1118 | return |
| 1119 | } |
| 1120 | |
| 1121 | httpbase.OK(ctx, list) |
| 1122 | } |
| 1123 | |
| 1124 | // GetRuntimeFrameworkModels godoc |
| 1125 | // @Security ApiKey |
nothing calls this directly
no test coverage detected