From 7fd83e0bf8580d44c25f89bea22b6d7badbe8b55 Mon Sep 17 00:00:00 2001 From: Vanalite Date: Fri, 3 Oct 2025 21:55:28 +0700 Subject: [PATCH] feat: add migration for cohere provider --- web-app/src/hooks/useModelProvider.ts | 28 +++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/web-app/src/hooks/useModelProvider.ts b/web-app/src/hooks/useModelProvider.ts index 8e74be32a..926cbdd0d 100644 --- a/web-app/src/hooks/useModelProvider.ts +++ b/web-app/src/hooks/useModelProvider.ts @@ -362,6 +362,34 @@ export const useModelProvider = create()( ] } } + + if (provider.provider === 'cohere') { + if (provider.base_url === 'https://api.cohere.ai/compatibility/v1') { + provider.base_url = 'https://api.cohere.ai/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.cohere.ai/compatibility/v1' + ) { + baseUrlSetting.controller_props.value = + 'https://api.cohere.ai/v1' + } + if ( + baseUrlSetting?.controller_props?.placeholder === + 'https://api.cohere.ai/compatibility/v1' + ) { + baseUrlSetting.controller_props.placeholder = + 'https://api.cohere.ai/v1' + } + } + } + }) }