feat(kbshare): enhance sharing functionality with soft-delete handling and shared access

- Updated ListByOrganization and ListSharedKBsForUser methods to exclude soft-deleted knowledge bases and organizations, improving data integrity.
- Modified knowledge fetching methods to include documents from shared knowledge bases the user has access to, enhancing user experience.
- Improved comments for clarity on functionality and permission checks in UpdateSharePermission method.

This update strengthens the sharing capabilities and ensures users only see relevant knowledge bases, enhancing overall application usability.
This commit is contained in:
wizardchen
2026-02-02 17:28:48 +08:00
committed by lyingbug
parent 342e56735f
commit b3d743a0a9
5 changed files with 24 additions and 14 deletions
@@ -551,8 +551,8 @@ func (s *agentService) getSelectedDocumentInfos(ctx context.Context, knowledgeID
tenantID = tid
}
// Fetch knowledge metadata
knowledges, err := s.knowledgeService.GetKnowledgeBatch(ctx, tenantID, knowledgeIDs)
// Fetch knowledge metadata (include docs from shared KBs the user has access to)
knowledges, err := s.knowledgeService.GetKnowledgeBatchWithSharedAccess(ctx, tenantID, knowledgeIDs)
if err != nil {
return nil, fmt.Errorf("failed to get knowledge batch: %w", err)
}