| @@ -8,6 +8,7 @@ import ( | |||||
| "net/http" | "net/http" | ||||
| "net/url" | "net/url" | ||||
| "path" | "path" | ||||
| "regexp" | |||||
| "strings" | "strings" | ||||
| "code.gitea.io/gitea/models" | "code.gitea.io/gitea/models" | ||||
| @@ -85,6 +86,7 @@ func saveModelByParameters(jobId string, versionName string, name string, versio | |||||
| accuracy["Precision"] = "" | accuracy["Precision"] = "" | ||||
| accuracyJson, _ := json.Marshal(accuracy) | accuracyJson, _ := json.Marshal(accuracy) | ||||
| log.Info("accuracyJson=" + string(accuracyJson)) | log.Info("accuracyJson=" + string(accuracyJson)) | ||||
| aiTask.ContainerIp = "" | |||||
| aiTaskJson, _ := json.Marshal(aiTask) | aiTaskJson, _ := json.Marshal(aiTask) | ||||
| model := &models.AiModelManage{ | model := &models.AiModelManage{ | ||||
| @@ -635,16 +637,23 @@ func ShowSingleModel(ctx *context.Context) { | |||||
| userNameMap := queryUserName(userIds) | userNameMap := queryUserName(userIds) | ||||
| for _, model := range models { | for _, model := range models { | ||||
| removeIpInfo(model) | |||||
| value := userNameMap[model.UserId] | value := userNameMap[model.UserId] | ||||
| if value != nil { | if value != nil { | ||||
| model.UserName = value.Name | model.UserName = value.Name | ||||
| model.UserRelAvatarLink = value.RelAvatarLink() | model.UserRelAvatarLink = value.RelAvatarLink() | ||||
| model.TrainTaskInfo = "" | |||||
| } | } | ||||
| } | } | ||||
| ctx.JSON(http.StatusOK, models) | ctx.JSON(http.StatusOK, models) | ||||
| } | } | ||||
| func removeIpInfo(model *models.AiModelManage) { | |||||
| reg, _ := regexp.Compile(`[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}`) | |||||
| taskInfo := model.TrainTaskInfo | |||||
| taskInfo = reg.ReplaceAllString(taskInfo, "") | |||||
| model.TrainTaskInfo = taskInfo | |||||
| } | |||||
| func queryUserName(intSlice []int64) map[int64]*models.User { | func queryUserName(intSlice []int64) map[int64]*models.User { | ||||
| keys := make(map[int64]string) | keys := make(map[int64]string) | ||||
| uniqueElements := []int64{} | uniqueElements := []int64{} | ||||
| @@ -678,6 +687,7 @@ func ShowOneVersionOtherModel(ctx *context.Context) { | |||||
| userNameMap := queryUserName(userIds) | userNameMap := queryUserName(userIds) | ||||
| for _, model := range aimodels { | for _, model := range aimodels { | ||||
| removeIpInfo(model) | |||||
| value := userNameMap[model.UserId] | value := userNameMap[model.UserId] | ||||
| if value != nil { | if value != nil { | ||||
| model.UserName = value.Name | model.UserName = value.Name | ||||
| @@ -788,13 +798,13 @@ func ShowModelPageInfo(ctx *context.Context) { | |||||
| for i, model := range modelResult { | for i, model := range modelResult { | ||||
| model.IsCanOper = isOper(ctx, model.UserId) | model.IsCanOper = isOper(ctx, model.UserId) | ||||
| model.IsCanDelete = isCanDelete(ctx, model.UserId) | model.IsCanDelete = isCanDelete(ctx, model.UserId) | ||||
| model.TrainTaskInfo = "" | |||||
| userIds[i] = model.UserId | userIds[i] = model.UserId | ||||
| } | } | ||||
| userNameMap := queryUserName(userIds) | userNameMap := queryUserName(userIds) | ||||
| for _, model := range modelResult { | for _, model := range modelResult { | ||||
| removeIpInfo(model) | |||||
| value := userNameMap[model.UserId] | value := userNameMap[model.UserId] | ||||
| if value != nil { | if value != nil { | ||||
| model.UserName = value.Name | model.UserName = value.Name | ||||
| @@ -868,6 +878,7 @@ func QueryModelListForPredict(ctx *context.Context) { | |||||
| nameMap := make(map[string][]*models.AiModelManage) | nameMap := make(map[string][]*models.AiModelManage) | ||||
| for _, model := range modelResult { | for _, model := range modelResult { | ||||
| removeIpInfo(model) | |||||
| if _, value := nameMap[model.Name]; !value { | if _, value := nameMap[model.Name]; !value { | ||||
| models := make([]*models.AiModelManage, 0) | models := make([]*models.AiModelManage, 0) | ||||
| models = append(models, model) | models = append(models, model) | ||||