Skip to content

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

Fix: Switching the parsing mode when creating a dataset will cause the embedding model to change. (#20198)

balibabu296c1f1e4bc8
diff --git a/web/src/pages/datasets/dataset-creating-dialog.tsx b/web/src/pages/datasets/dataset-creating-dialog.tsx
index 0bf71cc76d..b5f47f9659 100644
--- a/web/src/pages/datasets/dataset-creating-dialog.tsx
+++ b/web/src/pages/datasets/dataset-creating-dialog.tsx
@@ -113,10 +113,15 @@ export function InputForm({ onOk }: IModalProps<any>) {
if (parseType === ParseType.BuiltIn) {
form.setValue('pipeline_id', '');
}
- if (defaultModelDictionary?.embd_id) {
- form.setValue('embedding_model', defaultModelDictionary?.embd_id);
+ }, [parseType, form]);
+
+ // Backfill the default embedding model once the async query resolves, but
+ // never overwrite a model the user has already picked.
+ useEffect(() => {
+ if (defaultModelDictionary?.embd_id && !form.getValues('embedding_model')) {
+ form.setValue('embedding_model', defaultModelDictionary.embd_id);
}
- }, [parseType, form, defaultModelDictionary]);
+ }, [defaultModelDictionary, form]);
return (
<Form {...form}>