RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
fix(setting-model): stop silently dropping a duplicate-named provider instance (#18722)
chanx12ec6ee9948d
diff --git a/web/src/hooks/use-llm-request.tsx b/web/src/hooks/use-llm-request.tsxindex ff9976ba41..fcf5d3c154 100644--- a/web/src/hooks/use-llm-request.tsx+++ b/web/src/hooks/use-llm-request.tsx@@ -299,19 +299,8 @@ export const useAddProviderInstance = () => {) => {try {await addProvider({ provider_name: params.llm_factory });-- const { data: instancesRes } = await llmService.listProviderInstances(- { provider_name: params.llm_factory },- true,- );- const instanceExists = instancesRes?.data?.some(- (i: IProviderInstance) => i.instance_name === params.instance_name,- );- if (instanceExists && !params.verify) {- return { code: 0, data: null };- }} catch {- // ignore list failure and proceed to add+ // ignore and proceed to add}// The provider is carried in the URL pathdiff --git a/web/src/locales/en.ts b/web/src/locales/en.tsindex 9896b8f764..99a443038b 100644--- a/web/src/locales/en.ts+++ b/web/src/locales/en.ts@@ -2021,6 +2021,7 @@ Example: Virtual Hosted Style`,instanceNameTip:'A unique name to identify this provider instance under the same factory.',instanceNamePlaceholder: 'Please input instance name',+ instanceNameExists: 'Instance name already exists',deleteInstance: 'Delete instance',modelName: 'Model name',modelID: 'Model ID',diff --git a/web/src/locales/zh.ts b/web/src/locales/zh.tsindex e699c5dca7..5412169b39 100644--- a/web/src/locales/zh.ts+++ b/web/src/locales/zh.ts@@ -1701,6 +1701,7 @@ NER:使用 spaCy NER 和基于规则的关键词提取来抽取 Entities 和 RinstanceNameMessage: '请输入实例名称!',instanceNameTip: '用于在同一厂商下唯一标识该实例的名称。',instanceNamePlaceholder: '请输入实例名称',+ instanceNameExists: '实例名称已存在',deleteInstance: '删除实例',modelName: '模型名称',modelID: '模型ID',diff --git a/web/src/pages/user-setting/setting-model/index.tsx b/web/src/pages/user-setting/setting-model/index.tsxindex c4cefbe1ef..83d90df4ab 100644--- a/web/src/pages/user-setting/setting-model/index.tsx+++ b/web/src/pages/user-setting/setting-model/index.tsx@@ -15,6 +15,7 @@*/import Spotlight from '@/components/spotlight';+import message from '@/components/ui/message';import { useTranslate } from '@/hooks/common-hooks';import {LlmKeys,@@ -180,6 +181,21 @@ const SettingModelV2: FC = () => {.filter((e) => e.payload !== null);if (dirty.length === 0) return;+ // Reject duplicate instance names before any API call: a draft may+ // not reuse the name of a persisted instance, nor of another draft+ // in the same batch. Without this the backend would either error or+ // silently create a second instance sharing the name.+ const takenNames = new Set(instances.map((i) => i.instance_name));+ for (const { payload } of dirty) {+ if (!payload) continue;+ const name = payload.instanceName.trim();+ if (payload.isDraft && takenNames.has(name)) {+ message.error(tSetting('instanceNameExists'));+ return;+ }+ takenNames.add(name);+ }+const validations = await Promise.all(dirty.map(async (e) => ({ ...e, valid: await e.ref.validate() })),);@@ -237,6 +253,8 @@ const SettingModelV2: FC = () => {updateProviderInstance,queryClient,providerQueryName,+ instances,+ tSetting,]);// Whether the Save button should be enabled. We avoid an O(n) ref