feat: Enhance FAQ import functionality and UI improvements
- Added support for tracking the status of FAQ import tasks, including progress indicators for ongoing imports. - Introduced new localization strings for processing tasks and batch operations in multiple languages. - Updated the FAQ entry manager to display import progress and improved user feedback during the import process. - Enhanced the KnowledgeBase component to reflect the processing state of knowledge items, improving user experience during document uploads. - Implemented batch deletion functionality for chunks, streamlining the management of knowledge base content.
This commit is contained in:
@@ -58,8 +58,6 @@ func (s *chunkService) GetRepository() interfaces.ChunkRepository {
|
||||
// Returns:
|
||||
// - error: Any error encountered during chunk creation
|
||||
func (s *chunkService) CreateChunks(ctx context.Context, chunks []*types.Chunk) error {
|
||||
logger.Info(ctx, "Start creating chunks")
|
||||
logger.Infof(ctx, "Creating %d chunks", len(chunks))
|
||||
|
||||
err := s.chunkRepository.CreateChunks(ctx, chunks)
|
||||
if err != nil {
|
||||
@@ -69,7 +67,7 @@ func (s *chunkService) CreateChunks(ctx context.Context, chunks []*types.Chunk)
|
||||
return err
|
||||
}
|
||||
|
||||
logger.Info(ctx, "Chunks created successfully")
|
||||
logger.Infof(ctx, "Add %d chunks successfully", len(chunks))
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -216,6 +214,37 @@ func (s *chunkService) DeleteChunk(ctx context.Context, id string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeleteChunks deletes chunks by IDs in batch
|
||||
// This method removes multiple chunks from the repository in a single operation
|
||||
// Parameters:
|
||||
// - ctx: Context with authentication and request information
|
||||
// - ids: Slice of chunk IDs to delete
|
||||
//
|
||||
// Returns:
|
||||
// - error: Any error encountered during batch deletion
|
||||
func (s *chunkService) DeleteChunks(ctx context.Context, ids []string) error {
|
||||
if len(ids) == 0 {
|
||||
return nil
|
||||
}
|
||||
logger.Info(ctx, "Start deleting chunks in batch")
|
||||
logger.Infof(ctx, "Deleting %d chunks", len(ids))
|
||||
|
||||
tenantID := ctx.Value(types.TenantIDContextKey).(uint)
|
||||
logger.Infof(ctx, "Tenant ID: %d", tenantID)
|
||||
|
||||
err := s.chunkRepository.DeleteChunks(ctx, tenantID, ids)
|
||||
if err != nil {
|
||||
logger.ErrorWithFields(ctx, err, map[string]interface{}{
|
||||
"chunk_ids": ids,
|
||||
"tenant_id": tenantID,
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
logger.Infof(ctx, "Successfully deleted %d chunks", len(ids))
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeleteChunksByKnowledgeID deletes all chunks for a knowledge ID
|
||||
// This method removes all chunks belonging to a specific knowledge document
|
||||
// Parameters:
|
||||
|
||||
Reference in New Issue
Block a user