feat(docreader): support forcing PDF scanned-page OCR parsing
This commit is contained in:
@@ -10,6 +10,10 @@ type KnowledgeProcessOverrides struct {
|
||||
QuestionGenerationConfig *QuestionGenerationConfig `json:"question_generation_config,omitempty"`
|
||||
GraphEnabled *bool `json:"graph_enabled,omitempty"`
|
||||
ExtractConfig *ExtractConfig `json:"extract_config,omitempty"`
|
||||
// ParserEngineOverrides passes key-value configuration to docreader parsers
|
||||
// (e.g. pdf_force_scanned=true). Merged with tenant-level overrides in the
|
||||
// parse pipeline; per-upload values take priority on conflict.
|
||||
ParserEngineOverrides map[string]string `json:"parser_engine_overrides,omitempty"`
|
||||
}
|
||||
|
||||
// EffectiveProcessConfig is the merged view used by the parse pipeline.
|
||||
|
||||
@@ -13,8 +13,9 @@ func boolPtr(v bool) *bool {
|
||||
func TestKnowledgeProcessOverridesRoundtrip(t *testing.T) {
|
||||
k := &Knowledge{}
|
||||
overrides := &KnowledgeProcessOverrides{
|
||||
EnableMultimodel: boolPtr(true),
|
||||
ChunkingConfig: &ChunkingConfig{ChunkSize: 1024},
|
||||
EnableMultimodel: boolPtr(true),
|
||||
ChunkingConfig: &ChunkingConfig{ChunkSize: 1024},
|
||||
ParserEngineOverrides: map[string]string{"pdf_force_scanned": "true"},
|
||||
}
|
||||
require.NoError(t, k.SetProcessOverrides(overrides))
|
||||
got, err := k.ProcessOverrides()
|
||||
@@ -22,6 +23,7 @@ func TestKnowledgeProcessOverridesRoundtrip(t *testing.T) {
|
||||
require.NotNil(t, got)
|
||||
require.True(t, *got.EnableMultimodel)
|
||||
require.Equal(t, 1024, got.ChunkingConfig.ChunkSize)
|
||||
require.Equal(t, "true", got.ParserEngineOverrides["pdf_force_scanned"])
|
||||
}
|
||||
|
||||
func TestSetProcessOverridesPreservesOtherMetadata(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user