From 0761e65086cf42aa389e13e0264c78fdea52b18e Mon Sep 17 00:00:00 2001 From: Dustin Healy <54083382+dustinhealy@users.noreply.github.com> Date: Fri, 18 Jul 2025 19:27:56 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20fix:=20Enhance=20Responses=20API?= =?UTF-8?q?=20Auto-Enable=20Logic=20for=20Compatible=20Endpoints=20(#8506)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Updated the logic to auto-enable the Responses API when web search is enabled, specifically for OpenAI, Azure, and Custom endpoints. - Added import for EModelEndpoint to facilitate endpoint compatibility checks. --- .../hooks/Conversations/useSetIndexOptions.ts | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/client/src/hooks/Conversations/useSetIndexOptions.ts b/client/src/hooks/Conversations/useSetIndexOptions.ts index 59bcad5572..5b326777ac 100644 --- a/client/src/hooks/Conversations/useSetIndexOptions.ts +++ b/client/src/hooks/Conversations/useSetIndexOptions.ts @@ -1,5 +1,11 @@ import { useRecoilValue, useSetRecoilState } from 'recoil'; -import { TPreset, TPlugin, TConversation, tConvoUpdateSchema } from 'librechat-data-provider'; +import { + TPreset, + TPlugin, + TConversation, + tConvoUpdateSchema, + EModelEndpoint, +} from 'librechat-data-provider'; import type { TSetExample, TSetOption, TSetOptionsPayload } from '~/common'; import usePresetIndexOptions from './usePresetIndexOptions'; import { useChatContext } from '~/Providers/ChatContext'; @@ -30,11 +36,19 @@ const useSetIndexOptions: TUseSetOptions = (preset = false) => { }; } - // Auto-enable Responses API when web search is enabled + // Auto-enable Responses API when web search is enabled (only for OpenAI/Azure/Custom endpoints) if (param === 'web_search' && newValue === true) { - const currentUseResponsesApi = conversation?.useResponsesApi ?? false; - if (!currentUseResponsesApi) { - update['useResponsesApi'] = true; + const currentEndpoint = conversation?.endpoint; + const isOpenAICompatible = + currentEndpoint === EModelEndpoint.openAI || + currentEndpoint === EModelEndpoint.azureOpenAI || + currentEndpoint === EModelEndpoint.custom; + + if (isOpenAICompatible) { + const currentUseResponsesApi = conversation?.useResponsesApi ?? false; + if (!currentUseResponsesApi) { + update['useResponsesApi'] = true; + } } }