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

Method DeleteMultipleKeys

internal/handler/key_handler.go:241–269  ·  view source on GitHub ↗

DeleteMultipleKeys handles deleting keys from a text block within a specific group.

(c *gin.Context)

Source from the content-addressed store, hash-verified

239
240// DeleteMultipleKeys handles deleting keys from a text block within a specific group.
241func (s *Server) DeleteMultipleKeys(c *gin.Context) {
242 var req KeyTextRequest
243 if err := c.ShouldBindJSON(&req); err != nil {
244 response.Error(c, app_errors.NewAPIError(app_errors.ErrInvalidJSON, err.Error()))
245 return
246 }
247
248 if _, ok := s.findGroupByID(c, req.GroupID); !ok {
249 return
250 }
251
252 if !validateKeysText(c, req.KeysText) {
253 return
254 }
255
256 result, err := s.KeyService.DeleteMultipleKeys(req.GroupID, req.KeysText)
257 if err != nil {
258 if strings.Contains(err.Error(), "batch size exceeds the limit") {
259 response.Error(c, app_errors.NewAPIError(app_errors.ErrValidation, err.Error()))
260 } else if err.Error() == "no valid keys found in the input text" {
261 response.Error(c, app_errors.NewAPIError(app_errors.ErrValidation, err.Error()))
262 } else {
263 response.Error(c, app_errors.ParseDBError(err))
264 }
265 return
266 }
267
268 response.Success(c, result)
269}
270
271// DeleteMultipleKeysAsync handles deleting keys from a text block within a specific group using async task.
272func (s *Server) DeleteMultipleKeysAsync(c *gin.Context) {

Callers

nothing calls this directly

Calls 5

findGroupByIDMethod · 0.95
ErrorFunction · 0.92
SuccessFunction · 0.92
validateKeysTextFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected