Skip to content

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

Fix: Switching the rerank model on the chat page fails to save the configuration. (#18357)

balibabu8664d8d62a3b
diff --git a/web/src/components/rerank.tsx b/web/src/components/rerank.tsx
index 9ca3908a0a..e748524464 100644
--- a/web/src/components/rerank.tsx
+++ b/web/src/components/rerank.tsx
@@ -19,7 +19,6 @@ import { useTranslate } from '@/hooks/common-hooks';
import { prefixName } from '@/utils/form';
import { useFormContext } from 'react-hook-form';
import { z } from 'zod';
-import { SliderInputFormField } from './slider-input-form-field';
import {
FormControl,
FormField,
@@ -37,7 +36,6 @@ export const initialTopKValue = {
};
const DefaultRerankId = 'rerank_id';
-const DefaultTopK = 'top_k';
interface RerankFormFieldProps {
name?: string;
@@ -88,28 +86,12 @@ export function RerankFormFields({
prefix = '',
ownerTenantId,
}: RerankFormFieldsProps) {
- const { watch } = useFormContext();
- const { t } = useTranslate('knowledgeDetails');
const rerankIdName = prefixName(prefix, DefaultRerankId);
- const topKName = prefixName(prefix, DefaultTopK);
-
- const rerankId = watch(rerankIdName);
return (
- <>
- <RerankFormField
- name={rerankIdName}
- ownerTenantId={ownerTenantId}
- ></RerankFormField>
- {/* {rerankId && (
- <SliderInputFormField
- name={topKName}
- label={t('topK')}
- max={2048}
- min={1}
- tooltip={t('topKTip')}
- ></SliderInputFormField>
- )} */}
- </>
+ <RerankFormField
+ name={rerankIdName}
+ ownerTenantId={ownerTenantId}
+ ></RerankFormField>
);
}
diff --git a/web/src/interfaces/database/chat.ts b/web/src/interfaces/database/chat.ts
index cb7cdeec13..5a76003ec5 100644
--- a/web/src/interfaces/database/chat.ts
+++ b/web/src/interfaces/database/chat.ts
@@ -78,6 +78,7 @@ export interface IDialog {
top_k: number;
top_n: number;
rerank_id?: string;
+ tenant_rerank_id?: string;
meta_data_filter: MetaDataFilter;
}
diff --git a/web/src/pages/next-chats/chat/app-settings/chat-settings.tsx b/web/src/pages/next-chats/chat/app-settings/chat-settings.tsx
index 3f6260e7b3..ec51e5913d 100644
--- a/web/src/pages/next-chats/chat/app-settings/chat-settings.tsx
+++ b/web/src/pages/next-chats/chat/app-settings/chat-settings.tsx
@@ -88,10 +88,6 @@ export function ChatSettings({ hasSingleChatBox }: ChatSettingsProps) {
// Add model_type to llm_setting based on the selected llm_id
if (nextValues.llm_id) {
- // The model selector returns the tenant model ID. Keep the legacy
- // llm_id and the tenant-scoped ID synchronized; the backend gives
- // tenant_llm_id precedence when resolving the chat model.
- nextValues.tenant_llm_id = nextValues.llm_id;
nextValues.llm_setting = {
...nextValues.llm_setting,
model_type: findLlmByUuid(nextValues.llm_id)?.model_type || 'chat',
@@ -104,6 +100,8 @@ export function ChatSettings({ hasSingleChatBox }: ChatSettingsProps) {
...omit(data, [
'operator_permission',
'tenant_id',
+ 'tenant_llm_id',
+ 'tenant_rerank_id',
'created_by',
'create_time',
'create_date',
diff --git a/web/src/utils/llm-util.ts b/web/src/utils/llm-util.ts
index 7f18b9d810..364a58c052 100644
--- a/web/src/utils/llm-util.ts
+++ b/web/src/utils/llm-util.ts
@@ -174,9 +174,11 @@ const modelParamMap: ModelParamMap = {
};
// API endpoint whitelist - only these endpoints will have tenant parameters added
+// Note: /api/v1/chats is intentionally absent — the chats API normalizes the
+// model name/id pair server-side, so the frontend submits only llm_id /
+// rerank_id and must not have a stale tenant_* id injected back in here.
const API_WHITELIST = [
'/api/v1/users/me/models',
- '/api/v1/chats',
'/v1/canvas/set',
'/v1/canvas/setting',
'/api/v1/searches/',