Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

fix(ingestion): persist and honor global vision settings (#20474)

jay77721e8f7f97237d8
diff --git a/internal/ingestion/component/dispatch_model.go b/internal/ingestion/component/dispatch_model.go
index ed8640512e..24647d634a 100644
--- a/internal/ingestion/component/dispatch_model.go
+++ b/internal/ingestion/component/dispatch_model.go
@@ -45,16 +45,8 @@ var resolveTenantModelByType = defaultResolveTenantModelByType
// per-call model-selection tests can inject a fake without a live MySQL.
var resolveModelConfig = defaultResolveModelConfig
-// configuredMediaModelID extracts a per-call model reference from a parser setup.
-// Image parsing stores the VLM model reference in parse_method when it is not
-// an OCR method. OCR backend selection is independent of the VLM model.
-// Other media families use vlm.llm_id, matching the frontend parser form.
-func configuredMediaModelID(setup schema.ParserSetup, family string) string {
- if family == "image" {
- if ref := getStringOr(setup, "parse_method", ""); ref != "" && !strings.EqualFold(ref, "ocr") {
- return ref
- }
- }
+// configuredAudioModelID reads the audio setup's ASR model reference.
+func configuredAudioModelID(setup schema.ParserSetup) string {
if vlm, ok := setup["vlm"].(map[string]any); ok {
if ref, _ := vlm["llm_id"].(string); ref != "" {
return ref
diff --git a/internal/ingestion/component/dispatch_model_test.go b/internal/ingestion/component/dispatch_model_test.go
index 480ea64714..18b40a264f 100644
--- a/internal/ingestion/component/dispatch_model_test.go
+++ b/internal/ingestion/component/dispatch_model_test.go
@@ -21,61 +21,28 @@ import (
"ragflow/internal/ingestion/component/schema"
)
-func TestConfiguredMediaModelID(t *testing.T) {
+func TestConfiguredAudioModelID(t *testing.T) {
tests := []struct {
- name string
- family string
- setup schema.ParserSetup
- want string
+ name string
+ setup schema.ParserSetup
+ want string
}{
{
- name: "image parse_method is the VLM model ref",
- family: "image",
- setup: schema.ParserSetup{"parse_method": "gpt-4-vision@openai"},
- want: "gpt-4-vision@openai",
+ name: "audio uses vlm.llm_id",
+ setup: schema.ParserSetup{"vlm": map[string]any{"llm_id": "whisper@openai"}},
+ want: "whisper@openai",
},
{
- name: "image ocr falls back to vlm.llm_id",
- family: "image",
- setup: schema.ParserSetup{
- "parse_method": "ocr",
- "vlm": map[string]any{"llm_id": "gpt-4-vision@openai"},
- },
- want: "gpt-4-vision@openai",
- },
- {
- name: "image ocr falls back to top-level llm_id",
- family: "image",
- setup: schema.ParserSetup{"parse_method": "ocr", "llm_id": "qwen-vl@dashscope"},
- want: "qwen-vl@dashscope",
- },
- {
- name: "pdf uses vlm.llm_id",
- family: "pdf",
- setup: schema.ParserSetup{
- "parse_method": "deepdoc",
- "vlm": map[string]any{"llm_id": "custom-vlm@provider"},
- },
- want: "custom-vlm@provider",
- },
- {
- name: "audio uses vlm.llm_id",
- family: "audio",
- setup: schema.ParserSetup{"vlm": map[string]any{"llm_id": "whisper@openai"}},
- want: "whisper@openai",
- },
- {
- name: "empty setup",
- family: "pdf",
- setup: schema.ParserSetup{},
- want: "",
+ name: "empty setup",
+ setup: schema.ParserSetup{},
+ want: "",
},
}
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
- if got := configuredMediaModelID(tc.setup, tc.family); got != tc.want {
- t.Fatalf("configuredMediaModelID() = %q, want %q", got, tc.want)
+ if got := configuredAudioModelID(tc.setup); got != tc.want {
+ t.Fatalf("configuredAudioModelID() = %q, want %q", got, tc.want)
}
})
}
diff --git a/internal/ingestion/component/media_dispatch.go b/internal/ingestion/component/media_dispatch.go
index db55fcf74b..3cb76bf8e9 100644
--- a/internal/ingestion/component/media_dispatch.go
+++ b/internal/ingestion/component/media_dispatch.go
@@ -86,6 +86,7 @@ func maybeDispatchImage(
inputs map[string]any,
setups map[string]schema.ParserSetup,
enableVisionEnhancement bool,
+ visionModelID string,
) (parser.ParseResult, bool, error) {
if fileType != utility.FileTypeVISUAL {
return parser.ParseResult{}, false, nil
@@ -129,7 +130,11 @@ func maybeDispatchImage(
return parsed, true, err
}
if enableVisionEnhancement {
- description, warnings := describeImage(ctx, db, imageData, getStringOr(inputs, "tenant_id", ""), setup, inputs)
+ modelRef := visionModelID
+ if !useOCR {
+ modelRef = method
+ }
+ description, warnings := describeImage(ctx, db, imageData, getStringOr(inputs, "tenant_id", ""), setup, inputs, modelRef)
parsed.Warnings = append(parsed.Warnings, warnings...)
if description != "" {
appendItemText(parsed.JSON[0], description)
@@ -191,6 +196,7 @@ func describeImage(
tenantID string,
setup schema.ParserSetup,
inputs map[string]any,
+ modelRef string,
) (string, []string) {
// --- Optional VLM description ---
lang := resolveVisionLanguage(inputs, getStringOr(setup, "lang", ""))
@@ -198,8 +204,7 @@ func describeImage(
return "", []string{"image VLM enhancement skipped: tenant ID is missing"}
}
- // Use the configured image VLM or the tenant default.
- modelRef := configuredMediaModelID(setup, "image")
+ // Use the selected description model or the tenant default.
var driver modelModule.ModelDriver
var modelName string
var apiConfig *modelModule.APIConfig
@@ -277,7 +282,7 @@ func maybeDispatchAudio(
fmt.Errorf("parser: audio requires tenant_id")
}
- modelRef := configuredMediaModelID(setup, "audio")
+ modelRef := configuredAudioModelID(setup)
var driver modelModule.ModelDriver
var modelName string
var apiConfig *modelModule.APIConfig
diff --git a/internal/ingestion/component/media_dispatch_integration_test.go b/internal/ingestion/component/media_dispatch_integration_test.go
index 485d69f0ab..8e4ce4f4fa 100644
--- a/internal/ingestion/component/media_dispatch_integration_test.go
+++ b/internal/ingestion/component/media_dispatch_integration_test.go
@@ -27,7 +27,7 @@ func TestMaybeDispatchImageNativeOCRWithoutVision(t *testing.T) {
t.Fatal(err)
}
result, handled, err := maybeDispatchImage(t.Context(), nil, utility.FileTypeVISUAL,
- "picture_ocr.png", pictureOCRFixture, nil, defaultSetups(), false)
+ "picture_ocr.png", pictureOCRFixture, nil, defaultSetups(), false, "")
if err != nil {
t.Fatal(err)
}
diff --git a/internal/ingestion/component/media_dispatch_test.go b/internal/ingestion/component/media_dispatch_test.go
index c701a80772..23572ed780 100644
--- a/internal/ingestion/component/media_dispatch_test.go
+++ b/internal/ingestion/component/media_dispatch_test.go
@@ -197,7 +197,7 @@ func TestMaybeDispatchImage_UsesSystemPrompt(t *testing.T) {
picturePNG(t),
map[string]any{"tenant_id": "t1"},
setups,
- true,
+ true, "",
)
if err != nil {
t.Fatalf("maybeDispatchImage: %v", err)
@@ -249,7 +249,7 @@ func TestMaybeDispatchImage_DefaultPromptUsesDatasetLanguage(t *testing.T) {
picturePNG(t),
map[string]any{"tenant_id": "t1", "lang": "Japanese"},
setups,
- true,
+ true, "",
)
if err != nil {
t.Fatalf("maybeDispatchImage: %v", err)
@@ -292,7 +292,7 @@ func TestMaybeDispatchImage_ReturnsJSONWithImage(t *testing.T) {
picturePNG(t),
map[string]any{"tenant_id": "t1"},
setups,
- true,
+ true, "",
)
if err != nil {
t.Fatalf("maybeDispatchImage: %v", err)
@@ -344,7 +344,7 @@ func TestMaybeDispatchImage_HardcodesJSONOutput(t *testing.T) {
picturePNG(t),
map[string]any{"tenant_id": "t1"},
setups,
- true,
+ true, "",
)
if err != nil {
t.Fatalf("maybeDispatchImage: %v", err)
@@ -536,7 +536,7 @@ func TestMaybeDispatchImage_UsesConfiguredVLMModel(t *testing.T) {
picturePNG(t),
map[string]any{"tenant_id": "t1"},
setups,
- true,
+ true, "global-vision-model",
)
if err != nil {
t.Fatalf("maybeDispatchImage: %v", err)
@@ -663,7 +663,7 @@ func TestMaybeDispatchImageWithoutOCRTextKeepsImage(t *testing.T) {
for _, method := range []string{"ocr", ""} {
setups := defaultSetups()
setups["image"]["parse_method"] = method
- result, handled, err := maybeDispatchImage(t.Context(), nil, utility.FileTypeVISUAL, "photo.png", picturePNG(t), nil, setups, false)
+ result, handled, err := maybeDispatchImage(t.Context(), nil, utility.FileTypeVISUAL, "photo.png", picturePNG(t), nil, setups, false, "")
if err != nil {
t.Fatal(err)
}
@@ -687,7 +687,7 @@ func TestMaybeDispatchImageUnhealthyOCRKeepsImage(t *testing.T) {
deepdoctype.NativeDocAnalyzerFactory = func() (deepdoctype.DocAnalyzer, bool) {
return &unhealthyPictureOCRAnalyzer{}, true
}
- result, handled, err := maybeDispatchImage(t.Context(), nil, utility.FileTypeVISUAL, "photo.png", picturePNG(t), nil, defaultSetups(), false)
+ result, handled, err := maybeDispatchImage(t.Context(), nil, utility.FileTypeVISUAL, "photo.png", picturePNG(t), nil, defaultSetups(), false, "")
if err != nil || result.Err != nil {
t.Fatalf("unhealthy OCR should degrade without an error: err = %v, result.Err = %v", err, result.Err)
}
@@ -703,7 +703,7 @@ func TestMaybeDispatchImageRejectsUndecodableBytes(t *testing.T) {
for _, method := range []string{"ocr", "custom-vlm"} {
setups := defaultSetups()
setups["image"]["parse_method"] = method
- _, _, err := maybeDispatchImage(t.Context(), nil, utility.FileTypeVISUAL, "photo.png", []byte("bad image"), nil, setups, false)
+ _, _, err := maybeDispatchImage(t.Context(), nil, utility.FileTypeVISUAL, "photo.png", []byte("bad image"), nil, setups, false, "")
if err == nil || !strings.Contains(err.Error(), "decode") {
t.Fatalf("method %q: error = %v, want decode error", method, err)
}
@@ -723,7 +723,7 @@ func TestMaybeDispatchImageReleasesAdmissionAfterPanic(t *testing.T) {
t.Error("expected OCR analyzer panic")
}
}()
- _, _, _ = maybeDispatchImage(t.Context(), nil, utility.FileTypeVISUAL, "photo.png", data, nil, defaultSetups(), false)
+ _, _, _ = maybeDispatchImage(t.Context(), nil, utility.FileTypeVISUAL, "photo.png", data, nil, defaultSetups(), false, "")
}()
ctx, cancel := context.WithTimeout(t.Context(), time.Second)
defer cancel()
@@ -751,7 +751,7 @@ func TestMaybeDispatchImageDecodesRasterOnlyForOCR(t *testing.T) {
setups := defaultSetups()
setups["image"]["parse_method"] = method
result, handled, err := maybeDispatchImage(t.Context(), nil, utility.FileTypeVISUAL,
- "photo.png", []byte(magic), map[string]any{"tenant_id": "t1"}, setups, true)
+ "photo.png", []byte(magic), map[string]any{"tenant_id": "t1"}, setups, true, "")
if method == "ocr" {
if err == nil || !strings.Contains(err.Error(), "raster decoding requested") {
t.Fatalf("error = %v, want raster decode error", err)
diff --git a/internal/ingestion/component/parser.go b/internal/ingestion/component/parser.go
index 303a3645b0..b86edf62cf 100644
--- a/internal/ingestion/component/parser.go
+++ b/internal/ingestion/component/parser.go
@@ -112,6 +112,7 @@ const pageFormFeed = '\f'
type ParserComponent struct {
setups map[string]schema.ParserSetup
enableVisionEnhancement bool
+ visionModelID string
}
// NewParserComponent constructs a Parser from a DSL param map.
@@ -125,6 +126,7 @@ type ParserComponent struct {
//
// {
// "enable_vision_enhancement": bool,
+// "vlm": {"llm_id": string},
// "pdf": map[string]any,
// "docx": map[string]any,
// ...
@@ -149,8 +151,21 @@ func NewParserComponent(params map[string]any) (runtime.Component, error) {
return nil, errors.New("parser: enable_vision_enhancement must be a boolean")
}
}
+ var visionModelID string
+ if raw, exists := params["vlm"]; exists {
+ vlm, ok := raw.(map[string]any)
+ if !ok {
+ return nil, errors.New("parser: vlm must be an object")
+ }
+ if rawID, exists := vlm["llm_id"]; exists {
+ visionModelID, ok = rawID.(string)
+ if !ok {
+ return nil, errors.New("parser: vlm.llm_id must be a string")
+ }
+ }
+ }
for k, raw := range params {
- if k == "outputs" || k == "allowed_output_format" || k == "enable_vision_enhancement" {
+ if k == "outputs" || k == "allowed_output_format" || k == "enable_vision_enhancement" || k == "vlm" {
continue
}
ftCfg, ok := raw.(map[string]any)
@@ -165,7 +180,7 @@ func NewParserComponent(params map[string]any) (runtime.Component, error) {
}
}
normalizeParserOutputFormats(s)
- pc := &ParserComponent{setups: s, enableVisionEnhancement: enableVisionEnhancement}
+ pc := &ParserComponent{setups: s, enableVisionEnhancement: enableVisionEnhancement, visionModelID: visionModelID}
if err := pc.Check(); err != nil {
return nil, fmt.Errorf("parser: %w", err)
}
@@ -481,7 +496,7 @@ func (c *ParserComponent) Invoke(ctx context.Context, db *gorm.DB, inputs map[st
var handledImage bool
if !handledVision && !handledMedia {
// Image dispatch: OCR with independently controlled VLM enhancement.
- dispatched, handledImage, visionErr = maybeDispatchImage(ctx, db, fileTypeExt, filename, binary, inputs, setups, c.enableVisionEnhancement)
+ dispatched, handledImage, visionErr = maybeDispatchImage(ctx, db, fileTypeExt, filename, binary, inputs, setups, c.enableVisionEnhancement, c.visionModelID)
if visionErr != nil {
return nil, visionErr
}
@@ -501,7 +516,7 @@ func (c *ParserComponent) Invoke(ctx context.Context, db *gorm.DB, inputs map[st
if c.enableVisionEnhancement {
// Enhancement is optional; parser-provided text and image metadata
// remain available if a vision model cannot describe an image.
- dispatched, _, _ = maybeDispatchVisionEnhancement(ctx, db, fileTypeExt, dispatched, inputs, setups)
+ dispatched, _, _ = maybeDispatchVisionEnhancement(ctx, db, fileTypeExt, dispatched, inputs, setups, c.visionModelID)
}
}
// Known/supported families must fail loudly when dispatch or
diff --git a/internal/ingestion/component/vision_config_test.go b/internal/ingestion/component/vision_config_test.go
new file mode 100644
index 0000000000..7eacd066c9
--- /dev/null
+++ b/internal/ingestion/component/vision_config_test.go
@@ -0,0 +1,131 @@
+package component
+
+import (
+ "context"
+ "strings"
+ "testing"
+
+ "gorm.io/gorm"
+
+ deepdoctype "ragflow/internal/deepdoc/parser/type"
+ "ragflow/internal/entity"
+ modelModule "ragflow/internal/entity/models"
+)
+
+func TestParserGlobalVisionModel(t *testing.T) {
+ originalAnalyzer := deepdoctype.NativeDocAnalyzerFactory
+ deepdoctype.NativeDocAnalyzerFactory = func() (deepdoctype.DocAnalyzer, bool) { return &pictureOCRAnalyzer{}, true }
+ t.Cleanup(func() { deepdoctype.NativeDocAnalyzerFactory = originalAnalyzer })
+ for _, fileType := range []string{"html", "image"} {
+ for _, tc := range []struct {
+ name string
+ enabled bool
+ model string
+ want string
+ }{
+ {"selected", true, "model-B", "model-B"},
+ {"default", true, "", "tenant-default"},
+ {"disabled", false, "model-B", ""},
+ } {
+ t.Run(fileType+"/"+tc.name, func(t *testing.T) {
+ originalSpecific := resolveModelConfig
+ t.Cleanup(func() { resolveModelConfig = originalSpecific })
+ var resolved []string
+ swapVisionGlobals(t, func(context.Context, *gorm.DB, string, entity.ModelType) (modelModule.ModelDriver, string, *modelModule.APIConfig, int, error) {
+ resolved = append(resolved, "tenant-default")
+ return &imagePromptCaptureDriver{}, "tenant-default", &modelModule.APIConfig{}, 0, nil
+ }, (&visionEnhanceCaptureInvoker{}).invoke, fakePrompt)
+ resolveModelConfig = func(_ context.Context, _ *gorm.DB, _ string, kind entity.ModelType, ref string) (modelModule.ModelDriver, string, *modelModule.APIConfig, int, error) {
+ if kind != entity.ModelTypeImage2Text {
+ t.Fatalf("model type = %v", kind)
+ }
+ resolved = append(resolved, ref)
+ return &imagePromptCaptureDriver{}, ref, &modelModule.APIConfig{}, 0, nil
+ }
+ component, err := NewParserComponent(map[string]any{
+ "enable_vision_enhancement": tc.enabled,
+ "vlm": map[string]any{"llm_id": tc.model},
+ "html": map[string]any{"vlm": map[string]any{"llm_id": "stale-family-model"}},
+ "image": map[string]any{"parse_method": "ocr", "vlm": map[string]any{"llm_id": "stale-family-model"}},
+ })
+ if err != nil {
+ t.Fatal(err)
+ }
+ binary := picturePNG(t)
+ filename := "figure.png"
+ if fileType == "html" {
+ filename = "figure.html"
+ binary = []byte(`<p><img src="data:image/png;base64,` + visionTestPNGBase64(t) + `" alt="figure"></p>`)
+ }
+ result, err := component.Invoke(t.Context(), nil, map[string]any{"name": filename, "file_type": fileType, "binary": binary, "tenant_id": "tenant-1"})
+ if err != nil {
+ t.Fatal(err)
+ }
+ if tc.want == "" {
+ if len(resolved) != 0 {
+ t.Fatalf("disabled enhancement resolved %v", resolved)
+ }
+ } else if len(resolved) != 1 || resolved[0] != tc.want {
+ t.Fatalf("resolved %v, want [%s]", resolved, tc.want)
+ }
+ if fileType == "image" {
+ items := result["json"].([]map[string]any)
+ if !strings.Contains(items[0]["text"].(string), "OCR text") {
+ t.Fatalf("OCR text lost: %v", items)
+ }
+ }
+ })
+ }
+ }
+}
+
+func TestParserGlobalVisionConfigValidation(t *testing.T) {
+ for _, tc := range []struct {
+ value any
+ wantError string
+ }{
+ {"model-B", "vlm must be an object"},
+ {map[string]any{"llm_id": 42}, "vlm.llm_id must be a string"},
+ } {
+ _, err := NewParserComponent(map[string]any{"vlm": tc.value})
+ if err == nil || !strings.Contains(err.Error(), tc.wantError) {
+ t.Fatalf("vlm %v: error = %v, want %s", tc.value, err, tc.wantError)
+ }
+ }
+ component, err := NewParserComponent(map[string]any{"vlm": map[string]any{}})
+ if err != nil {
+ t.Fatal(err)
+ }
+ if _, exists := component.(*ParserComponent).setups["vlm"]; exists {
+ t.Fatal("global vlm was interpreted as a file family")
+ }
+}
+
+func TestParserGlobalVisionDoesNotOverrideASR(t *testing.T) {
+ original := resolveModelConfig
+ t.Cleanup(func() { resolveModelConfig = original })
+ var calls int
+ resolveModelConfig = func(_ context.Context, _ *gorm.DB, _ string, kind entity.ModelType, ref string) (modelModule.ModelDriver, string, *modelModule.APIConfig, int, error) {
+ calls++
+ if kind != entity.ModelTypeSpeech2Text || ref != "asr-model" {
+ t.Fatalf("audio resolved %s / %s, want ASR / asr-model", kind, ref)
+ }
+ return &audioTranscribeDriver{transcription: "transcribed"}, ref, &modelModule.APIConfig{}, 0, nil
+ }
+ component, err := NewParserComponent(map[string]any{
+ "enable_vision_enhancement": true,
+ "vlm": map[string]any{"llm_id": "model-B"},
+ "audio": map[string]any{"vlm": map[string]any{"llm_id": "asr-model"}},
+ })
+ if err != nil {
+ t.Fatal(err)
+ }
+ result, err := component.Invoke(t.Context(), nil, map[string]any{"name": "test.mp3", "file_type": "audio", "binary": []byte("fake-audio"), "tenant_id": "tenant-1"})
+ if err != nil {
+ t.Fatal(err)
+ }
+ items := result["json"].([]map[string]any)
+ if calls != 1 || len(items) != 1 || items[0]["text"] != "transcribed" {
+ t.Fatalf("ASR calls = %d, items = %v", calls, items)
+ }
+}
diff --git a/internal/ingestion/component/vision_enhancement.go b/internal/ingestion/component/vision_enhancement.go
index 44ed51060e..fc7727169d 100644
--- a/internal/ingestion/component/vision_enhancement.go
+++ b/internal/ingestion/component/vision_enhancement.go
@@ -167,6 +167,7 @@ func maybeDispatchVisionEnhancement(
dispatched parser.ParseResult,
inputs map[string]any,
setups map[string]schema.ParserSetup,
+ modelRef string,
) (parser.ParseResult, bool, error) {
// Only enhance successful JSON output format containing items.
if dispatched.Err != nil || dispatched.OutputFormat != "json" || len(dispatched.JSON) == 0 {
@@ -205,7 +206,6 @@ func maybeDispatchVisionEnhancement(
vlmReady := false
var resolveErr error
if tenantID != "" {
- modelRef := configuredMediaModelID(setup, family)
var err error
if modelRef != "" {
driver, modelName, apiConfig, _, err = resolveModelConfig(ctx, db, tenantID, entity.ModelTypeImage2Text, modelRef)
diff --git a/internal/ingestion/component/vision_enhancement_test.go b/internal/ingestion/component/vision_enhancement_test.go
index ee8ae28aa6..e38005b591 100644
--- a/internal/ingestion/component/vision_enhancement_test.go
+++ b/internal/ingestion/component/vision_enhancement_test.go
@@ -203,7 +203,7 @@ func TestVisionEnhancement_AppendsVLMToExistingText(t *testing.T) {
}
res, handled, err := maybeDispatchVisionEnhancement(
t.Context(), dao.DB, utility.FileTypeXLSX, dispatched,
- map[string]any{"tenant_id": "t1"}, nil)
+ map[string]any{"tenant_id": "t1"}, nil, "")
if err != nil {
t.Fatalf("maybeDispatchVisionEnhancement: %v", err)
}
@@ -232,7 +232,7 @@ func TestVisionEnhancement_ReportsVLMInvocationFailure(t *testing.T) {
}},
}
result, _, err := maybeDispatchVisionEnhancement(t.Context(), dao.DB, utility.FileTypeDOCX, dispatched,
- map[string]any{"tenant_id": "t1"}, nil)
+ map[string]any{"tenant_id": "t1"}, nil, "")
if err != nil {
t.Fatalf("maybeDispatchVisionEnhancement: %v", err)
}
@@ -260,7 +260,7 @@ func TestVisionEnhancement_CropFailureFallsBackToInlineImage(t *testing.T) {
}
result, handled, err := maybeDispatchVisionEnhancement(
t.Context(), dao.DB, utility.FileTypePDF, dispatched,
- map[string]any{"tenant_id": "t1"}, map[string]schema.ParserSetup{"pdf": {"parse_method": "mineru"}},
+ map[string]any{"tenant_id": "t1"}, map[string]schema.ParserSetup{"pdf": {"parse_method": "mineru"}}, "",
)
if err != nil {
t.Fatalf("maybeDispatchVisionEnhancement: %v", err)
@@ -296,7 +296,7 @@ func TestVisionEnhancement_EnhancesPDFTablesRegardlessOfOCRProvider(t *testing.T
res, handled, err := maybeDispatchVisionEnhancement(
t.Context(), dao.DB, utility.FileTypePDF, dispatched,
map[string]any{"tenant_id": "t1"},
- map[string]schema.ParserSetup{"pdf": {"parse_method": parseMethod}},
+ map[string]schema.ParserSetup{"pdf": {"parse_method": parseMethod}}, "",
)
if err != nil {
t.Fatalf("maybeDispatchVisionEnhancement: %v", err)
@@ -333,7 +333,7 @@ func TestVisionEnhancement_EnhancesTableAndCellImages(t *testing.T) {
result, handled, err := maybeDispatchVisionEnhancement(
t.Context(), dao.DB, utility.FileTypePDF, dispatched,
- map[string]any{"tenant_id": "t1"}, map[string]schema.ParserSetup{"pdf": {"parse_method": "deepdoc"}},
+ map[string]any{"tenant_id": "t1"}, map[string]schema.ParserSetup{"pdf": {"parse_method": "deepdoc"}}, "",
)
if err != nil {
t.Fatalf("maybeDispatchVisionEnhancement: %v", err)
@@ -363,7 +363,7 @@ func TestVisionEnhancement_EnhancesExternalPDFImage(t *testing.T) {
result, handled, err := maybeDispatchVisionEnhancement(
t.Context(), dao.DB, utility.FileTypePDF, dispatched,
- map[string]any{"tenant_id": "t1"}, map[string]schema.ParserSetup{"pdf": {"parse_method": "mineru"}},
+ map[string]any{"tenant_id": "t1"}, map[string]schema.ParserSetup{"pdf": {"parse_method": "mineru"}}, "",
)
if err != nil {
t.Fatalf("maybeDispatchVisionEnhancement: %v", err)
@@ -414,7 +414,7 @@ func TestVisionEnhancement_EnhancesJSONImagesAndTables(t *testing.T) {
dao.DB,
tc.fileType,
dispatched,
- map[string]any{"tenant_id": "t1", "lang": "Japanese"}, nil)
+ map[string]any{"tenant_id": "t1", "lang": "Japanese"}, nil, "")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
@@ -493,7 +493,7 @@ func TestVisionEnhancement_LanguagePriority(t *testing.T) {
}
_, handled, err := maybeDispatchVisionEnhancement(
- t.Context(), dao.DB, utility.FileTypePDF, dispatched, tc.inputs, tc.setups)
+ t.Context(), dao.DB, utility.FileTypePDF, dispatched, tc.inputs, tc.setups, "")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
@@ -533,7 +533,7 @@ func TestVisionEnhancement_MarkdownOutputUntouched(t *testing.T) {
dao.DB,
utility.FileTypeDOCX,
dispatched,
- map[string]any{"tenant_id": "t1"}, nil)
+ map[string]any{"tenant_id": "t1"}, nil, "")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
@@ -563,7 +563,7 @@ func TestVisionEnhancement_UsesVisualPayloadRegardlessOfFileType(t *testing.T) {
dao.DB,
utility.FileTypeOTHER,
dispatched,
- map[string]any{"tenant_id": "t1"}, nil)
+ map[string]any{"tenant_id": "t1"}, nil, "")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
@@ -592,7 +592,7 @@ func TestVisionEnhancement_EmptyOrNoTenantSkipped(t *testing.T) {
dao.DB,
utility.FileTypeDOCX,
dispatched,
- map[string]any{}, nil)
+ map[string]any{}, nil, "")
if err != nil || handled {
t.Errorf("handled=%v, err=%v, want false, nil for missing tenant_id", handled, err)
}
@@ -618,7 +618,7 @@ func TestVisionEnhancement_DispatchedErrSkipped(t *testing.T) {
dao.DB,
utility.FileTypePDF,
dispatched,
- map[string]any{"tenant_id": "t1"}, nil)
+ map[string]any{"tenant_id": "t1"}, nil, "")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
@@ -655,7 +655,7 @@ func TestVisionEnhancement_ContextCancellation(t *testing.T) {
dao.DB,
utility.FileTypePDF,
dispatched,
- map[string]any{"tenant_id": "t1"}, nil)
+ map[string]any{"tenant_id": "t1"}, nil, "")
if !errors.Is(err, context.Canceled) {
t.Fatalf("err = %v, want context.Canceled", err)
}
@@ -696,7 +696,7 @@ func TestVisionEnhancement_NonStringImageFieldFiltered(t *testing.T) {
dao.DB,
utility.FileTypePDF,
dispatched,
- map[string]any{"tenant_id": "t1"}, nil)
+ map[string]any{"tenant_id": "t1"}, nil, "")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
@@ -738,7 +738,7 @@ func TestVisionEnhancement_MoreThanConcurrencyItems(t *testing.T) {
dao.DB,
utility.FileTypePDF,
dispatched,
- map[string]any{"tenant_id": "t1"}, nil)
+ map[string]any{"tenant_id": "t1"}, nil, "")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
@@ -778,7 +778,7 @@ func TestVisionEnhancement_PlainTextResponseNotTruncated(t *testing.T) {
dao.DB,
utility.FileTypePDF,
dispatched,
- map[string]any{"tenant_id": "t1"}, nil)
+ map[string]any{"tenant_id": "t1"}, nil, "")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
@@ -816,7 +816,7 @@ func TestVisionEnhancement_PromptBuilderErrorSkipped(t *testing.T) {
dao.DB,
utility.FileTypePDF,
dispatched,
- map[string]any{"tenant_id": "t1"}, nil)
+ map[string]any{"tenant_id": "t1"}, nil, "")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
@@ -854,7 +854,7 @@ func TestVisionEnhancement_ModelResolveFailureSkipped(t *testing.T) {
dao.DB,
utility.FileTypePDF,
dispatched,
- map[string]any{"tenant_id": "t1"}, nil)
+ map[string]any{"tenant_id": "t1"}, nil, "")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
@@ -905,7 +905,7 @@ func TestVisionEnhancement_CancellationStopsSchedulingWithManyItems(t *testing.T
dao.DB,
utility.FileTypePDF,
dispatched,
- map[string]any{"tenant_id": "t1"}, nil)
+ map[string]any{"tenant_id": "t1"}, nil, "")
if !errors.Is(err, context.Canceled) {
t.Fatalf("err = %v, want context.Canceled", err)
}
@@ -1112,9 +1112,7 @@ func TestPromptDirState_SuccessIsCached(t *testing.T) {
}
}
-// TestVisionEnhancement_PerCallModelPreferred verifies that setups vlm.llm_id
-// takes precedence over the tenant default IMAGE2TEXT model.
-func TestVisionEnhancement_PerCallModelPreferred(t *testing.T) {
+func TestVisionEnhancement_GlobalModelPreferredOverPDFParser(t *testing.T) {
origTenantResolver := resolveTenantModelByType
origModelResolver := resolveModelConfig
origInvoker := visionChatInvoker
@@ -1145,7 +1143,7 @@ func TestVisionEnhancement_PerCallModelPreferred(t *testing.T) {
figureVisionPromptBuilder = fakePrompt
setups := map[string]schema.ParserSetup{
- "pdf": {"vlm": map[string]any{"llm_id": "custom-vlm@provider"}},
+ "pdf": {"parse_method": "pdf-parser-model", "vlm": map[string]any{"llm_id": "stale-family-model"}},
}
dispatched := parser.ParseResult{
OutputFormat: "json",
@@ -1160,7 +1158,7 @@ func TestVisionEnhancement_PerCallModelPreferred(t *testing.T) {
utility.FileTypePDF,
dispatched,
map[string]any{"tenant_id": "t1"},
- setups,
+ setups, "custom-vlm@provider",
)
if err != nil {
t.Fatalf("maybeDispatchVisionEnhancement: %v", err)
@@ -1175,7 +1173,7 @@ func TestVisionEnhancement_PerCallModelPreferred(t *testing.T) {
t.Errorf("resolveModelConfig modelType = %q, want %q", gotType, entity.ModelTypeImage2Text)
}
if tenantResolverCalled {
- t.Error("tenant default resolver must not be called when setup vlm.llm_id is set")
+ t.Error("tenant default resolver must not be called when the global model is set")
}
}
@@ -1202,7 +1200,7 @@ func TestVisionEnhancement_InvalidImageDataSkipped(t *testing.T) {
dao.DB,
utility.FileTypePDF,
dispatched,
- map[string]any{"tenant_id": "t1"}, nil)
+ map[string]any{"tenant_id": "t1"}, nil, "")
if err != nil {
t.Fatalf("maybeDispatchVisionEnhancement: %v", err)
}
diff --git a/internal/ingestion/pipeline/parser_vision_config_test.go b/internal/ingestion/pipeline/parser_vision_config_test.go
new file mode 100644
index 0000000000..5e2666d3e9
--- /dev/null
+++ b/internal/ingestion/pipeline/parser_vision_config_test.go
@@ -0,0 +1,80 @@
+package pipeline
+
+import (
+ "encoding/json"
+ "reflect"
+ "testing"
+)
+
+func TestBuildParserConfigPreservesGlobalVisionSettings(t *testing.T) {
+ const id = "Parser:HipSignsRhyme"
+ for _, enabled := range []bool{true, false} {
+ for _, model := range []string{"model-B", ""} {
+ want := map[string]any{"enable_vision_enhancement": enabled, "vlm": map[string]any{"llm_id": model}}
+ params := BuildParserConfig(generalDSL(t), map[string]any{id: want})[id].(map[string]any)
+ for key, value := range want {
+ if !reflect.DeepEqual(params[key], value) {
+ t.Fatalf("existing canvas saved %s = %v, want %v", key, params[key], value)
+ }
+ }
+ }
+ }
+}
+
+func TestBuiltinParserVisionSettings(t *testing.T) {
+ registry, err := DefaultRegistry()
+ if err != nil {
+ t.Fatal(err)
+ }
+ if len(registry.Refs()) == 0 {
+ t.Fatal("no builtin templates")
+ }
+ for _, ref := range registry.Refs() {
+ t.Run(ref, func(t *testing.T) {
+ template, ok := registry.Get(ref)
+ if !ok {
+ t.Fatal("missing builtin template")
+ }
+ dsl, err := json.Marshal(template.DSL)
+ if err != nil {
+ t.Fatal(err)
+ }
+ id := ExtractParserCpnID(dsl, "Parser")
+ if id == "" {
+ t.Fatal("missing Parser")
+ }
+ defaults, err := ComponentParamsDefaults(dsl)
+ if err != nil {
+ t.Fatal(err)
+ }
+ checkDefaults := func(params map[string]any) {
+ t.Helper()
+ if params["enable_vision_enhancement"] != false || !reflect.DeepEqual(params["vlm"], map[string]any{"llm_id": ""}) {
+ t.Errorf("default vision settings = %v / %v", params["enable_vision_enhancement"], params["vlm"])
+ }
+ }
+ checkDefaults(defaults[id])
+ parserForms := 0
+ graph := template.DSL["graph"].(map[string]any)
+ for _, raw := range graph["nodes"].([]any) {
+ data := raw.(map[string]any)["data"].(map[string]any)
+ if data["label"] == "Parser" {
+ checkDefaults(data["form"].(map[string]any))
+ parserForms++
+ }
+ }
+ if parserForms == 0 {
+ t.Fatal("missing Parser graph form")
+ }
+ for _, enabled := range []bool{true, false} {
+ want := map[string]any{"enable_vision_enhancement": enabled, "vlm": map[string]any{"llm_id": "model-B"}}
+ params := BuildParserConfig(dsl, map[string]any{id: want})[id].(map[string]any)
+ for key, value := range want {
+ if !reflect.DeepEqual(params[key], value) {
+ t.Fatalf("saved %s = %v, want %v", key, params[key], value)
+ }
+ }
+ }
+ })
+ }
+}
diff --git a/internal/ingestion/pipeline/pipeline_params.go b/internal/ingestion/pipeline/pipeline_params.go
index e32163986a..2f55d93e0c 100644
--- a/internal/ingestion/pipeline/pipeline_params.go
+++ b/internal/ingestion/pipeline/pipeline_params.go
@@ -173,6 +173,10 @@ func CleanComponentParams(dslJSON []byte, rawConfig map[string]interface{}) map[
if s.ComponentName == "GeneralChunker" {
keys["delimiters"] = struct{}{}
}
+ if isParserComponent(s.CpnID, s.ComponentName) {
+ keys["enable_vision_enhancement"] = struct{}{}
+ keys["vlm"] = struct{}{}
+ }
if IsChunkerComponent(s.CpnID) {
keys["enable_children"] = struct{}{}
// parent_child is the component-scoped home of the parent/child
diff --git a/internal/ingestion/pipeline/pipeline_params_test.go b/internal/ingestion/pipeline/pipeline_params_test.go
index daa5706c82..1cbedfe29d 100644
--- a/internal/ingestion/pipeline/pipeline_params_test.go
+++ b/internal/ingestion/pipeline/pipeline_params_test.go
@@ -1150,7 +1150,7 @@ func TestCleanComponentParams_AcceptsOperatorFormParams(t *testing.T) {
// whitelist coverage.
var componentParamWhitelistExemptions = map[string]string{
"File": "no user-editable params",
- "Parser": "accepted keys are the DSL's file families",
+ "Parser": "DSL file families plus the global vision parameter whitelist",
"GeneralChunker": "param struct lives in the chunker package without json tags; template keys + the delimiters exception cover it",
"QAChunker": "no operator form; param struct is not in the schema package",
"OneChunker": "no user-editable params",
diff --git a/internal/ingestion/pipeline/template/ingestion_pipeline_audio.json b/internal/ingestion/pipeline/template/ingestion_pipeline_audio.json
index ccb2f9b699..a994404a92 100644
--- a/internal/ingestion/pipeline/template/ingestion_pipeline_audio.json
+++ b/internal/ingestion/pipeline/template/ingestion_pipeline_audio.json
@@ -31,6 +31,10 @@
"obj": {
"component_name": "Parser",
"params": {
+ "enable_vision_enhancement": false,
+ "vlm": {
+ "llm_id": ""
+ },
"outputs": {
"html": {
"type": "string",
@@ -204,6 +208,10 @@
{
"data": {
"form": {
+ "enable_vision_enhancement": false,
+ "vlm": {
+ "llm_id": ""
+ },
"outputs": {
"html": {
"type": "string",
diff --git a/internal/ingestion/pipeline/template/ingestion_pipeline_book.json b/internal/ingestion/pipeline/template/ingestion_pipeline_book.json
index ab1ac54593..60319e2f57 100644
--- a/internal/ingestion/pipeline/template/ingestion_pipeline_book.json
+++ b/internal/ingestion/pipeline/template/ingestion_pipeline_book.json
@@ -31,6 +31,10 @@
"obj": {
"component_name": "Parser",
"params": {
+ "enable_vision_enhancement": false,
+ "vlm": {
+ "llm_id": ""
+ },
"outputs": {
"html": {
"type": "string",
@@ -265,6 +269,10 @@
{
"data": {
"form": {
+ "enable_vision_enhancement": false,
+ "vlm": {
+ "llm_id": ""
+ },
"outputs": {
"html": {
"type": "string",
diff --git a/internal/ingestion/pipeline/template/ingestion_pipeline_email.json b/internal/ingestion/pipeline/template/ingestion_pipeline_email.json
index 6941c3958f..e2f42542a5 100644
--- a/internal/ingestion/pipeline/template/ingestion_pipeline_email.json
+++ b/internal/ingestion/pipeline/template/ingestion_pipeline_email.json
@@ -31,6 +31,10 @@
"obj": {
"component_name": "Parser",
"params": {
+ "enable_vision_enhancement": false,
+ "vlm": {
+ "llm_id": ""
+ },
"outputs": {
"html": {
"type": "string",
@@ -209,6 +213,10 @@
{
"data": {
"form": {
+ "enable_vision_enhancement": false,
+ "vlm": {
+ "llm_id": ""
+ },
"outputs": {
"html": {
"type": "string",
diff --git a/internal/ingestion/pipeline/template/ingestion_pipeline_general.json b/internal/ingestion/pipeline/template/ingestion_pipeline_general.json
index f745094bf4..1edd9a70b4 100644
--- a/internal/ingestion/pipeline/template/ingestion_pipeline_general.json
+++ b/internal/ingestion/pipeline/template/ingestion_pipeline_general.json
@@ -31,6 +31,10 @@
"obj": {
"component_name": "Parser",
"params": {
+ "enable_vision_enhancement": false,
+ "vlm": {
+ "llm_id": ""
+ },
"doc": {
"output_format": "json",
"preprocess": [
@@ -275,6 +279,10 @@
{
"data": {
"form": {
+ "enable_vision_enhancement": false,
+ "vlm": {
+ "llm_id": ""
+ },
"setups": [
{
"fileFormat": "pdf",
diff --git a/internal/ingestion/pipeline/template/ingestion_pipeline_laws.json b/internal/ingestion/pipeline/template/ingestion_pipeline_laws.json
index fb3627de6a..9ce7847c31 100644
--- a/internal/ingestion/pipeline/template/ingestion_pipeline_laws.json
+++ b/internal/ingestion/pipeline/template/ingestion_pipeline_laws.json
@@ -31,6 +31,10 @@
"obj": {
"component_name": "Parser",
"params": {
+ "enable_vision_enhancement": false,
+ "vlm": {
+ "llm_id": ""
+ },
"outputs": {
"html": {
"type": "string",
@@ -281,6 +285,10 @@
{
"data": {
"form": {
+ "enable_vision_enhancement": false,
+ "vlm": {
+ "llm_id": ""
+ },
"outputs": {
"html": {
"type": "string",
diff --git a/internal/ingestion/pipeline/template/ingestion_pipeline_manual.json b/internal/ingestion/pipeline/template/ingestion_pipeline_manual.json
index 45828e0465..ef65faa8b6 100644
--- a/internal/ingestion/pipeline/template/ingestion_pipeline_manual.json
+++ b/internal/ingestion/pipeline/template/ingestion_pipeline_manual.json
@@ -31,6 +31,10 @@
"obj": {
"component_name": "Parser",
"params": {
+ "enable_vision_enhancement": false,
+ "vlm": {
+ "llm_id": ""
+ },
"outputs": {
"html": {
"type": "string",
@@ -245,6 +249,10 @@
{
"data": {
"form": {
+ "enable_vision_enhancement": false,
+ "vlm": {
+ "llm_id": ""
+ },
"outputs": {
"html": {
"type": "string",
diff --git a/internal/ingestion/pipeline/template/ingestion_pipeline_one.json b/internal/ingestion/pipeline/template/ingestion_pipeline_one.json
index b3c1c7ed88..4503cecd25 100644
--- a/internal/ingestion/pipeline/template/ingestion_pipeline_one.json
+++ b/internal/ingestion/pipeline/template/ingestion_pipeline_one.json
@@ -31,6 +31,10 @@
"obj": {
"component_name": "Parser",
"params": {
+ "enable_vision_enhancement": false,
+ "vlm": {
+ "llm_id": ""
+ },
"outputs": {
"html": {
"type": "string",
@@ -258,6 +262,10 @@
{
"data": {
"form": {
+ "enable_vision_enhancement": false,
+ "vlm": {
+ "llm_id": ""
+ },
"outputs": {
"html": {
"type": "string",
diff --git a/internal/ingestion/pipeline/template/ingestion_pipeline_paper.json b/internal/ingestion/pipeline/template/ingestion_pipeline_paper.json
index 529ba2e270..14922f6afb 100644
--- a/internal/ingestion/pipeline/template/ingestion_pipeline_paper.json
+++ b/internal/ingestion/pipeline/template/ingestion_pipeline_paper.json
@@ -31,6 +31,10 @@
"obj": {
"component_name": "Parser",
"params": {
+ "enable_vision_enhancement": false,
+ "vlm": {
+ "llm_id": ""
+ },
"outputs": {
"html": {
"type": "string",
@@ -229,6 +233,10 @@
{
"data": {
"form": {
+ "enable_vision_enhancement": false,
+ "vlm": {
+ "llm_id": ""
+ },
"outputs": {
"html": {
"type": "string",
diff --git a/internal/ingestion/pipeline/template/ingestion_pipeline_picture.json b/internal/ingestion/pipeline/template/ingestion_pipeline_picture.json
index bcba6f733b..a03c537829 100644
--- a/internal/ingestion/pipeline/template/ingestion_pipeline_picture.json
+++ b/internal/ingestion/pipeline/template/ingestion_pipeline_picture.json
@@ -31,6 +31,10 @@
"obj": {
"component_name": "Parser",
"params": {
+ "enable_vision_enhancement": false,
+ "vlm": {
+ "llm_id": ""
+ },
"outputs": {
"html": {
"type": "string",
@@ -218,6 +222,10 @@
{
"data": {
"form": {
+ "enable_vision_enhancement": false,
+ "vlm": {
+ "llm_id": ""
+ },
"outputs": {
"html": {
"type": "string",
diff --git a/internal/ingestion/pipeline/template/ingestion_pipeline_presentation.json b/internal/ingestion/pipeline/template/ingestion_pipeline_presentation.json
index 56cefee824..1112f9ee52 100644
--- a/internal/ingestion/pipeline/template/ingestion_pipeline_presentation.json
+++ b/internal/ingestion/pipeline/template/ingestion_pipeline_presentation.json
@@ -31,6 +31,10 @@
"obj": {
"component_name": "Parser",
"params": {
+ "enable_vision_enhancement": false,
+ "vlm": {
+ "llm_id": ""
+ },
"outputs": {
"html": {
"type": "string",
@@ -204,6 +208,10 @@
{
"data": {
"form": {
+ "enable_vision_enhancement": false,
+ "vlm": {
+ "llm_id": ""
+ },
"outputs": {
"html": {
"type": "string",
diff --git a/internal/ingestion/pipeline/template/ingestion_pipeline_qa.json b/internal/ingestion/pipeline/template/ingestion_pipeline_qa.json
index 856fbcc371..d1a0c8cc91 100644
--- a/internal/ingestion/pipeline/template/ingestion_pipeline_qa.json
+++ b/internal/ingestion/pipeline/template/ingestion_pipeline_qa.json
@@ -31,6 +31,10 @@
"obj": {
"component_name": "Parser",
"params": {
+ "enable_vision_enhancement": false,
+ "vlm": {
+ "llm_id": ""
+ },
"outputs": {
"html": {
"type": "string",
@@ -201,6 +205,10 @@
{
"data": {
"form": {
+ "enable_vision_enhancement": false,
+ "vlm": {
+ "llm_id": ""
+ },
"outputs": {
"html": {
"type": "string",
diff --git a/internal/ingestion/pipeline/template/ingestion_pipeline_table.json b/internal/ingestion/pipeline/template/ingestion_pipeline_table.json
index cf5d85e2b6..e8235a309b 100644
--- a/internal/ingestion/pipeline/template/ingestion_pipeline_table.json
+++ b/internal/ingestion/pipeline/template/ingestion_pipeline_table.json
@@ -31,6 +31,10 @@
"obj": {
"component_name": "Parser",
"params": {
+ "enable_vision_enhancement": false,
+ "vlm": {
+ "llm_id": ""
+ },
"outputs": {
"html": {
"type": "string",
@@ -168,6 +172,10 @@
{
"data": {
"form": {
+ "enable_vision_enhancement": false,
+ "vlm": {
+ "llm_id": ""
+ },
"outputs": {
"html": {
"type": "string",
diff --git a/internal/ingestion/task/pipeline_executor_defaults_test.go b/internal/ingestion/task/pipeline_executor_defaults_test.go
index 3de32bb4b4..42a2836c20 100644
--- a/internal/ingestion/task/pipeline_executor_defaults_test.go
+++ b/internal/ingestion/task/pipeline_executor_defaults_test.go
@@ -38,18 +38,18 @@ import (
// Comparison is done per-component (see assertComponentsMatch), so the JSON
// serialization order inside each entry is irrelevant.
var builtinComponentParamsGolden = map[string]string{
- "audio": "{\"File\": {}, \"Parser:SongsFillAir\": {\"audio\": {\"output_format\": \"text\", \"preprocess\": [\"main_content\"], \"suffix\": [\"aac\", \"aiff\", \"ape\", \"au\", \"da\", \"flac\", \"midi\", \"mp3\", \"ogg\", \"oggvorbis\", \"realaudio\", \"vqf\", \"wav\", \"wave\", \"wma\"]}}, \"OneChunker:BlueSkiesLaugh\": {}, \"Tokenizer:KindEyesWatch\": {\"fields\": \"text\", \"filename_embd_weight\": 0.1, \"search_method\": [\"embedding\", \"full_text\"]}, \"Extractor:AutoExtractDefault\": {\"llm_id\": \"\", \"keywords\": {\"top_n\": 0}, \"questions\": {\"top_n\": 0}, \"tags\": {\"top_n\": 0, \"tag_file_id\": \"\"}, \"summary\": {\"enabled\": false}, \"metadata\": {\"enabled\": false, \"metadata\": [], \"built_in_metadata\": []}}}",
- "book": "{\"File\": {}, \"Parser:HipSignsRhyme\": {\"doc\": {\"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"doc\"]}, \"docx\": {\"flatten_media_to_text\": false, \"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"docx\"], \"vlm\": {}}, \"html\": {\"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"htm\", \"html\"]}, \"pdf\": {\"flatten_media_to_text\": false, \"output_format\": \"json\", \"parse_method\": \"DeepDOC\", \"preprocess\": [\"main_content\"], \"remove_toc\": true, \"suffix\": [\"pdf\"], \"vlm\": {}}, \"text&code\": {\"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"txt\"]}}, \"TitleChunker:GrumpyGarlicsBake\": {\"hierarchy\": 5, \"include_heading_content\": true, \"levels\": [[\"^#[^#]\", \"^##[^#]\", \"^###[^#]\", \"^####[^#]\"], [\"第[零一二三四五六七八九十百0-9]+(分?编|部分)\", \"第[零一二三四五六七八九十百0-9]+章\", \"第[零一二三四五六七八九十百0-9]+节\", \"第[零一二三四五六七八九十百0-9]+条\", \"[\\\\((][零一二三四五六七八九十百]+[\\\\))]\"], [\"第[0-9]+章\", \"第[0-9]+节\", \"[0-9]{1,2}[\\\\. 、]\", \"[0-9]{1,2}\\\\.[0-9]{1,2}($|[^a-zA-Z/%~.-])\", \"[0-9]{1,2}\\\\.[0-9]{1,2}\\\\.[0-9]{1,2}\"], [\"第[零一二三四五六七八九十百0-9]+章\", \"第[零一二三四五六七八九十百0-9]+节\", \"[零一二三四五六七八九十百]+[ 、]\", \"[\\\\((][零一二三四五六七八九十百]+[\\\\))]\", \"[\\\\((][0-9]{,2}[\\\\))]\"], [\"PART (ONE|TWO|THREE|FOUR|FIVE|SIX|SEVEN|EIGHT|NINE|TEN)\", \"Chapter (I+V?|VI*|XI|IX|X)\", \"Section [0-9]+\", \"Article [0-9]+\"]], \"method\": \"hierarchy\"}, \"Tokenizer:HotDonutsRing\": {\"fields\": \"text\", \"filename_embd_weight\": 0.1, \"search_method\": [\"embedding\", \"full_text\"]}, \"Extractor:AutoExtractDefault\": {\"llm_id\": \"\", \"keywords\": {\"top_n\": 0}, \"questions\": {\"top_n\": 0}, \"tags\": {\"top_n\": 0, \"tag_file_id\": \"\"}, \"summary\": {\"enabled\": false}, \"metadata\": {\"enabled\": false, \"metadata\": [], \"built_in_metadata\": []}}}",
- "email": "{\"File\": {}, \"Parser:BirdsFlutterHigh\": {\"email\": {\"fields\": [\"from\", \"to\", \"cc\", \"bcc\", \"date\", \"subject\", \"body\", \"attachments\"], \"output_format\": \"text\", \"preprocess\": [\"main_content\"], \"suffix\": [\"eml\"]}}, \"TokenChunker:WarmBreadSmells\": {\"children_delimiters\": [], \"chunk_token_size\": 512, \"delimiter_mode\": \"delimiter\", \"delimiters\": [\"\\n\", \"!\", \"?\", \"。\", \";\", \"!\", \"?\"], \"image_context_size\": 0, \"overlapped_percent\": 0, \"table_context_size\": 0}, \"Tokenizer:NiceWordsSpoken\": {\"fields\": \"text\", \"filename_embd_weight\": 0.1, \"search_method\": [\"embedding\", \"full_text\"]}, \"Extractor:AutoExtractDefault\": {\"llm_id\": \"\", \"keywords\": {\"top_n\": 0}, \"questions\": {\"top_n\": 0}, \"tags\": {\"top_n\": 0, \"tag_file_id\": \"\"}, \"summary\": {\"enabled\": false}, \"metadata\": {\"enabled\": false, \"metadata\": [], \"built_in_metadata\": []}}}",
- "general": "{\"File\": {}, \"Parser:HipSignsRhyme\": {\"doc\": {\"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"doc\"]}, \"docx\": {\"flatten_media_to_text\": false, \"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"docx\"], \"vlm\": {}}, \"html\": {\"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"htm\", \"html\"]}, \"markdown\": {\"flatten_media_to_text\": false, \"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"md\", \"markdown\", \"mdx\"], \"vlm\": {}}, \"pdf\": {\"flatten_media_to_text\": false, \"output_format\": \"json\", \"pages\": [[1, 100000]], \"parse_method\": \"DeepDOC\", \"preprocess\": [\"main_content\"], \"suffix\": [\"pdf\"], \"vlm\": {}}, \"spreadsheet\": {\"flatten_media_to_text\": false, \"output_format\": \"json\", \"parse_method\": \"DeepDOC\", \"preprocess\": [\"main_content\"], \"suffix\": [\"xls\", \"xlsx\", \"csv\"], \"vlm\": {}}, \"text&code\": {\"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"txt\", \"py\", \"js\", \"java\", \"c\", \"cpp\", \"h\", \"php\", \"go\", \"ts\", \"sh\", \"cs\", \"kt\", \"sql\"]}}, \"GeneralChunker:SixApplesFall\": {\"children_delimiters\": [], \"chunk_token_size\": 512, \"delimiters\": [\"\\n\", \"!\", \"?\", \";\", \"。\", \";\", \"!\", \"?\"], \"image_context_size\": 0, \"overlapped_percent\": 0, \"table_context_size\": 0}, \"Tokenizer:LegalReadersDecide\": {\"fields\": \"text\", \"filename_embd_weight\": 0.1, \"search_method\": [\"embedding\", \"full_text\"]}, \"Extractor:AutoExtractDefault\": {\"llm_id\": \"\", \"keywords\": {\"top_n\": 0}, \"questions\": {\"top_n\": 0}, \"tags\": {\"top_n\": 0, \"tag_file_id\": \"\"}, \"summary\": {\"enabled\": false}, \"metadata\": {\"enabled\": false, \"metadata\": [], \"built_in_metadata\": []}}}",
- "laws": "{\"File\": {}, \"Parser:HipSignsRhyme\": {\"doc\": {\"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"doc\"]}, \"docx\": {\"flatten_media_to_text\": false, \"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"docx\"], \"vlm\": {}}, \"html\": {\"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"htm\", \"html\"]}, \"markdown\": {\"flatten_media_to_text\": false, \"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"md\", \"markdown\", \"mdx\"], \"vlm\": {}}, \"pdf\": {\"flatten_media_to_text\": false, \"output_format\": \"json\", \"parse_method\": \"DeepDOC\", \"preprocess\": [\"main_content\"], \"remove_toc\": true, \"suffix\": [\"pdf\"], \"vlm\": {}}, \"text&code\": {\"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"txt\"]}}, \"TitleChunker:SpicyKeysKick\": {\"hierarchy\": 2, \"include_heading_content\": false, \"levels\": [[\"^#[^#]\", \"^##[^#]\", \"^###[^#]\", \"^####[^#]\"], [\"第[零一二三四五六七八九十百0-9]+(分?编|部分)\", \"第[零一二三四五六七八九十百0-9]+章\", \"第[零一二三四五六七八九十百0-9]+节\", \"第[零一二三四五六七八九十百0-9]+条\", \"[\\\\((][零一二三四五六七八九十百]+[\\\\))]\"], [\"第[0-9]+章\", \"第[0-9]+节\", \"[0-9]{1,2}[\\\\. 、]\", \"[0-9]{1,2}\\\\.[0-9]{1,2}($|[^a-zA-Z/%~.-])\", \"[0-9]{1,2}\\\\.[0-9]{1,2}\\\\.[0-9]{1,2}\"], [\"第[零一二三四五六七八九十百0-9]+章\", \"第[零一二三四五六七八九十百0-9]+节\", \"[零一二三四五六七八九十百]+[ 、]\", \"[\\\\((][零一二三四五六七八九十百]+[\\\\))]\", \"[\\\\((][0-9]{,2}[\\\\))]\"], [\"PART (ONE|TWO|THREE|FOUR|FIVE|SIX|SEVEN|EIGHT|NINE|TEN)\", \"Chapter (I+V?|VI*|XI|IX|X)\", \"Section [0-9]+\", \"Article [0-9]+\"]], \"method\": \"hierarchy\"}, \"Tokenizer:PublicJobsTake\": {\"fields\": \"text\", \"filename_embd_weight\": 0.1, \"search_method\": [\"embedding\", \"full_text\"]}, \"Extractor:AutoExtractDefault\": {\"llm_id\": \"\", \"keywords\": {\"top_n\": 0}, \"questions\": {\"top_n\": 0}, \"tags\": {\"top_n\": 0, \"tag_file_id\": \"\"}, \"summary\": {\"enabled\": false}, \"metadata\": {\"enabled\": false, \"metadata\": [], \"built_in_metadata\": []}}}",
- "manual": "{\"File\": {}, \"Parser:HipSignsRhyme\": {\"doc\": {\"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"doc\"]}, \"docx\": {\"flatten_media_to_text\": false, \"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"docx\"], \"vlm\": {}}, \"pdf\": {\"flatten_media_to_text\": false, \"output_format\": \"json\", \"parse_method\": \"DeepDOC\", \"preprocess\": [\"main_content\"], \"suffix\": [\"pdf\"], \"vlm\": {}}}, \"ManualChunker:NineInsectsFind\": {\"hierarchy\": 0, \"include_heading_content\": false, \"levels\": [[\"^#[^#]\", \"^##[^#]\", \"^###[^#]\", \"^####[^#]\"], [\"第[零一二三四五六七八九十百0-9]+(分?编|部分)\", \"第[零一二三四五六七八九十百0-9]+章\", \"第[零一二三四五六七八九十百0-9]+节\", \"第[零一二三四五六七八九十百0-9]+条\", \"[\\\\((][零一二三四五六七八九十百]+[\\\\))]\"], [\"第[0-9]+章\", \"第[0-9]+节\", \"[0-9]{1,2}[\\\\. 、]\", \"[0-9]{1,2}\\\\.[0-9]{1,2}($|[^a-zA-Z/%~.-])\", \"[0-9]{1,2}\\\\.[0-9]{1,2}\\\\.[0-9]{1,2}\"], [\"第[零一二三四五六七八九十百0-9]+章\", \"第[零一二三四五六七八九十百0-9]+节\", \"[零一二三四五六七八九十百]+[ 、]\", \"[\\\\((][零一二三四五六七八九十百]+[\\\\))]\", \"[\\\\((][0-9]{,2}[\\\\))]\"], [\"PART (ONE|TWO|THREE|FOUR|FIVE|SIX|SEVEN|EIGHT|NINE|TEN)\", \"Chapter (I+V?|VI*|XI|IX|X)\", \"Section [0-9]+\", \"Article [0-9]+\"]], \"method\": \"group\"}, \"Tokenizer:FunnyBalloonsGrin\": {\"fields\": \"text\", \"filename_embd_weight\": 0.1, \"search_method\": [\"embedding\", \"full_text\"]}, \"Extractor:AutoExtractDefault\": {\"llm_id\": \"\", \"keywords\": {\"top_n\": 0}, \"questions\": {\"top_n\": 0}, \"tags\": {\"top_n\": 0, \"tag_file_id\": \"\"}, \"summary\": {\"enabled\": false}, \"metadata\": {\"enabled\": false, \"metadata\": [], \"built_in_metadata\": []}}}",
- "one": "{\"File\": {}, \"Parser:HipSignsRhyme\": {\"doc\": {\"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"doc\"]}, \"docx\": {\"flatten_media_to_text\": false, \"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"docx\"], \"vlm\": {}}, \"html\": {\"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"htm\", \"html\"]}, \"markdown\": {\"flatten_media_to_text\": false, \"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"md\", \"markdown\", \"mdx\"], \"vlm\": {}}, \"pdf\": {\"flatten_media_to_text\": false, \"output_format\": \"json\", \"parse_method\": \"DeepDOC\", \"preprocess\": [\"main_content\"], \"suffix\": [\"pdf\"], \"vlm\": {}}, \"spreadsheet\": {\"flatten_media_to_text\": false, \"output_format\": \"html\", \"parse_method\": \"DeepDOC\", \"preprocess\": [\"main_content\"], \"suffix\": [\"xls\", \"xlsx\"], \"vlm\": {}}, \"text&code\": {\"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"txt\"]}}, \"OneChunker:DryDrinksVisit\": {}, \"Tokenizer:FrankWeeksListen\": {\"fields\": \"text\", \"filename_embd_weight\": 0.1, \"search_method\": [\"embedding\", \"full_text\"]}, \"Extractor:AutoExtractDefault\": {\"llm_id\": \"\", \"keywords\": {\"top_n\": 0}, \"questions\": {\"top_n\": 0}, \"tags\": {\"top_n\": 0, \"tag_file_id\": \"\"}, \"summary\": {\"enabled\": false}, \"metadata\": {\"enabled\": false, \"metadata\": [], \"built_in_metadata\": []}}}",
- "paper": "{\"File\": {}, \"Parser:HipSignsRhyme\": {\"pdf\": {\"enable_multi_column\": true, \"flatten_media_to_text\": false, \"output_format\": \"json\", \"parse_method\": \"DeepDOC\", \"preprocess\": [\"main_content\"], \"suffix\": [\"pdf\"], \"vlm\": {}}}, \"TitleChunker:SparklySchoolsTravel\": {\"hierarchy\": 0, \"include_heading_content\": false, \"levels\": [[\"^#[^#]\", \"^##[^#]\", \"^###[^#]\", \"^####[^#]\"], [\"第[零一二三四五六七八九十百0-9]+(分?编|部分)\", \"第[零一二三四五六七八九十百0-9]+章\", \"第[零一二三四五六七八九十百0-9]+节\", \"第[零一二三四五六七八九十百0-9]+条\", \"[\\\\((][零一二三四五六七八九十百]+[\\\\))]\"], [\"第[0-9]+章\", \"第[0-9]+节\", \"[0-9]{1,2}[\\\\. 、]\", \"[0-9]{1,2}\\\\.[0-9]{1,2}($|[^a-zA-Z/%~.-])\", \"[0-9]{1,2}\\\\.[0-9]{1,2}\\\\.[0-9]{1,2}\"], [\"第[零一二三四五六七八九十百0-9]+章\", \"第[零一二三四五六七八九十百0-9]+节\", \"[零一二三四五六七八九十百]+[ 、]\", \"[\\\\((][零一二三四五六七八九十百]+[\\\\))]\", \"[\\\\((][0-9]{,2}[\\\\))]\"], [\"PART (ONE|TWO|THREE|FOUR|FIVE|SIX|SEVEN|EIGHT|NINE|TEN)\", \"Chapter (I+V?|VI*|XI|IX|X)\", \"Section [0-9]+\", \"Article [0-9]+\"]], \"method\": \"group\"}, \"Tokenizer:GreatCarsWash\": {\"fields\": \"text\", \"filename_embd_weight\": 0.1, \"search_method\": [\"embedding\", \"full_text\"]}, \"Extractor:AutoExtractDefault\": {\"llm_id\": \"\", \"keywords\": {\"top_n\": 0}, \"questions\": {\"top_n\": 0}, \"tags\": {\"top_n\": 0, \"tag_file_id\": \"\"}, \"summary\": {\"enabled\": false}, \"metadata\": {\"enabled\": false, \"metadata\": [], \"built_in_metadata\": []}}}",
- "picture": "{\"File\": {}, \"Parser:ViewsCaptureLight\": {\"image\": {\"output_format\": \"json\", \"parse_method\": \"ocr\", \"preprocess\": [\"main_content\"], \"suffix\": [\"bmp\", \"gif\", \"jpeg\", \"jpg\", \"png\", \"svg\", \"tif\", \"tiff\", \"webp\"]}, \"video\": {\"output_format\": \"text\", \"preprocess\": [\"main_content\"], \"suffix\": [\"3gp\", \"3gpp\", \"avi\", \"flv\", \"mkv\", \"mov\", \"mp4\", \"mpeg\", \"mpg\", \"webm\", \"wmv\"]}}, \"OneChunker:BrightColorsGlow\": {}, \"Tokenizer:SharpLensFocus\": {\"fields\": \"text\", \"filename_embd_weight\": 0.1, \"search_method\": [\"embedding\", \"full_text\"]}, \"Extractor:AutoExtractDefault\": {\"llm_id\": \"\", \"keywords\": {\"top_n\": 0}, \"questions\": {\"top_n\": 0}, \"tags\": {\"top_n\": 0, \"tag_file_id\": \"\"}, \"summary\": {\"enabled\": false}, \"metadata\": {\"enabled\": false, \"metadata\": [], \"built_in_metadata\": []}}}",
- "presentation": "{\"File\": {}, \"Parser:HipSignsRhyme\": {\"pdf\": {\"flatten_media_to_text\": false, \"output_format\": \"json\", \"parse_method\": \"DeepDOC\", \"preprocess\": [\"main_content\"], \"suffix\": [\"pdf\"], \"vlm\": {}}, \"slides\": {\"output_format\": \"json\", \"parse_method\": \"DeepDOC\", \"preprocess\": [\"main_content\"], \"suffix\": [\"pptx\", \"ppt\"]}}, \"Tokenizer:TallTreesDance\": {\"fields\": \"text\", \"filename_embd_weight\": 0.1, \"search_method\": [\"embedding\", \"full_text\"]}, \"PageChunker:HappyHillsGlow\": {}, \"Extractor:AutoExtractDefault\": {\"llm_id\": \"\", \"keywords\": {\"top_n\": 0}, \"questions\": {\"top_n\": 0}, \"tags\": {\"top_n\": 0, \"tag_file_id\": \"\"}, \"summary\": {\"enabled\": false}, \"metadata\": {\"enabled\": false, \"metadata\": [], \"built_in_metadata\": []}}}",
- "qa": "{\"File\": {}, \"Parser:HipSignsRhyme\": {\"docx\": {\"flatten_media_to_text\": false, \"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"docx\"], \"vlm\": {}}, \"markdown\": {\"flatten_media_to_text\": false, \"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"md\", \"markdown\", \"mdx\"], \"vlm\": {}}, \"pdf\": {\"flatten_media_to_text\": false, \"output_format\": \"json\", \"parse_method\": \"DeepDOC\", \"preprocess\": [\"main_content\"], \"suffix\": [\"pdf\"], \"vlm\": {}}, \"spreadsheet\": {\"flatten_media_to_text\": false, \"output_format\": \"html\", \"parse_method\": \"DeepDOC\", \"preprocess\": [\"main_content\"], \"suffix\": [\"xls\", \"xlsx\", \"csv\"], \"vlm\": {}}, \"text&code\": {\"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"txt\"]}}, \"Tokenizer:ColdCloudsDream\": {\"fields\": \"text\", \"filename_embd_weight\": 0.1, \"search_method\": [\"embedding\", \"full_text\"]}, \"QAChunker:TidyCloudsThink\": {}}",
- "table": "{\"File\": {}, \"Parser:HipSignsRhyme\": {\"spreadsheet\": {\"flatten_media_to_text\": false, \"output_format\": \"html\", \"parse_method\": \"DeepDOC\", \"preprocess\": [\"main_content\"], \"suffix\": [\"xls\", \"xlsx\", \"csv\"], \"vlm\": {}, \"column_mode\": \"auto\", \"column_roles\": {}, \"column_names\": []}, \"text&code\": {\"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"txt\"]}}, \"TableChunker:FastFoxesJump\": {}, \"Tokenizer:DeepLakesShine\": {\"fields\": \"text\", \"filename_embd_weight\": 0.1, \"search_method\": [\"embedding\", \"full_text\"]}}",
+ "audio": "{\"File\": {}, \"Parser:SongsFillAir\": {\"enable_vision_enhancement\": false, \"vlm\": {\"llm_id\": \"\"}, \"audio\": {\"output_format\": \"text\", \"preprocess\": [\"main_content\"], \"suffix\": [\"aac\", \"aiff\", \"ape\", \"au\", \"da\", \"flac\", \"midi\", \"mp3\", \"ogg\", \"oggvorbis\", \"realaudio\", \"vqf\", \"wav\", \"wave\", \"wma\"]}}, \"OneChunker:BlueSkiesLaugh\": {}, \"Tokenizer:KindEyesWatch\": {\"fields\": \"text\", \"filename_embd_weight\": 0.1, \"search_method\": [\"embedding\", \"full_text\"]}, \"Extractor:AutoExtractDefault\": {\"llm_id\": \"\", \"keywords\": {\"top_n\": 0}, \"questions\": {\"top_n\": 0}, \"tags\": {\"top_n\": 0, \"tag_file_id\": \"\"}, \"summary\": {\"enabled\": false}, \"metadata\": {\"enabled\": false, \"metadata\": [], \"built_in_metadata\": []}}}",
+ "book": "{\"File\": {}, \"Parser:HipSignsRhyme\": {\"enable_vision_enhancement\": false, \"vlm\": {\"llm_id\": \"\"}, \"doc\": {\"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"doc\"]}, \"docx\": {\"flatten_media_to_text\": false, \"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"docx\"], \"vlm\": {}}, \"html\": {\"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"htm\", \"html\"]}, \"pdf\": {\"flatten_media_to_text\": false, \"output_format\": \"json\", \"parse_method\": \"DeepDOC\", \"preprocess\": [\"main_content\"], \"remove_toc\": true, \"suffix\": [\"pdf\"], \"vlm\": {}}, \"text&code\": {\"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"txt\"]}}, \"TitleChunker:GrumpyGarlicsBake\": {\"hierarchy\": 5, \"include_heading_content\": true, \"levels\": [[\"^#[^#]\", \"^##[^#]\", \"^###[^#]\", \"^####[^#]\"], [\"第[零一二三四五六七八九十百0-9]+(分?编|部分)\", \"第[零一二三四五六七八九十百0-9]+章\", \"第[零一二三四五六七八九十百0-9]+节\", \"第[零一二三四五六七八九十百0-9]+条\", \"[\\\\((][零一二三四五六七八九十百]+[\\\\))]\"], [\"第[0-9]+章\", \"第[0-9]+节\", \"[0-9]{1,2}[\\\\. 、]\", \"[0-9]{1,2}\\\\.[0-9]{1,2}($|[^a-zA-Z/%~.-])\", \"[0-9]{1,2}\\\\.[0-9]{1,2}\\\\.[0-9]{1,2}\"], [\"第[零一二三四五六七八九十百0-9]+章\", \"第[零一二三四五六七八九十百0-9]+节\", \"[零一二三四五六七八九十百]+[ 、]\", \"[\\\\((][零一二三四五六七八九十百]+[\\\\))]\", \"[\\\\((][0-9]{,2}[\\\\))]\"], [\"PART (ONE|TWO|THREE|FOUR|FIVE|SIX|SEVEN|EIGHT|NINE|TEN)\", \"Chapter (I+V?|VI*|XI|IX|X)\", \"Section [0-9]+\", \"Article [0-9]+\"]], \"method\": \"hierarchy\"}, \"Tokenizer:HotDonutsRing\": {\"fields\": \"text\", \"filename_embd_weight\": 0.1, \"search_method\": [\"embedding\", \"full_text\"]}, \"Extractor:AutoExtractDefault\": {\"llm_id\": \"\", \"keywords\": {\"top_n\": 0}, \"questions\": {\"top_n\": 0}, \"tags\": {\"top_n\": 0, \"tag_file_id\": \"\"}, \"summary\": {\"enabled\": false}, \"metadata\": {\"enabled\": false, \"metadata\": [], \"built_in_metadata\": []}}}",
+ "email": "{\"File\": {}, \"Parser:BirdsFlutterHigh\": {\"enable_vision_enhancement\": false, \"vlm\": {\"llm_id\": \"\"}, \"email\": {\"fields\": [\"from\", \"to\", \"cc\", \"bcc\", \"date\", \"subject\", \"body\", \"attachments\"], \"output_format\": \"text\", \"preprocess\": [\"main_content\"], \"suffix\": [\"eml\"]}}, \"TokenChunker:WarmBreadSmells\": {\"children_delimiters\": [], \"chunk_token_size\": 512, \"delimiter_mode\": \"delimiter\", \"delimiters\": [\"\\n\", \"!\", \"?\", \"。\", \";\", \"!\", \"?\"], \"image_context_size\": 0, \"overlapped_percent\": 0, \"table_context_size\": 0}, \"Tokenizer:NiceWordsSpoken\": {\"fields\": \"text\", \"filename_embd_weight\": 0.1, \"search_method\": [\"embedding\", \"full_text\"]}, \"Extractor:AutoExtractDefault\": {\"llm_id\": \"\", \"keywords\": {\"top_n\": 0}, \"questions\": {\"top_n\": 0}, \"tags\": {\"top_n\": 0, \"tag_file_id\": \"\"}, \"summary\": {\"enabled\": false}, \"metadata\": {\"enabled\": false, \"metadata\": [], \"built_in_metadata\": []}}}",
+ "general": "{\"File\": {}, \"Parser:HipSignsRhyme\": {\"enable_vision_enhancement\": false, \"vlm\": {\"llm_id\": \"\"}, \"doc\": {\"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"doc\"]}, \"docx\": {\"flatten_media_to_text\": false, \"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"docx\"], \"vlm\": {}}, \"html\": {\"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"htm\", \"html\"]}, \"markdown\": {\"flatten_media_to_text\": false, \"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"md\", \"markdown\", \"mdx\"], \"vlm\": {}}, \"pdf\": {\"flatten_media_to_text\": false, \"output_format\": \"json\", \"pages\": [[1, 100000]], \"parse_method\": \"DeepDOC\", \"preprocess\": [\"main_content\"], \"suffix\": [\"pdf\"], \"vlm\": {}}, \"spreadsheet\": {\"flatten_media_to_text\": false, \"output_format\": \"json\", \"parse_method\": \"DeepDOC\", \"preprocess\": [\"main_content\"], \"suffix\": [\"xls\", \"xlsx\", \"csv\"], \"vlm\": {}}, \"text&code\": {\"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"txt\", \"py\", \"js\", \"java\", \"c\", \"cpp\", \"h\", \"php\", \"go\", \"ts\", \"sh\", \"cs\", \"kt\", \"sql\"]}}, \"GeneralChunker:SixApplesFall\": {\"children_delimiters\": [], \"chunk_token_size\": 512, \"delimiters\": [\"\\n\", \"!\", \"?\", \";\", \"。\", \";\", \"!\", \"?\"], \"image_context_size\": 0, \"overlapped_percent\": 0, \"table_context_size\": 0}, \"Tokenizer:LegalReadersDecide\": {\"fields\": \"text\", \"filename_embd_weight\": 0.1, \"search_method\": [\"embedding\", \"full_text\"]}, \"Extractor:AutoExtractDefault\": {\"llm_id\": \"\", \"keywords\": {\"top_n\": 0}, \"questions\": {\"top_n\": 0}, \"tags\": {\"top_n\": 0, \"tag_file_id\": \"\"}, \"summary\": {\"enabled\": false}, \"metadata\": {\"enabled\": false, \"metadata\": [], \"built_in_metadata\": []}}}",
+ "laws": "{\"File\": {}, \"Parser:HipSignsRhyme\": {\"enable_vision_enhancement\": false, \"vlm\": {\"llm_id\": \"\"}, \"doc\": {\"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"doc\"]}, \"docx\": {\"flatten_media_to_text\": false, \"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"docx\"], \"vlm\": {}}, \"html\": {\"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"htm\", \"html\"]}, \"markdown\": {\"flatten_media_to_text\": false, \"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"md\", \"markdown\", \"mdx\"], \"vlm\": {}}, \"pdf\": {\"flatten_media_to_text\": false, \"output_format\": \"json\", \"parse_method\": \"DeepDOC\", \"preprocess\": [\"main_content\"], \"remove_toc\": true, \"suffix\": [\"pdf\"], \"vlm\": {}}, \"text&code\": {\"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"txt\"]}}, \"TitleChunker:SpicyKeysKick\": {\"hierarchy\": 2, \"include_heading_content\": false, \"levels\": [[\"^#[^#]\", \"^##[^#]\", \"^###[^#]\", \"^####[^#]\"], [\"第[零一二三四五六七八九十百0-9]+(分?编|部分)\", \"第[零一二三四五六七八九十百0-9]+章\", \"第[零一二三四五六七八九十百0-9]+节\", \"第[零一二三四五六七八九十百0-9]+条\", \"[\\\\((][零一二三四五六七八九十百]+[\\\\))]\"], [\"第[0-9]+章\", \"第[0-9]+节\", \"[0-9]{1,2}[\\\\. 、]\", \"[0-9]{1,2}\\\\.[0-9]{1,2}($|[^a-zA-Z/%~.-])\", \"[0-9]{1,2}\\\\.[0-9]{1,2}\\\\.[0-9]{1,2}\"], [\"第[零一二三四五六七八九十百0-9]+章\", \"第[零一二三四五六七八九十百0-9]+节\", \"[零一二三四五六七八九十百]+[ 、]\", \"[\\\\((][零一二三四五六七八九十百]+[\\\\))]\", \"[\\\\((][0-9]{,2}[\\\\))]\"], [\"PART (ONE|TWO|THREE|FOUR|FIVE|SIX|SEVEN|EIGHT|NINE|TEN)\", \"Chapter (I+V?|VI*|XI|IX|X)\", \"Section [0-9]+\", \"Article [0-9]+\"]], \"method\": \"hierarchy\"}, \"Tokenizer:PublicJobsTake\": {\"fields\": \"text\", \"filename_embd_weight\": 0.1, \"search_method\": [\"embedding\", \"full_text\"]}, \"Extractor:AutoExtractDefault\": {\"llm_id\": \"\", \"keywords\": {\"top_n\": 0}, \"questions\": {\"top_n\": 0}, \"tags\": {\"top_n\": 0, \"tag_file_id\": \"\"}, \"summary\": {\"enabled\": false}, \"metadata\": {\"enabled\": false, \"metadata\": [], \"built_in_metadata\": []}}}",
+ "manual": "{\"File\": {}, \"Parser:HipSignsRhyme\": {\"enable_vision_enhancement\": false, \"vlm\": {\"llm_id\": \"\"}, \"doc\": {\"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"doc\"]}, \"docx\": {\"flatten_media_to_text\": false, \"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"docx\"], \"vlm\": {}}, \"pdf\": {\"flatten_media_to_text\": false, \"output_format\": \"json\", \"parse_method\": \"DeepDOC\", \"preprocess\": [\"main_content\"], \"suffix\": [\"pdf\"], \"vlm\": {}}}, \"ManualChunker:NineInsectsFind\": {\"hierarchy\": 0, \"include_heading_content\": false, \"levels\": [[\"^#[^#]\", \"^##[^#]\", \"^###[^#]\", \"^####[^#]\"], [\"第[零一二三四五六七八九十百0-9]+(分?编|部分)\", \"第[零一二三四五六七八九十百0-9]+章\", \"第[零一二三四五六七八九十百0-9]+节\", \"第[零一二三四五六七八九十百0-9]+条\", \"[\\\\((][零一二三四五六七八九十百]+[\\\\))]\"], [\"第[0-9]+章\", \"第[0-9]+节\", \"[0-9]{1,2}[\\\\. 、]\", \"[0-9]{1,2}\\\\.[0-9]{1,2}($|[^a-zA-Z/%~.-])\", \"[0-9]{1,2}\\\\.[0-9]{1,2}\\\\.[0-9]{1,2}\"], [\"第[零一二三四五六七八九十百0-9]+章\", \"第[零一二三四五六七八九十百0-9]+节\", \"[零一二三四五六七八九十百]+[ 、]\", \"[\\\\((][零一二三四五六七八九十百]+[\\\\))]\", \"[\\\\((][0-9]{,2}[\\\\))]\"], [\"PART (ONE|TWO|THREE|FOUR|FIVE|SIX|SEVEN|EIGHT|NINE|TEN)\", \"Chapter (I+V?|VI*|XI|IX|X)\", \"Section [0-9]+\", \"Article [0-9]+\"]], \"method\": \"group\"}, \"Tokenizer:FunnyBalloonsGrin\": {\"fields\": \"text\", \"filename_embd_weight\": 0.1, \"search_method\": [\"embedding\", \"full_text\"]}, \"Extractor:AutoExtractDefault\": {\"llm_id\": \"\", \"keywords\": {\"top_n\": 0}, \"questions\": {\"top_n\": 0}, \"tags\": {\"top_n\": 0, \"tag_file_id\": \"\"}, \"summary\": {\"enabled\": false}, \"metadata\": {\"enabled\": false, \"metadata\": [], \"built_in_metadata\": []}}}",
+ "one": "{\"File\": {}, \"Parser:HipSignsRhyme\": {\"enable_vision_enhancement\": false, \"vlm\": {\"llm_id\": \"\"}, \"doc\": {\"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"doc\"]}, \"docx\": {\"flatten_media_to_text\": false, \"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"docx\"], \"vlm\": {}}, \"html\": {\"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"htm\", \"html\"]}, \"markdown\": {\"flatten_media_to_text\": false, \"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"md\", \"markdown\", \"mdx\"], \"vlm\": {}}, \"pdf\": {\"flatten_media_to_text\": false, \"output_format\": \"json\", \"parse_method\": \"DeepDOC\", \"preprocess\": [\"main_content\"], \"suffix\": [\"pdf\"], \"vlm\": {}}, \"spreadsheet\": {\"flatten_media_to_text\": false, \"output_format\": \"html\", \"parse_method\": \"DeepDOC\", \"preprocess\": [\"main_content\"], \"suffix\": [\"xls\", \"xlsx\"], \"vlm\": {}}, \"text&code\": {\"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"txt\"]}}, \"OneChunker:DryDrinksVisit\": {}, \"Tokenizer:FrankWeeksListen\": {\"fields\": \"text\", \"filename_embd_weight\": 0.1, \"search_method\": [\"embedding\", \"full_text\"]}, \"Extractor:AutoExtractDefault\": {\"llm_id\": \"\", \"keywords\": {\"top_n\": 0}, \"questions\": {\"top_n\": 0}, \"tags\": {\"top_n\": 0, \"tag_file_id\": \"\"}, \"summary\": {\"enabled\": false}, \"metadata\": {\"enabled\": false, \"metadata\": [], \"built_in_metadata\": []}}}",
+ "paper": "{\"File\": {}, \"Parser:HipSignsRhyme\": {\"enable_vision_enhancement\": false, \"vlm\": {\"llm_id\": \"\"}, \"pdf\": {\"enable_multi_column\": true, \"flatten_media_to_text\": false, \"output_format\": \"json\", \"parse_method\": \"DeepDOC\", \"preprocess\": [\"main_content\"], \"suffix\": [\"pdf\"], \"vlm\": {}}}, \"TitleChunker:SparklySchoolsTravel\": {\"hierarchy\": 0, \"include_heading_content\": false, \"levels\": [[\"^#[^#]\", \"^##[^#]\", \"^###[^#]\", \"^####[^#]\"], [\"第[零一二三四五六七八九十百0-9]+(分?编|部分)\", \"第[零一二三四五六七八九十百0-9]+章\", \"第[零一二三四五六七八九十百0-9]+节\", \"第[零一二三四五六七八九十百0-9]+条\", \"[\\\\((][零一二三四五六七八九十百]+[\\\\))]\"], [\"第[0-9]+章\", \"第[0-9]+节\", \"[0-9]{1,2}[\\\\. 、]\", \"[0-9]{1,2}\\\\.[0-9]{1,2}($|[^a-zA-Z/%~.-])\", \"[0-9]{1,2}\\\\.[0-9]{1,2}\\\\.[0-9]{1,2}\"], [\"第[零一二三四五六七八九十百0-9]+章\", \"第[零一二三四五六七八九十百0-9]+节\", \"[零一二三四五六七八九十百]+[ 、]\", \"[\\\\((][零一二三四五六七八九十百]+[\\\\))]\", \"[\\\\((][0-9]{,2}[\\\\))]\"], [\"PART (ONE|TWO|THREE|FOUR|FIVE|SIX|SEVEN|EIGHT|NINE|TEN)\", \"Chapter (I+V?|VI*|XI|IX|X)\", \"Section [0-9]+\", \"Article [0-9]+\"]], \"method\": \"group\"}, \"Tokenizer:GreatCarsWash\": {\"fields\": \"text\", \"filename_embd_weight\": 0.1, \"search_method\": [\"embedding\", \"full_text\"]}, \"Extractor:AutoExtractDefault\": {\"llm_id\": \"\", \"keywords\": {\"top_n\": 0}, \"questions\": {\"top_n\": 0}, \"tags\": {\"top_n\": 0, \"tag_file_id\": \"\"}, \"summary\": {\"enabled\": false}, \"metadata\": {\"enabled\": false, \"metadata\": [], \"built_in_metadata\": []}}}",
+ "picture": "{\"File\": {}, \"Parser:ViewsCaptureLight\": {\"enable_vision_enhancement\": false, \"vlm\": {\"llm_id\": \"\"}, \"image\": {\"output_format\": \"json\", \"parse_method\": \"ocr\", \"preprocess\": [\"main_content\"], \"suffix\": [\"bmp\", \"gif\", \"jpeg\", \"jpg\", \"png\", \"svg\", \"tif\", \"tiff\", \"webp\"]}, \"video\": {\"output_format\": \"text\", \"preprocess\": [\"main_content\"], \"suffix\": [\"3gp\", \"3gpp\", \"avi\", \"flv\", \"mkv\", \"mov\", \"mp4\", \"mpeg\", \"mpg\", \"webm\", \"wmv\"]}}, \"OneChunker:BrightColorsGlow\": {}, \"Tokenizer:SharpLensFocus\": {\"fields\": \"text\", \"filename_embd_weight\": 0.1, \"search_method\": [\"embedding\", \"full_text\"]}, \"Extractor:AutoExtractDefault\": {\"llm_id\": \"\", \"keywords\": {\"top_n\": 0}, \"questions\": {\"top_n\": 0}, \"tags\": {\"top_n\": 0, \"tag_file_id\": \"\"}, \"summary\": {\"enabled\": false}, \"metadata\": {\"enabled\": false, \"metadata\": [], \"built_in_metadata\": []}}}",
+ "presentation": "{\"File\": {}, \"Parser:HipSignsRhyme\": {\"enable_vision_enhancement\": false, \"vlm\": {\"llm_id\": \"\"}, \"pdf\": {\"flatten_media_to_text\": false, \"output_format\": \"json\", \"parse_method\": \"DeepDOC\", \"preprocess\": [\"main_content\"], \"suffix\": [\"pdf\"], \"vlm\": {}}, \"slides\": {\"output_format\": \"json\", \"parse_method\": \"DeepDOC\", \"preprocess\": [\"main_content\"], \"suffix\": [\"pptx\", \"ppt\"]}}, \"Tokenizer:TallTreesDance\": {\"fields\": \"text\", \"filename_embd_weight\": 0.1, \"search_method\": [\"embedding\", \"full_text\"]}, \"PageChunker:HappyHillsGlow\": {}, \"Extractor:AutoExtractDefault\": {\"llm_id\": \"\", \"keywords\": {\"top_n\": 0}, \"questions\": {\"top_n\": 0}, \"tags\": {\"top_n\": 0, \"tag_file_id\": \"\"}, \"summary\": {\"enabled\": false}, \"metadata\": {\"enabled\": false, \"metadata\": [], \"built_in_metadata\": []}}}",
+ "qa": "{\"File\": {}, \"Parser:HipSignsRhyme\": {\"enable_vision_enhancement\": false, \"vlm\": {\"llm_id\": \"\"}, \"docx\": {\"flatten_media_to_text\": false, \"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"docx\"], \"vlm\": {}}, \"markdown\": {\"flatten_media_to_text\": false, \"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"md\", \"markdown\", \"mdx\"], \"vlm\": {}}, \"pdf\": {\"flatten_media_to_text\": false, \"output_format\": \"json\", \"parse_method\": \"DeepDOC\", \"preprocess\": [\"main_content\"], \"suffix\": [\"pdf\"], \"vlm\": {}}, \"spreadsheet\": {\"flatten_media_to_text\": false, \"output_format\": \"html\", \"parse_method\": \"DeepDOC\", \"preprocess\": [\"main_content\"], \"suffix\": [\"xls\", \"xlsx\", \"csv\"], \"vlm\": {}}, \"text&code\": {\"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"txt\"]}}, \"Tokenizer:ColdCloudsDream\": {\"fields\": \"text\", \"filename_embd_weight\": 0.1, \"search_method\": [\"embedding\", \"full_text\"]}, \"QAChunker:TidyCloudsThink\": {}}",
+ "table": "{\"File\": {}, \"Parser:HipSignsRhyme\": {\"enable_vision_enhancement\": false, \"vlm\": {\"llm_id\": \"\"}, \"spreadsheet\": {\"flatten_media_to_text\": false, \"output_format\": \"html\", \"parse_method\": \"DeepDOC\", \"preprocess\": [\"main_content\"], \"suffix\": [\"xls\", \"xlsx\", \"csv\"], \"vlm\": {}, \"column_mode\": \"auto\", \"column_roles\": {}, \"column_names\": []}, \"text&code\": {\"output_format\": \"json\", \"preprocess\": [\"main_content\"], \"suffix\": [\"txt\"]}}, \"TableChunker:FastFoxesJump\": {}, \"Tokenizer:DeepLakesShine\": {\"fields\": \"text\", \"filename_embd_weight\": 0.1, \"search_method\": [\"embedding\", \"full_text\"]}}",
}
// Per-template test methods. Each resolves default component params from a
diff --git a/web/src/pages/agent/form/parser-form/index.tsx b/web/src/pages/agent/form/parser-form/index.tsx
index 22ec8c25fd..9771180c4d 100644
--- a/web/src/pages/agent/form/parser-form/index.tsx
+++ b/web/src/pages/agent/form/parser-form/index.tsx
@@ -201,7 +201,7 @@ const ParserForm = ({
return (
<Form {...form}>
- <form className="space-y-5 px-5">
+ <form className="space-y-5 px-5 pt-4">
<VisionEnhancementFormFields />
{fields.map((field, index) => {
return (
diff --git a/web/src/pages/agent/form/parser-form/vision-form-fields.test.tsx b/web/src/pages/agent/form/parser-form/vision-form-fields.test.tsx
new file mode 100644
index 0000000000..934340bfc9
--- /dev/null
+++ b/web/src/pages/agent/form/parser-form/vision-form-fields.test.tsx
@@ -0,0 +1,87 @@
+import { fireEvent, render, screen } from '@testing-library/react';
+import { FormProvider, useForm } from 'react-hook-form';
+import { VisionEnhancementFormFields } from './vision-form-fields';
+
+jest.mock('@/hooks/use-llm-request', () => ({
+ useFetchDefaultModelDictionary: () => ({ img2txt_id: 'model-A' }),
+}));
+
+jest.mock('../../context', () => ({ useOwnerTenantId: () => 'tenant-1' }));
+
+jest.mock('react-i18next', () => ({
+ useTranslation: () => ({ t: (key: string) => key }),
+}));
+
+jest.mock('@/components/ragflow-form', () => ({
+ RAGFlowFormItem: ({ name, children }: any) => {
+ const {
+ Controller,
+ useFormContext,
+ }: typeof import('react-hook-form') = require('react-hook-form');
+ const { control } = useFormContext();
+ return (
+ <Controller
+ name={name}
+ control={control}
+ render={({ field }) => children(field)}
+ />
+ );
+ },
+}));
+
+jest.mock('@/components/model-tree-select', () => ({
+ ModelTypeMap: { img2txt_id: ['image2text'] },
+ ModelTreeSelectFormField: ({ name }: any) => {
+ const {
+ Controller,
+ useFormContext,
+ }: typeof import('react-hook-form') = require('react-hook-form');
+ const { control } = useFormContext();
+ return (
+ <Controller
+ name={name}
+ control={control}
+ render={({ field }) => (
+ <select aria-label="Vision model" {...field}>
+ <option value="">Default</option>
+ <option value="model-A">A</option>
+ <option value="model-B">B</option>
+ </select>
+ )}
+ />
+ );
+ },
+}));
+
+function ParserVisionForm({ model = '' }: { model?: string }) {
+ const form = useForm({
+ defaultValues: { enable_vision_enhancement: false, vlm: { llm_id: model } },
+ });
+ return (
+ <FormProvider {...form}>
+ <VisionEnhancementFormFields />
+ </FormProvider>
+ );
+}
+
+describe('global vision model selection', () => {
+ it('selects default A on first enable and preserves user-selected B across toggles', () => {
+ render(<ParserVisionForm />);
+ fireEvent.click(screen.getByRole('switch'));
+ expect(screen.getByLabelText('Vision model')).toHaveValue('model-A');
+
+ fireEvent.change(screen.getByLabelText('Vision model'), {
+ target: { value: 'model-B' },
+ });
+ fireEvent.click(screen.getByRole('switch'));
+ expect(screen.queryByLabelText('Vision model')).not.toBeInTheDocument();
+ fireEvent.click(screen.getByRole('switch'));
+ expect(screen.getByLabelText('Vision model')).toHaveValue('model-B');
+ });
+
+ it('keeps saved model B when enhancement is enabled again', () => {
+ render(<ParserVisionForm model="model-B" />);
+ fireEvent.click(screen.getByRole('switch'));
+ expect(screen.getByLabelText('Vision model')).toHaveValue('model-B');
+ });
+});
diff --git a/web/src/pages/agent/utils.test.ts b/web/src/pages/agent/utils.test.ts
index bf6057590f..c58c11828d 100644
--- a/web/src/pages/agent/utils.test.ts
+++ b/web/src/pages/agent/utils.test.ts
@@ -1,4 +1,5 @@
import { RAGFlowNodeType } from '@/interfaces/database/agent';
+import { FileType } from '@/constants/file';
import { Operator } from './constant';
import {
generateNodeNamesWithIncreasingIndex,
@@ -7,9 +8,39 @@ import {
receiveMessageError,
shouldSeedDefaultDelimiter,
transformGeneralChunkerParams,
+ transformParserParams,
transformTokenChunkerParams,
} from './utils';
+describe('transformParserParams vision settings', () => {
+ it('saves the normalized global settings when the node form was not opened', () => {
+ const result = transformParserParams({
+ setups: [
+ { fileFormat: FileType.PDF, vlm: { llm_id: 'model-B' } },
+ { fileFormat: FileType.Audio, vlm: { llm_id: 'asr-model' } },
+ ],
+ } as any);
+
+ expect(result.enable_vision_enhancement).toBe(true);
+ expect(result.vlm).toEqual({ llm_id: 'model-B' });
+ expect(result).not.toHaveProperty(`${FileType.PDF}.vlm`);
+ expect(result).toHaveProperty(`${FileType.Audio}.vlm`, {
+ llm_id: 'asr-model',
+ });
+ });
+
+ it.each([true, false])('preserves model B with enhancement %s', (enabled) => {
+ const result = transformParserParams({
+ enable_vision_enhancement: enabled,
+ vlm: { llm_id: 'model-B' },
+ setups: [{ fileFormat: FileType.Image, parse_method: 'ocr' }],
+ } as any);
+
+ expect(result.enable_vision_enhancement).toBe(enabled);
+ expect(result.vlm).toEqual({ llm_id: 'model-B' });
+ });
+});
+
describe('transformTokenChunkerParams', () => {
it('keeps overlapped_percent and delimiters when delimiter_mode is one', () => {
// Regression: saving with delimiter_mode='one' used to zero these fields,
diff --git a/web/src/pages/agent/utils.ts b/web/src/pages/agent/utils.ts
index 03e88f8fc3..fdfd84601b 100644
--- a/web/src/pages/agent/utils.ts
+++ b/web/src/pages/agent/utils.ts
@@ -205,10 +205,8 @@ function transformObjectArrayToPureArray(
}
export function transformParserParams(params: ParserFormSchemaType) {
- // The vision options (enable_vision_enhancement / vlm.llm_id) live at the
- // params top level alongside the per-family setups — the backend reads them
- // there, so they pass through as-is. normalizeParserFormValues also lifts
- // legacy per-setup values of nodes saved before the move.
+ // Save global vision options from the normalized form alongside the
+ // per-family setups, including nodes whose form has not been opened.
const normalizedParams = normalizeParserFormValues(params);
const setups = normalizedParams.setups.reduce<
Record<string, ParserFormSchemaType['setups'][0]>
@@ -331,7 +329,7 @@ export function transformParserParams(params: ParserFormSchemaType) {
}, {});
// Flatten the setups map into the top-level params.
- return { ...omit(params, ['setups']), ...setups };
+ return { ...omit(normalizedParams, ['setups']), ...setups };
}
// Decides whether an empty delimiter list should be re-seeded with the