mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-12 14:45:42 +08:00
Fix: RAPTOR "Generation scope" reset to "Single file" when selecting "Dataset" (#14477)
## Problem
In the Dataset Configuration page, changing the RAPTOR **Generation
scope** from "Single file" to "Dataset" and clicking **Save** did not
persist the change. After refreshing or re-entering the page, the scope
always reverted to "Single file".
## Root Cause
1. **Backend**: The `RaptorConfig` Pydantic model in
`api/utils/validation_utils.py` was configured with `extra="forbid"` but
did not declare a `scope` field. When the frontend sent `"scope":
"dataset"`, Pydantic rejected the request.
2. **Frontend**: The `extractRaptorConfigExt` utility in
`web/src/hooks/parser-config-utils.ts` treated `scope` as an unknown
field and moved it into the nested `ext` object. Consequently, the
backend could not read `raptor_config.get("scope", "file")` correctly,
so the default `"file"` was always used.
## Changes
- Added `scope: Literal["file", "dataset"]` to the backend
`RaptorConfig` model with a default of `"file"`.
- Added `scope` to the known-field whitelist in the frontend
`extractRaptorConfigExt` helper so it is transmitted as a top-level
raptor field instead of being buried in `ext`.
### Type of change
- [x] Bug Fix (non-breaking change which fixes an issue)
---------
Signed-off-by: noob <yixiao121314@outlook.com>
This commit is contained in:
@@ -20,6 +20,7 @@ export const extractRaptorConfigExt = (
|
||||
threshold,
|
||||
max_cluster,
|
||||
random_seed,
|
||||
scope,
|
||||
auto_disable_for_structured_data,
|
||||
ext,
|
||||
...raptorExt
|
||||
@@ -31,6 +32,7 @@ export const extractRaptorConfigExt = (
|
||||
threshold,
|
||||
max_cluster,
|
||||
random_seed,
|
||||
scope,
|
||||
auto_disable_for_structured_data,
|
||||
ext: { ...ext, ...raptorExt },
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user