feat: implement knowledge move functionality

- Added API endpoints for moving knowledge items between knowledge bases, including validation for source and target compatibility.
- Implemented asynchronous task handling for knowledge moves, tracking progress and status updates.
- Introduced new localization strings for move-related UI elements in English, Korean, Russian, and Chinese.
- Enhanced the frontend to support knowledge move operations, including target selection and progress monitoring.

These changes significantly improve the application's capabilities for managing knowledge across different bases, providing users with a seamless experience in organizing their knowledge assets.
This commit is contained in:
wizardchen
2026-03-09 13:14:42 +08:00
committed by lyingbug
parent 33ccc41bea
commit 125d3e5e4a
16 changed files with 1015 additions and 5 deletions
+7
View File
@@ -420,6 +420,13 @@ func (r *chunkRepository) DeleteByKnowledgeList(ctx context.Context, tenantID ui
).Delete(&types.Chunk{}).Error
}
// MoveChunksByKnowledgeID updates knowledge_base_id for all chunks of a knowledge item
func (r *chunkRepository) MoveChunksByKnowledgeID(ctx context.Context, tenantID uint64, knowledgeID string, targetKBID string) error {
return r.db.WithContext(ctx).Model(&types.Chunk{}).
Where("tenant_id = ? AND knowledge_id = ?", tenantID, knowledgeID).
Update("knowledge_base_id", targetKBID).Error
}
// DeleteChunksByTagID deletes all chunks with the specified tag ID
// Returns the IDs of deleted chunks for index cleanup
func (r *chunkRepository) DeleteChunksByTagID(ctx context.Context, tenantID uint64, kbID string, tagID string, excludeIDs []string) ([]string, error) {