MCPcopy Create free account
hub / github.com/53AI/53AIHub / BatchUpdateLibrarySort

Function BatchUpdateLibrarySort

api/controller/library.go:479–507  ·  view source on GitHub ↗

BatchUpdateLibrarySort godoc @Summary 批量更新知识库排序 @Description 批量更新知识库的排序顺序 @Tags 知识库管理 @Accept json @Produce json @Security BearerAuth @Param request body LibrarySortRequest true "知识库排序信息" @Success 200 {object} model.CommonResponse @Router /api/libraries/sort [post]

(c *gin.Context)

Source from the content-addressed store, hash-verified

477// @Success 200 {object} model.CommonResponse
478// @Router /api/libraries/sort [post]
479func BatchUpdateLibrarySort(c *gin.Context) {
480 eid := config.GetEID(c)
481
482 // 检查功能是否可用
483 params := map[string]interface{}{
484 "from": "library",
485 }
486 _, err := service.IsFeatureAvailable(c, "knowledge_base", params)
487 if err != nil {
488 c.JSON(http.StatusForbidden, model.FeatureNotAvailableError.ToResponse(err))
489 return
490 }
491
492 var req LibrarySortRequest
493 if err := c.ShouldBindJSON(&req); err != nil {
494 c.JSON(http.StatusBadRequest, model.ParamError.ToResponse(err))
495 return
496 }
497
498 if err := model.BatchUpdateLibrarySort(eid, req.Libraries); err != nil {
499 c.JSON(http.StatusInternalServerError, model.FileError.ToResponse(err))
500 return
501 }
502
503 // 记录批量排序日志
504 LogLibraryBatchSort(c, len(req.Libraries))
505
506 c.JSON(http.StatusOK, model.Success.ToResponse(nil))
507}
508
509// GetLibraryQueries godoc
510// @Summary 获取知识库查询历史

Callers

nothing calls this directly

Calls 3

LogLibraryBatchSortFunction · 0.85
GetEIDMethod · 0.80
ToResponseMethod · 0.80

Tested by

no test coverage detected