MCPcopy Create free account
hub / github.com/tbphp/gpt-load / CreateGroup

Method CreateGroup

internal/handler/group_handler.go:69–100  ·  view source on GitHub ↗

CreateGroup handles the creation of a new group.

(c *gin.Context)

Source from the content-addressed store, hash-verified

67
68// CreateGroup handles the creation of a new group.
69func (s *Server) CreateGroup(c *gin.Context) {
70 var req GroupCreateRequest
71 if err := c.ShouldBindJSON(&req); err != nil {
72 response.Error(c, app_errors.NewAPIError(app_errors.ErrInvalidJSON, err.Error()))
73 return
74 }
75
76 params := services.GroupCreateParams{
77 Name: req.Name,
78 DisplayName: req.DisplayName,
79 Description: req.Description,
80 GroupType: req.GroupType,
81 Upstreams: req.Upstreams,
82 ChannelType: req.ChannelType,
83 Sort: req.Sort,
84 TestModel: req.TestModel,
85 ValidationEndpoint: req.ValidationEndpoint,
86 ParamOverrides: req.ParamOverrides,
87 ModelRedirectRules: req.ModelRedirectRules,
88 ModelRedirectStrict: req.ModelRedirectStrict,
89 Config: req.Config,
90 HeaderRules: req.HeaderRules,
91 ProxyKeys: req.ProxyKeys,
92 }
93
94 group, err := s.GroupService.CreateGroup(c.Request.Context(), params)
95 if s.handleGroupError(c, err) {
96 return
97 }
98
99 response.Success(c, s.newGroupResponse(group))
100}
101
102// ListGroups handles listing all groups.
103func (s *Server) ListGroups(c *gin.Context) {

Callers

nothing calls this directly

Calls 5

handleGroupErrorMethod · 0.95
newGroupResponseMethod · 0.95
ErrorFunction · 0.92
SuccessFunction · 0.92
ErrorMethod · 0.45

Tested by

no test coverage detected