MCPcopy Index your code
hub / github.com/aiprodcoder/MIXAPI / GetUserModels

Function GetUserModels

controller/user.go:418–443  ·  view source on GitHub ↗
(c *gin.Context)

Source from the content-addressed store, hash-verified

416}
417
418func GetUserModels(c *gin.Context) {
419 id, err := strconv.Atoi(c.Param("id"))
420 if err != nil {
421 id = c.GetInt("id")
422 }
423 user, err := model.GetUserCache(id)
424 if err != nil {
425 common.ApiError(c, err)
426 return
427 }
428 groups := setting.GetUserUsableGroups(user.Group)
429 var models []string
430 for group := range groups {
431 for _, g := range model.GetGroupEnabledModels(group) {
432 if !common.StringsContains(models, g) {
433 models = append(models, g)
434 }
435 }
436 }
437 c.JSON(http.StatusOK, gin.H{
438 "success": true,
439 "message": "",
440 "data": models,
441 })
442 return
443}
444
445func UpdateUser(c *gin.Context) {
446 var updatedUser model.User

Callers

nothing calls this directly

Calls 5

GetUserCacheFunction · 0.92
ApiErrorFunction · 0.92
GetUserUsableGroupsFunction · 0.92
GetGroupEnabledModelsFunction · 0.92
StringsContainsFunction · 0.92

Tested by

no test coverage detected