Skip to content

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

fix(dataset): restore previous embedding model after failed validation (#21602)

Sbaaoui Idrissbf748a03f3fb
diff --git a/web/src/pages/dataset/setting/embedding-select.tsx b/web/src/pages/dataset/setting/embedding-select.tsx
index 7af8ba8293..d87aa49ca4 100644
--- a/web/src/pages/dataset/setting/embedding-select.tsx
+++ b/web/src/pages/dataset/setting/embedding-select.tsx
@@ -3,37 +3,30 @@ import { Spin } from '@/components/ui/spin';
import { useTranslate } from '@/hooks/common-hooks';
import { useCheckKbEmbedding } from '@/hooks/use-knowledge-request';
import { cn } from '@/lib/utils';
-import { useMemo } from 'react';
-import { FieldValues, useFormContext } from 'react-hook-form';
+import { FieldValues } from 'react-hook-form';
export const EmbeddingSelect = ({
isEdit,
field,
- name,
disabled = false,
testId,
ownerTenantId,
}: {
isEdit: boolean;
field: FieldValues;
- name?: string;
disabled?: boolean;
testId?: string;
ownerTenantId?: string;
}) => {
const { t } = useTranslate('knowledgeConfiguration');
- const form = useFormContext();
const { checkKbEmbedding, checking } = useCheckKbEmbedding();
- const oldValue = useMemo(() => {
- const embdStr = form.getValues(name || 'embedding_model');
- return embdStr || '';
- }, [form, name]);
return (
<div className="space-y-1.5">
<ModelTreeSelect
modelTypes={ModelTypeMap.embd_id}
onChange={async (value) => {
+ const oldValue = field.value;
field.onChange(value);
if (isEdit && disabled) {
const res = await checkKbEmbedding(value);