feat(knowledge): implement knowledge item rebuild confirmation dialog and enhance chunk processing options
- Added a confirmation dialog for rebuilding knowledge items in the KnowledgeBase component. - Introduced new state variables to manage the rebuild process and item selection. - Enhanced the processChunks function to support question generation options based on configuration. - Updated the knowledge service to handle question generation settings during document processing.
This commit is contained in:
@@ -1344,7 +1344,15 @@ func (s *knowledgeService) processDocumentFromPassage(ctx context.Context,
|
||||
start = end
|
||||
}
|
||||
// Process and store chunks
|
||||
s.processChunks(ctx, kb, knowledge, chunks)
|
||||
var opts ProcessChunksOptions
|
||||
if kb.QuestionGenerationConfig != nil && kb.QuestionGenerationConfig.Enabled {
|
||||
opts.EnableQuestionGeneration = true
|
||||
opts.QuestionCount = kb.QuestionGenerationConfig.QuestionCount
|
||||
if opts.QuestionCount <= 0 {
|
||||
opts.QuestionCount = 3
|
||||
}
|
||||
}
|
||||
s.processChunks(ctx, kb, knowledge, chunks, opts)
|
||||
}
|
||||
|
||||
// ProcessChunksOptions contains options for processing chunks
|
||||
@@ -6848,6 +6856,13 @@ func (s *knowledgeService) triggerManualProcessing(ctx context.Context,
|
||||
EnableMultimodel: kb.IsMultimodalEnabled() && len(resolvedImages) > 0,
|
||||
StoredImages: resolvedImages,
|
||||
}
|
||||
if kb.QuestionGenerationConfig != nil && kb.QuestionGenerationConfig.Enabled {
|
||||
opts.EnableQuestionGeneration = true
|
||||
opts.QuestionCount = kb.QuestionGenerationConfig.QuestionCount
|
||||
if opts.QuestionCount <= 0 {
|
||||
opts.QuestionCount = 3
|
||||
}
|
||||
}
|
||||
|
||||
if kb.ChunkingConfig.EnableParentChild {
|
||||
parentCfg, childCfg := buildParentChildConfigs(kb.ChunkingConfig, chunkCfg)
|
||||
@@ -7473,7 +7488,11 @@ func (s *knowledgeService) ProcessDocument(ctx context.Context, t *asynq.Task) e
|
||||
})
|
||||
start = end
|
||||
}
|
||||
s.processChunks(ctx, kb, knowledge, passageChunks)
|
||||
passageOpts := ProcessChunksOptions{
|
||||
EnableQuestionGeneration: payload.EnableQuestionGeneration,
|
||||
QuestionCount: payload.QuestionCount,
|
||||
}
|
||||
s.processChunks(ctx, kb, knowledge, passageChunks, passageOpts)
|
||||
return nil
|
||||
} else {
|
||||
// File import
|
||||
|
||||
Reference in New Issue
Block a user