Skip to content

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

Fix: use the Anthropic base URL placeholder for Anthropic (#21411)

Dmitry Sergeev31ddea42d094
diff --git a/web/src/pages/user-setting/setting-model/provider-schema/field-config/generic-api-key-config.test.ts b/web/src/pages/user-setting/setting-model/provider-schema/field-config/generic-api-key-config.test.ts
new file mode 100644
index 0000000000..678271449d
--- /dev/null
+++ b/web/src/pages/user-setting/setting-model/provider-schema/field-config/generic-api-key-config.test.ts
@@ -0,0 +1,23 @@
+import { LLMFactory } from '@/constants/llm';
+import { GenericApiKeyConfig } from './generic-api-key-config';
+
+jest.mock('@/components/dynamic-form', () => ({
+ FormFieldType: {
+ Password: 'password',
+ Text: 'text',
+ },
+}));
+
+describe('GenericApiKeyConfig base_url placeholder', () => {
+ const placeholder = GenericApiKeyConfig.fields.find(
+ (field) => field.name === 'base_url',
+ )?.placeholder as (factory?: string) => string;
+
+ it.each([
+ [LLMFactory.Anthropic, 'anthropicBaseUrlPlaceholder'],
+ [LLMFactory.MiniMax, 'minimaxBaseUrlPlaceholder'],
+ [LLMFactory.OpenAI, 'openaiBaseUrlPlaceholder'],
+ ])('uses the %s placeholder', (factory, expected) => {
+ expect(placeholder(factory)).toBe(expected);
+ });
+});
diff --git a/web/src/pages/user-setting/setting-model/provider-schema/field-config/generic-api-key-config.ts b/web/src/pages/user-setting/setting-model/provider-schema/field-config/generic-api-key-config.ts
index 936c788653..ae5599b341 100644
--- a/web/src/pages/user-setting/setting-model/provider-schema/field-config/generic-api-key-config.ts
+++ b/web/src/pages/user-setting/setting-model/provider-schema/field-config/generic-api-key-config.ts
@@ -61,7 +61,7 @@ export const GenericApiKeyConfig: ProviderConfig = {
return 'tongyiBaseUrlPlaceholder';
if (factory === LLMFactory.SILICONFLOW)
return 'siliconflowBaseUrlPlaceholder';
- if (factory?.toLowerCase() === 'Anthropic')
+ if (factory === LLMFactory.Anthropic)
return 'anthropicBaseUrlPlaceholder';
return 'openaiBaseUrlPlaceholder';
},