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

Function SearchEntityFiles

api/controller/entity.go:635–656  ·  view source on GitHub ↗

SearchEntityFiles godoc @Summary 根据实体名称搜索文件 @Description 根据实体名称在向量库中检索,返回命中的实体信息、分数及关联的文件ID列表 @Tags 实体管理 @Accept json @Produce json @Security BearerAuth @Param name query string true "实体名称" @Param top_k query int false "返回结果数量" default(10) @Success 200 {object} model.CommonResponse{data=[]rag.Entity

(c *gin.Context)

Source from the content-addressed store, hash-verified

633// @Success 200 {object} model.CommonResponse{data=[]rag.EntitySearchHit}
634// @Router /api/entities/search-files [get]
635func SearchEntityFiles(c *gin.Context) {
636 eid := config.GetEID(c)
637 if eid <= 0 {
638 c.JSON(http.StatusBadRequest, model.ParamError.ToNewErrorResponse(model.InvalidEnterpriseID))
639 return
640 }
641
642 var req SearchEntityFilesRequest
643 if err := c.ShouldBindQuery(&req); err != nil {
644 c.JSON(http.StatusBadRequest, model.ParamError.ToResponse(err))
645 return
646 }
647
648 svc := rag.NewEntityVectorService(model.DB)
649 hits, err := svc.SearchEntityFiles(eid, req.Name, req.TopK)
650 if err != nil {
651 c.JSON(http.StatusInternalServerError, model.SystemError.ToResponse(err))
652 return
653 }
654
655 c.JSON(http.StatusOK, model.Success.ToResponse(hits))
656}

Callers

nothing calls this directly

Calls 4

SearchEntityFilesMethod · 0.95
GetEIDMethod · 0.80
ToNewErrorResponseMethod · 0.80
ToResponseMethod · 0.80

Tested by

no test coverage detected