diff --git a/web-app/src/hooks/useModelProvider.ts b/web-app/src/hooks/useModelProvider.ts index 484b08f97..8e74be32a 100644 --- a/web-app/src/hooks/useModelProvider.ts +++ b/web-app/src/hooks/useModelProvider.ts @@ -327,6 +327,28 @@ export const useModelProvider = create()( if (provider.base_url === 'https://api.anthropic.com') { provider.base_url = 'https://api.anthropic.com/v1' } + + // Update base-url in settings + if (provider.settings) { + const baseUrlSetting = provider.settings.find( + (s) => s.key === 'base-url' + ) + if ( + baseUrlSetting?.controller_props?.value === + 'https://api.anthropic.com' + ) { + baseUrlSetting.controller_props.value = + 'https://api.anthropic.com/v1' + } + if ( + baseUrlSetting?.controller_props?.placeholder === + 'https://api.anthropic.com' + ) { + baseUrlSetting.controller_props.placeholder = + 'https://api.anthropic.com/v1' + } + } + if (!provider.custom_header) { provider.custom_header = [ {