feat: implement reparse functionality with process configuration support
- Enhanced the `reparseKnowledge` function to accept optional process configuration overrides, allowing users to adjust parsing settings during reparse operations. - Updated the frontend components to integrate reparse capabilities, including the `UploadConfirmDialog` and `KnowledgeBase` views, providing a user-friendly interface for confirming reparse actions. - Added new localization strings for reparse confirmation and process configuration details in multiple languages. - Modified the backend API to handle reparse requests with optional configuration, ensuring proper validation and persistence of overrides. - Introduced new types and interfaces to manage reparse-specific data structures in the store, improving type safety and clarity in the codebase.
This commit is contained in:
@@ -121,6 +121,25 @@ func ApplyKnowledgeProcessOverrides(
|
||||
return eff, nil
|
||||
}
|
||||
|
||||
// reparseFileTypes derives the file types used to validate overrides on reparse.
|
||||
// Manual knowledge has no file; URL imports validate as html.
|
||||
func reparseFileTypes(k *types.Knowledge) []string {
|
||||
if k == nil || k.IsManual() {
|
||||
return nil
|
||||
}
|
||||
if k.Type == "url" {
|
||||
return []string{"html"}
|
||||
}
|
||||
ft := k.FileType
|
||||
if ft == "" && k.FileName != "" {
|
||||
ft = getFileType(k.FileName)
|
||||
}
|
||||
if ft == "" {
|
||||
return nil
|
||||
}
|
||||
return []string{ft}
|
||||
}
|
||||
|
||||
func defaultQuestionGenerationConfig(kb *types.KnowledgeBase) types.QuestionGenerationConfig {
|
||||
if kb == nil || kb.QuestionGenerationConfig == nil {
|
||||
return types.QuestionGenerationConfig{}
|
||||
|
||||
Reference in New Issue
Block a user