Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Fix: remove duplicate list function (#20648)

Lynn3cdb3cac6729
diff --git a/internal/dao/compilation_template_group.go b/internal/dao/compilation_template_group.go
index 5b11ef47f4..b3890337af 100644
--- a/internal/dao/compilation_template_group.go
+++ b/internal/dao/compilation_template_group.go
@@ -52,25 +52,6 @@ func (dao *CompilationTemplateGroupDAO) ListSaved(ctx context.Context, db *gorm.
return groups, nil
}
-// ListOwnedSaved returns only the tenant's own valid groups, mirroring the
-// Python list_saved() query (cls.model.tenant_id == tenant_id). The merged
-// /agents list uses this for tenant-owned canvas groups.
-func (dao *CompilationTemplateGroupDAO) ListOwnedSaved(ctx context.Context, db *gorm.DB, tenantID, keywords, scope string, terms []OrderTerm) ([]*entity.CompilationTemplateGroup, error) {
- q := db.WithContext(ctx).
- Where("tenant_id = ? AND status = ?", tenantID, string(entity.StatusValid))
- if keywords != "" {
- q = q.Where("name LIKE ?", "%"+keywords+"%")
- }
- if scope != "" {
- q = q.Where("scope = ?", scope)
- }
- var groups []*entity.CompilationTemplateGroup
- if err := q.Order(compilationTemplateGroupOrderClause(terms)).Find(&groups).Error; err != nil {
- return nil, err
- }
- return groups, nil
-}
-
// CountSavedByTenant counts the tenant's own valid groups, mirroring the
// group_count query in Python get_owner_filter / get_category_filter.
func (dao *CompilationTemplateGroupDAO) CountSavedByTenant(ctx context.Context, db *gorm.DB, tenantID string) (int64, error) {
diff --git a/internal/service/agent.go b/internal/service/agent.go
index 7a4fd9d8c2..ff5a2d9c45 100644
--- a/internal/service/agent.go
+++ b/internal/service/agent.go
@@ -709,7 +709,7 @@ func (s *AgentService) ListAgents(ctx context.Context, userID string, keywords s
// listAgentsGroupsOnly returns only the caller's compilation template groups
// (Python canvas_category == ["compilation_template_group"] branch).
func (s *AgentService) listAgentsGroupsOnly(ctx context.Context, userID, keywords string, terms []dao.OrderTerm, page, pageSize int) (*ListAgentsResponse, common.ErrorCode, error) {
- groups, err := s.compilationTemplateGroupDAO.ListOwnedSaved(ctx, dao.DB, userID, keywords, "", terms)
+ groups, err := s.compilationTemplateGroupDAO.ListSaved(ctx, dao.DB, userID, keywords, "", terms)
if err != nil {
return nil, common.CodeServerError, fmt.Errorf("failed to list compilation template groups: %w", err)
}
@@ -731,7 +731,7 @@ func (s *AgentService) listAgentsGroupsOnly(ctx context.Context, userID, keyword
// mirrors Python's merged /agents response. A stable sort retains the original
// agent-before-group order when timestamps are equal.
func (s *AgentService) mergeAgentsAndGroups(ctx context.Context, userID string, agentItems []*AgentItem, keywords string, terms []dao.OrderTerm, page, pageSize int) (*ListAgentsResponse, common.ErrorCode, error) {
- groups, err := s.compilationTemplateGroupDAO.ListOwnedSaved(ctx, dao.DB, userID, keywords, "", terms)
+ groups, err := s.compilationTemplateGroupDAO.ListSaved(ctx, dao.DB, userID, keywords, "", terms)
if err != nil {
return nil, common.CodeServerError, fmt.Errorf("failed to list compilation template groups: %w", err)
}