Skip to content

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

Fix add OpenRouter base_url, UI need to select at least one model to verify (#15894)

Wang Qi899f76af6b71
diff --git a/conf/llm_factories.json b/conf/llm_factories.json
index ff6cae6774..3caa508d61 100644
--- a/conf/llm_factories.json
+++ b/conf/llm_factories.json
@@ -1697,7 +1697,8 @@
"tags": "LLM,IMAGE2TEXT",
"status": "1",
"llm": [],
- "rank": "989"
+ "rank": "989",
+ "url": "https://openrouter.ai/api/v1"
},
{
"name": "StepFun",
diff --git a/web/src/locales/en.ts b/web/src/locales/en.ts
index 871631413f..79c4a297df 100644
--- a/web/src/locales/en.ts
+++ b/web/src/locales/en.ts
@@ -1774,6 +1774,8 @@ Example: Virtual Hosted Style`,
listModelsSearchPlaceholder: 'Search models…',
listModelsEmpty: 'No models available',
listModelsLoading: 'Loading models…',
+ selectModelBeforeVerify:
+ 'Please select at least one model before verification.',
addCustomModel: 'Add custom model',
addCustomModelTitle: 'Add custom model',
modelMaxTokens: 'Max tokens',
diff --git a/web/src/locales/zh.ts b/web/src/locales/zh.ts
index 5b7ed95d00..bd22de66cd 100644
--- a/web/src/locales/zh.ts
+++ b/web/src/locales/zh.ts
@@ -1462,6 +1462,7 @@ NER:使用 spaCy NER 和基于规则的关键词提取来抽取实体和关系
listModelsSearchPlaceholder: '搜索模型…',
listModelsEmpty: '暂无可用模型',
listModelsLoading: '正在加载模型…',
+ selectModelBeforeVerify: '请至少选择一个模型后再验证。',
addCustomModel: '添加自定义模型',
addCustomModelTitle: '添加自定义模型',
modelMaxTokens: '最大 Token 数',
diff --git a/web/src/pages/user-setting/setting-model/modal/provider-modal/hooks/use-provider-modal-actions.ts b/web/src/pages/user-setting/setting-model/modal/provider-modal/hooks/use-provider-modal-actions.ts
index 875339478c..523fbdf398 100644
--- a/web/src/pages/user-setting/setting-model/modal/provider-modal/hooks/use-provider-modal-actions.ts
+++ b/web/src/pages/user-setting/setting-model/modal/provider-modal/hooks/use-provider-modal-actions.ts
@@ -1,4 +1,6 @@
import { DynamicFormRef } from '@/components/dynamic-form';
+import message from '@/components/ui/message';
+import { useTranslate } from '@/hooks/common-hooks';
import { IModelInfo } from '@/interfaces/request/llm';
import { VerifyResult } from '@/pages/user-setting/setting-model/hooks';
import { RefObject, useCallback } from 'react';
@@ -81,12 +83,18 @@ export const useProviderModalActions = ({
onVerify,
onViewModeOk,
}: ActionParams) => {
+ const { t } = useTranslate('setting');
+
const handleVerify = useCallback(
async (params: any) => {
const values = formRef.current?.getValues() || params;
if (!config.verifyTransform) {
return { isValid: null, logs: '' } as VerifyResult;
}
+ if (hasModelNameField && modelInfoList.length === 0) {
+ message.error(t('selectModelBeforeVerify'));
+ return { isValid: null, logs: '' } as VerifyResult;
+ }
const verifyArgs = config.verifyTransform({
...values,
model_info: modelInfoList,
@@ -98,7 +106,15 @@ export const useProviderModalActions = ({
const res = await onVerify({ ...params, ...verifyArgs });
return (res || { isValid: null, logs: '' }) as VerifyResult;
},
- [config, onVerify, modelInfoList, formRef, baseUrlRegionMaps],
+ [
+ config,
+ onVerify,
+ modelInfoList,
+ formRef,
+ baseUrlRegionMaps,
+ hasModelNameField,
+ t,
+ ],
);
const handleSubmit = useCallback(