diff --git a/.env.example b/.env.example index 985b7a52d..88c5e462a 100644 --- a/.env.example +++ b/.env.example @@ -53,7 +53,7 @@ DEBUG_CONSOLE=false # Endpoints # #===================================================# -# ENDPOINTS=openAI,assistants,azureOpenAI,bingAI,google,gptPlugins,anthropic +# ENDPOINTS=openAI,assistants,azureOpenAI,google,gptPlugins,anthropic PROXY= @@ -105,13 +105,6 @@ ANTHROPIC_API_KEY=user_provided # AZURE_OPENAI_API_EMBEDDINGS_DEPLOYMENT_NAME= # Deprecated # PLUGINS_USE_AZURE="true" # Deprecated -#============# -# BingAI # -#============# - -BINGAI_TOKEN=user_provided -# BINGAI_HOST=https://cn.bing.com - #=================# # AWS Bedrock # #=================# diff --git a/api/lib/utils/misc.js b/api/lib/utils/misc.js index 1abcff9da..f7b0e66cb 100644 --- a/api/lib/utils/misc.js +++ b/api/lib/utils/misc.js @@ -3,15 +3,6 @@ const cleanUpPrimaryKeyValue = (value) => { return value.replace(/--/g, '|'); }; -function replaceSup(text) { - if (!text.includes('')) { - return text; - } - const replacedText = text.replace(//g, '^').replace(/\s+<\/sup>/g, '^'); - return replacedText; -} - module.exports = { cleanUpPrimaryKeyValue, - replaceSup, }; diff --git a/api/models/schema/convoSchema.js b/api/models/schema/convoSchema.js index 85232ed6a..b910db7d2 100644 --- a/api/models/schema/convoSchema.js +++ b/api/models/schema/convoSchema.js @@ -29,22 +29,6 @@ const convoSchema = mongoose.Schema( agent_id: { type: String, }, - // for bingAI only - bingConversationId: { - type: String, - }, - jailbreakConversationId: { - type: String, - }, - conversationSignature: { - type: String, - }, - clientId: { - type: String, - }, - invocationId: { - type: Number, - }, tags: { type: [String], default: [], diff --git a/api/models/schema/defaults.js b/api/models/schema/defaults.js index 789848235..fb84ab99e 100644 --- a/api/models/schema/defaults.js +++ b/api/models/schema/defaults.js @@ -1,5 +1,5 @@ const conversationPreset = { - // endpoint: [azureOpenAI, openAI, bingAI, anthropic, chatGPTBrowser] + // endpoint: [azureOpenAI, openAI, anthropic, chatGPTBrowser] endpoint: { type: String, default: null, @@ -61,19 +61,6 @@ const conversationPreset = { type: Number, required: false, }, - // for bingai only - jailbreak: { - type: Boolean, - }, - context: { - type: String, - }, - systemMessage: { - type: String, - }, - toneStyle: { - type: String, - }, file_ids: { type: [{ type: String }], default: undefined }, // deprecated resendImages: { diff --git a/api/server/routes/ask/addToCache.js b/api/server/routes/ask/addToCache.js index 4ecdea0e0..6e21edd2b 100644 --- a/api/server/routes/ask/addToCache.js +++ b/api/server/routes/ask/addToCache.js @@ -35,8 +35,6 @@ const addToCache = async ({ endpoint, endpointOption, userMessage, responseMessa const roles = (options) => { if (endpoint === 'openAI') { return options?.chatGptLabel || 'ChatGPT'; - } else if (endpoint === 'bingAI') { - return options?.jailbreak ? 'Sydney' : 'BingAI'; } }; diff --git a/api/server/services/Config/EndpointService.js b/api/server/services/Config/EndpointService.js index dc055e287..1f38b70a6 100644 --- a/api/server/services/Config/EndpointService.js +++ b/api/server/services/Config/EndpointService.js @@ -8,7 +8,6 @@ const { AZURE_API_KEY: azureOpenAIApiKey, ANTHROPIC_API_KEY: anthropicApiKey, CHATGPT_TOKEN: chatGPTToken, - BINGAI_TOKEN: bingToken, PLUGINS_USE_AZURE, GOOGLE_KEY: googleKey, OPENAI_REVERSE_PROXY, @@ -30,7 +29,6 @@ module.exports = { useAzurePlugins, userProvidedOpenAI, googleKey, - [EModelEndpoint.bingAI]: generateConfig(bingToken), [EModelEndpoint.anthropic]: generateConfig(anthropicApiKey), [EModelEndpoint.chatGPTBrowser]: generateConfig(chatGPTToken), [EModelEndpoint.openAI]: generateConfig(openAIApiKey, OPENAI_REVERSE_PROXY), diff --git a/api/server/services/Config/loadDefaultEConfig.js b/api/server/services/Config/loadDefaultEConfig.js index c11ddbe9d..a9602bac2 100644 --- a/api/server/services/Config/loadDefaultEConfig.js +++ b/api/server/services/Config/loadDefaultEConfig.js @@ -9,7 +9,7 @@ const { config } = require('./EndpointService'); */ async function loadDefaultEndpointsConfig(req) { const { google, gptPlugins } = await loadAsyncEndpoints(req); - const { assistants, azureAssistants, bingAI, azureOpenAI, chatGPTBrowser } = config; + const { assistants, azureAssistants, azureOpenAI, chatGPTBrowser } = config; const enabledEndpoints = getEnabledEndpoints(); @@ -20,7 +20,6 @@ async function loadDefaultEndpointsConfig(req) { [EModelEndpoint.azureAssistants]: azureAssistants, [EModelEndpoint.azureOpenAI]: azureOpenAI, [EModelEndpoint.google]: google, - [EModelEndpoint.bingAI]: bingAI, [EModelEndpoint.chatGPTBrowser]: chatGPTBrowser, [EModelEndpoint.gptPlugins]: gptPlugins, [EModelEndpoint.anthropic]: config[EModelEndpoint.anthropic], diff --git a/api/server/services/Config/loadDefaultModels.js b/api/server/services/Config/loadDefaultModels.js index 464e84d44..82db35684 100644 --- a/api/server/services/Config/loadDefaultModels.js +++ b/api/server/services/Config/loadDefaultModels.js @@ -35,7 +35,6 @@ async function loadDefaultModels(req) { [EModelEndpoint.anthropic]: anthropic, [EModelEndpoint.gptPlugins]: gptPlugins, [EModelEndpoint.azureOpenAI]: azureOpenAI, - [EModelEndpoint.bingAI]: ['BingAI', 'Sydney'], [EModelEndpoint.chatGPTBrowser]: chatGPTBrowser, [EModelEndpoint.assistants]: assistants, [EModelEndpoint.azureAssistants]: azureAssistants, diff --git a/api/server/utils/citations.js b/api/server/utils/citations.js deleted file mode 100644 index 97cb69aca..000000000 --- a/api/server/utils/citations.js +++ /dev/null @@ -1,58 +0,0 @@ -const citationRegex = /\[\^\d+?\^\]/g; -const regex = / \[.*?]\(.*?\)/g; - -/** Helper function to escape special characters in regex - * @param {string} string - The string to escape. - * @returns {string} The escaped string. - */ -function escapeRegExp(string) { - return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); -} - -const getCitations = (res) => { - const adaptiveCards = res.details.adaptiveCards; - const textBlocks = adaptiveCards && adaptiveCards[0].body; - if (!textBlocks) { - return ''; - } - let links = textBlocks[textBlocks.length - 1]?.text.match(regex); - if (links?.length === 0 || !links) { - return ''; - } - links = links.map((link) => link.trim()); - return links.join('\n - '); -}; - -const citeText = (res, noLinks = false) => { - let result = res.text || res; - const citations = Array.from(new Set(result.match(citationRegex))); - if (citations?.length === 0) { - return result; - } - - if (noLinks) { - citations.forEach((citation) => { - const digit = citation.match(/\d+?/g)[0]; - // result = result.replaceAll(citation, `[${digit}](#) `); - result = result.replaceAll(citation, `[^${digit}^](#)`); - }); - - return result; - } - - let sources = res.details.sourceAttributions; - if (sources?.length === 0) { - return result; - } - sources = sources.map((source) => source.seeMoreUrl); - - citations.forEach((citation) => { - const digit = citation.match(/\d+?/g)[0]; - result = result.replaceAll(citation, `[^${digit}^](${sources[digit - 1]})`); - // result = result.replaceAll(citation, `[${digit}](${sources[digit - 1]}) `); - }); - - return result; -}; - -module.exports = { getCitations, citeText, escapeRegExp }; diff --git a/api/server/utils/handleText.js b/api/server/utils/handleText.js index 9567944d1..e46584c80 100644 --- a/api/server/utils/handleText.js +++ b/api/server/utils/handleText.js @@ -10,10 +10,16 @@ const { defaultAssistantsVersion, } = require('librechat-data-provider'); const { Providers } = require('@librechat/agents'); -const { getCitations, citeText } = require('./citations'); const partialRight = require('lodash/partialRight'); const { sendMessage } = require('./streamResponse'); -const citationRegex = /\[\^\d+?\^]/g; + +/** Helper function to escape special characters in regex + * @param {string} string - The string to escape. + * @returns {string} The escaped string. + */ +function escapeRegExp(string) { + return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); +} const addSpaceIfNeeded = (text) => (text.length > 0 && !text.endsWith(' ') ? text + ' ' : text); @@ -64,18 +70,9 @@ const createOnProgress = ( return { onProgress, getPartialText, sendIntermediateMessage }; }; -const handleText = async (response, bing = false) => { +const handleText = async (response) => { let { text } = response; response.text = text; - - if (bing) { - const links = getCitations(response); - if (response.text.match(citationRegex)?.length > 0) { - text = citeText(response); - } - text += links?.length > 0 ? `\n- ${links}` : ''; - } - return text; }; @@ -262,6 +259,7 @@ module.exports = { isEnabled, handleText, formatSteps, + escapeRegExp, formatAction, isUserProvided, generateConfig, diff --git a/api/server/utils/index.js b/api/server/utils/index.js index 315a14854..b79b42f00 100644 --- a/api/server/utils/index.js +++ b/api/server/utils/index.js @@ -2,7 +2,6 @@ const streamResponse = require('./streamResponse'); const removePorts = require('./removePorts'); const countTokens = require('./countTokens'); const handleText = require('./handleText'); -const citations = require('./citations'); const sendEmail = require('./sendEmail'); const cryptoUtils = require('./crypto'); const queue = require('./queue'); @@ -27,7 +26,6 @@ module.exports = { checkEmailConfig, ...cryptoUtils, ...handleText, - ...citations, countTokens, removePorts, sendEmail, diff --git a/api/typedefs.js b/api/typedefs.js index b1960f4cb..c88e57719 100644 --- a/api/typedefs.js +++ b/api/typedefs.js @@ -1321,8 +1321,7 @@ * @property {boolean|{userProvide: boolean}} [azureOpenAI] - Flag to indicate if Azure OpenAI endpoint is user provided, or its configuration. * @property {boolean|{userProvide: boolean}} [chatGPTBrowser] - Flag to indicate if ChatGPT Browser endpoint is user provided, or its configuration. * @property {boolean|{userProvide: boolean}} [anthropic] - Flag to indicate if Anthropic endpoint is user provided, or its configuration. - * @property {boolean|{userProvide: boolean}} [bingAI] - Flag to indicate if BingAI endpoint is user provided, or its configuration. - * @property {boolean|{userProvide: boolean}} [google] - Flag to indicate if BingAI endpoint is user provided, or its configuration. + * @property {boolean|{userProvide: boolean}} [google] - Flag to indicate if Google endpoint is user provided, or its configuration. * @property {boolean|{userProvide: boolean, userProvideURL: boolean, name: string}} [custom] - Custom Endpoint configuration. * @memberof typedefs */ @@ -1353,7 +1352,6 @@ * @property {boolean|{userProvide: boolean}} [azureOpenAI] - Flag to indicate if Azure OpenAI endpoint is user provided, or its configuration. * @property {boolean|{userProvide: boolean}} [chatGPTBrowser] - Flag to indicate if ChatGPT Browser endpoint is user provided, or its configuration. * @property {boolean|{userProvide: boolean}} [anthropic] - Flag to indicate if Anthropic endpoint is user provided, or its configuration. - * @property {boolean|{userProvide: boolean}} [bingAI] - Flag to indicate if BingAI endpoint is user provided, or its configuration. * @property {boolean|{userProvide: boolean}} [google] - Flag to indicate if Google endpoint is user provided, or its configuration. * @property {boolean|{userProvide: boolean, userProvideURL: boolean, name: string}} [custom] - Custom Endpoint configuration. * @property {boolean|GptPlugins} [gptPlugins] - Configuration for GPT plugins. diff --git a/charts/librechat/values.yaml b/charts/librechat/values.yaml index c21f84586..b9859c80f 100644 --- a/charts/librechat/values.yaml +++ b/charts/librechat/values.yaml @@ -108,5 +108,5 @@ config: DEBUG_PLUGINS: "true" DOMAIN_CLIENT: "" DOMAIN_SERVER: "" - ENDPOINTS: "openAI,azureOpenAI,bingAI,chatGPTBrowser,google,gptPlugins,anthropic" + ENDPOINTS: "openAI,azureOpenAI,chatGPTBrowser,google,gptPlugins,anthropic" SEARCH: false diff --git a/client/src/components/Chat/Input/HeaderOptions.tsx b/client/src/components/Chat/Input/HeaderOptions.tsx index 69a9e8f28..f8095a4c8 100644 --- a/client/src/components/Chat/Input/HeaderOptions.tsx +++ b/client/src/components/Chat/Input/HeaderOptions.tsx @@ -27,25 +27,15 @@ export default function HeaderOptions({ ); const localize = useLocalize(); - const { showPopover, conversation, latestMessage, setShowPopover, setShowBingToneSetting } = - useChatContext(); + const { showPopover, conversation, setShowPopover } = useChatContext(); const { setOption } = useSetIndexOptions(); - const { endpoint, conversationId, jailbreak = false } = conversation ?? {}; - - const altConditions: { [key: string]: boolean } = { - bingAI: !!(latestMessage && jailbreak && endpoint === 'bingAI'), - }; - - const altSettings: { [key: string]: () => void } = { - bingAI: () => setShowBingToneSetting((prev) => !prev), - }; + const { endpoint, conversationId } = conversation ?? {}; const noSettings = useMemo<{ [key: string]: boolean }>( () => ({ [EModelEndpoint.chatGPTBrowser]: true, - [EModelEndpoint.bingAI]: jailbreak ? false : conversationId !== 'new', }), - [jailbreak, conversationId], + [conversationId], ); useEffect(() => { @@ -63,9 +53,7 @@ export default function HeaderOptions({ return null; } - const triggerAdvancedMode = altConditions[endpoint] - ? altSettings[endpoint] - : () => setShowPopover((prev) => !prev); + const triggerAdvancedMode = () => setShowPopover((prev) => !prev); const endpointType = getEndpointField(endpointsConfig, endpoint, 'type'); const paramEndpoint = isParamEndpoint(endpoint, endpointType); diff --git a/client/src/components/Chat/Menus/Endpoints/Icons.tsx b/client/src/components/Chat/Menus/Endpoints/Icons.tsx index 3fbae8e01..f69ee71c2 100644 --- a/client/src/components/Chat/Menus/Endpoints/Icons.tsx +++ b/client/src/components/Chat/Menus/Endpoints/Icons.tsx @@ -6,7 +6,6 @@ import { GPTIcon, AnthropicIcon, AzureMinimalIcon, - BingAIMinimalIcon, GoogleMinimalIcon, CustomMinimalIcon, AssistantIcon, @@ -68,7 +67,6 @@ export const icons: IconsRecord = { [EModelEndpoint.anthropic]: AnthropicIcon, [EModelEndpoint.chatGPTBrowser]: LightningIcon, [EModelEndpoint.google]: GoogleMinimalIcon, - [EModelEndpoint.bingAI]: BingAIMinimalIcon, [EModelEndpoint.custom]: CustomMinimalIcon, [EModelEndpoint.assistants]: AssistantAvatar, [EModelEndpoint.azureAssistants]: AssistantAvatar, diff --git a/client/src/components/Endpoints/MessageEndpointIcon.tsx b/client/src/components/Endpoints/MessageEndpointIcon.tsx index a4d448857..a5155a356 100644 --- a/client/src/components/Endpoints/MessageEndpointIcon.tsx +++ b/client/src/components/Endpoints/MessageEndpointIcon.tsx @@ -63,7 +63,6 @@ const MessageEndpointIcon: React.FC = (props) => { button, iconURL = '', endpoint, - jailbreak, size = 30, model = '', assistantName, @@ -163,23 +162,6 @@ const MessageEndpointIcon: React.FC = (props) => { bg: '#268672', name: alternateName[EModelEndpoint.bedrock], }, - [EModelEndpoint.bingAI]: { - icon: - jailbreak === true ? ( - Bing Icon - ) : ( - Sydney Icon - ), - name: jailbreak === true ? 'Sydney' : 'BingAI', - }, - [EModelEndpoint.chatGPTBrowser]: { - icon: , - bg: - typeof model === 'string' && model.toLowerCase().includes('gpt-4') - ? '#AB68FF' - : `rgba(0, 163, 255, ${button === true ? 0.75 : 1})`, - name: 'ChatGPT', - }, [EModelEndpoint.custom]: { icon: , name: 'Custom', diff --git a/client/src/components/Endpoints/MinimalIcon.tsx b/client/src/components/Endpoints/MinimalIcon.tsx index 0287fb90b..f5a5778a7 100644 --- a/client/src/components/Endpoints/MinimalIcon.tsx +++ b/client/src/components/Endpoints/MinimalIcon.tsx @@ -5,7 +5,6 @@ import { OpenAIMinimalIcon, LightningIcon, MinimalPlugin, - BingAIMinimalIcon, GoogleMinimalIcon, CustomMinimalIcon, AnthropicIcon, @@ -44,7 +43,6 @@ const MinimalIcon: React.FC = (props) => { icon: , name: 'Custom', }, - [EModelEndpoint.bingAI]: { icon: , name: 'BingAI' }, [EModelEndpoint.chatGPTBrowser]: { icon: , name: 'ChatGPT' }, [EModelEndpoint.assistants]: { icon: , name: 'Assistant' }, [EModelEndpoint.azureAssistants]: { icon: , name: 'Assistant' }, diff --git a/client/src/components/Endpoints/Settings/BingAI.tsx b/client/src/components/Endpoints/Settings/BingAI.tsx deleted file mode 100644 index bfd516473..000000000 --- a/client/src/components/Endpoints/Settings/BingAI.tsx +++ /dev/null @@ -1,147 +0,0 @@ -import { useEffect, useState } from 'react'; -import TextareaAutosize from 'react-textarea-autosize'; -import { useUpdateTokenCountMutation } from 'librechat-data-provider/react-query'; -import type { TUpdateTokenCountResponse } from 'librechat-data-provider'; -import { Label, Checkbox, SelectDropDown } from '~/components/ui'; -import { cn, defaultTextProps, removeFocusRings } from '~/utils'; -import { useLocalize, useDebounce } from '~/hooks'; -import type { TSettingsProps } from '~/common'; - -export default function Settings({ conversation, setOption, readonly }: TSettingsProps) { - const localize = useLocalize(); - const [tokenCount, setTokenCount] = useState(0); - const debouncedContext = useDebounce(conversation?.context?.trim() ?? '', 250); - const updateTokenCountMutation = useUpdateTokenCountMutation(); - - useEffect(() => { - if (!debouncedContext || debouncedContext === '') { - setTokenCount(0); - return; - } - - const handleTextChange = (context: string) => { - updateTokenCountMutation.mutate( - { text: context }, - { - onSuccess: (data: TUpdateTokenCountResponse) => { - setTokenCount(data.count); - }, - }, - ); - }; - - handleTextChange(debouncedContext); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [debouncedContext]); - - if (!conversation) { - return null; - } - const { context, systemMessage, jailbreak, toneStyle } = conversation; - const showSystemMessage = jailbreak; - - const setContext = setOption('context'); - const setSystemMessage = setOption('systemMessage'); - const setJailbreak = setOption('jailbreak'); - const setToneStyle = (value: string) => setOption('toneStyle')(value.toLowerCase()); - - return ( -
-
-
- - -
-
- - setContext(e.target.value ?? null)} - placeholder={localize('com_endpoint_bing_context_placeholder')} - className={cn( - defaultTextProps, - 'flex max-h-[138px] min-h-[100px] w-full resize-none px-3 py-2', - )} - /> - {`${localize( - 'com_endpoint_token_count', - )}: ${tokenCount}`} -
-
-
-
- -
- - -
-
- {showSystemMessage && ( -
- - - setSystemMessage(e.target.value ?? null)} - placeholder={localize('com_endpoint_bing_system_message_placeholder')} - className={cn( - defaultTextProps, - 'flex max-h-[300px] min-h-[100px] w-full resize-none px-3 py-2 placeholder:text-red-400', - )} - /> -
- )} -
-
- ); -} diff --git a/client/src/components/Endpoints/Settings/index.ts b/client/src/components/Endpoints/Settings/index.ts index 92af1a60b..fd4b1e795 100644 --- a/client/src/components/Endpoints/Settings/index.ts +++ b/client/src/components/Endpoints/Settings/index.ts @@ -2,7 +2,6 @@ export { default as Advanced } from './Advanced'; export { default as AssistantsSettings } from './Assistants'; export { default as BedrockSettings } from './Bedrock'; export { default as OpenAISettings } from './OpenAI'; -export { default as BingAISettings } from './BingAI'; export { default as GoogleSettings } from './Google'; export { default as PluginsSettings } from './Plugins'; export { default as Examples } from './Examples'; diff --git a/client/src/components/Endpoints/Settings/settings.ts b/client/src/components/Endpoints/Settings/settings.ts index dfc2ab162..1dad4301e 100644 --- a/client/src/components/Endpoints/Settings/settings.ts +++ b/client/src/components/Endpoints/Settings/settings.ts @@ -5,7 +5,6 @@ import { GoogleSettings, PluginSettings } from './MultiView'; import AssistantsSettings from './Assistants'; import AnthropicSettings from './Anthropic'; import BedrockSettings from './Bedrock'; -import BingAISettings from './BingAI'; import OpenAISettings from './OpenAI'; const settings: { [key: string]: FC | undefined } = { @@ -15,7 +14,6 @@ const settings: { [key: string]: FC | undefined } = { [EModelEndpoint.openAI]: OpenAISettings, [EModelEndpoint.custom]: OpenAISettings, [EModelEndpoint.azureOpenAI]: OpenAISettings, - [EModelEndpoint.bingAI]: BingAISettings, [EModelEndpoint.anthropic]: AnthropicSettings, [EModelEndpoint.bedrock]: BedrockSettings, }; diff --git a/client/src/components/Input/ModelSelect/BingAI.tsx b/client/src/components/Input/ModelSelect/BingAI.tsx deleted file mode 100644 index ecf298bae..000000000 --- a/client/src/components/Input/ModelSelect/BingAI.tsx +++ /dev/null @@ -1,86 +0,0 @@ -import { useRecoilValue } from 'recoil'; -import { SelectDropDown, SelectDropDownPop, Tabs, TabsList, TabsTrigger } from '~/components/ui'; -import { cn, cardStyle } from '~/utils/'; -import type { TModelSelectProps } from '~/common'; -import store from '~/store'; - -export default function BingAI({ - conversation, - setOption, - models, - showAbove, - popover = false, -}: TModelSelectProps) { - // TODO: index family bing tone settings, important for multiview - const showBingToneSetting = useRecoilValue(store.showBingToneSetting); - if (!conversation) { - return null; - } - const { conversationId, toneStyle, jailbreak } = conversation; - if (conversationId !== 'new' && !showBingToneSetting) { - return null; - } - - const defaultClasses = - 'p-2 rounded-md min-w-[75px] font-normal bg-white/[.60] dark:bg-gray-700 text-black text-xs'; - const defaultSelected = cn( - defaultClasses, - 'font-medium data-[state=active]:text-white text-xs text-white', - ); - const selectedClass = (val: string) => val + '-tab ' + defaultSelected; - const Menu = popover ? SelectDropDownPop : SelectDropDown; - - return ( - <> - setOption('jailbreak')(value === 'Sydney')} - availableValues={models} - showAbove={showAbove} - showLabel={false} - className={cn( - cardStyle, - 'z-50 flex h-[40px] w-36 flex-none items-center justify-center px-4 ring-0 hover:cursor-pointer hover:bg-gray-50 focus:ring-0 focus:ring-offset-0 data-[state=open]:bg-gray-50 dark:bg-gray-800 dark:hover:bg-gray-700 dark:data-[state=open]:bg-gray-600', - showBingToneSetting ? 'hidden' : '', - )} - /> - setOption('toneStyle')(value.toLowerCase())} - > - - - {'Creative'} - - - {'Fast'} - - - {'Balanced'} - - - {'Precise'} - - - - - ); -} diff --git a/client/src/components/Input/ModelSelect/options.ts b/client/src/components/Input/ModelSelect/options.ts index 24c820485..b93e2e7e2 100644 --- a/client/src/components/Input/ModelSelect/options.ts +++ b/client/src/components/Input/ModelSelect/options.ts @@ -3,7 +3,6 @@ import type { TModelSelectProps } from '~/common'; import type { FC } from 'react'; import OpenAI from './OpenAI'; -import BingAI from './BingAI'; import Google from './Google'; import ChatGPT from './ChatGPT'; import Anthropic from './Anthropic'; @@ -14,7 +13,6 @@ export const options: { [key: string]: FC } = { [EModelEndpoint.custom]: OpenAI, [EModelEndpoint.bedrock]: OpenAI, [EModelEndpoint.azureOpenAI]: OpenAI, - [EModelEndpoint.bingAI]: BingAI, [EModelEndpoint.google]: Google, [EModelEndpoint.anthropic]: Anthropic, [EModelEndpoint.chatGPTBrowser]: ChatGPT, diff --git a/client/src/components/Input/SetKeyDialog/HelpText.tsx b/client/src/components/Input/SetKeyDialog/HelpText.tsx index 3b49b4b74..59cb0a46f 100644 --- a/client/src/components/Input/SetKeyDialog/HelpText.tsx +++ b/client/src/components/Input/SetKeyDialog/HelpText.tsx @@ -5,30 +5,6 @@ import { useLocalize } from '~/hooks'; function HelpText({ endpoint }: { endpoint: string }) { const localize = useLocalize(); const textMap = { - [EModelEndpoint.bingAI]: ( - - {localize('com_endpoint_config_key_get_edge_key')}{' '} - - https://www.bing.com - - {'. '} - {localize('com_endpoint_config_key_get_edge_key_dev_tool')}{' '} - - {localize('com_endpoint_config_key_edge_instructions')} - {' '} - {localize('com_endpoint_config_key_edge_full_token_string')} - - ), [EModelEndpoint.chatGPTBrowser]: ( {localize('com_endpoint_config_key_chatgpt')}{' '} diff --git a/client/src/components/Nav/SearchBar.tsx b/client/src/components/Nav/SearchBar.tsx index 0142f9a12..10ebca3ff 100644 --- a/client/src/components/Nav/SearchBar.tsx +++ b/client/src/components/Nav/SearchBar.tsx @@ -31,7 +31,7 @@ const SearchBar = forwardRef((props: SearchBarProps, ref: Ref) = const clearSearch = useCallback(() => { setPageNumber(1); if (location.pathname.includes('/search')) { - newConversation(); + newConversation({ disableFocus: true }); } }, [newConversation, setPageNumber, location.pathname]); diff --git a/client/src/components/SidePanel/Agents/AgentPanel.tsx b/client/src/components/SidePanel/Agents/AgentPanel.tsx index 70ae82eb4..0f49dc30e 100644 --- a/client/src/components/SidePanel/Agents/AgentPanel.tsx +++ b/client/src/components/SidePanel/Agents/AgentPanel.tsx @@ -61,8 +61,7 @@ export default function AgentPanel({ !isAssistantsEndpoint(key) && key !== EModelEndpoint.agents && key !== EModelEndpoint.chatGPTBrowser && - key !== EModelEndpoint.gptPlugins && - key !== EModelEndpoint.bingAI, + key !== EModelEndpoint.gptPlugins, ) .map((provider) => createProviderOption(provider)), [endpointsConfig], diff --git a/client/src/components/svg/BingAIMinimalIcon.tsx b/client/src/components/svg/BingAIMinimalIcon.tsx deleted file mode 100644 index 92c03e90b..000000000 --- a/client/src/components/svg/BingAIMinimalIcon.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { cn } from '~/utils'; -export default function BingAIMinimalIcon({ className = '' }) { - return ( - - - - - - ); -} diff --git a/client/src/components/svg/BingChatIcon.tsx b/client/src/components/svg/BingChatIcon.tsx deleted file mode 100644 index 5aaf97b9a..000000000 --- a/client/src/components/svg/BingChatIcon.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import React from 'react'; - -export default function BingChatIcon() { - return ( - - - - ); -} diff --git a/client/src/components/svg/BingIcon.tsx b/client/src/components/svg/BingIcon.tsx deleted file mode 100644 index 4f493bd54..000000000 --- a/client/src/components/svg/BingIcon.tsx +++ /dev/null @@ -1,282 +0,0 @@ -import React from 'react'; - -export default function BingIcon() { - return ( - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ); -} diff --git a/client/src/components/svg/BingIconBackup.tsx b/client/src/components/svg/BingIconBackup.tsx deleted file mode 100644 index 124c44ad7..000000000 --- a/client/src/components/svg/BingIconBackup.tsx +++ /dev/null @@ -1,135 +0,0 @@ -import React from 'react'; - -export default function BingIcon({ size = 25 }) { - return ( - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ); -} diff --git a/client/src/components/svg/BingJbIcon.tsx b/client/src/components/svg/BingJbIcon.tsx deleted file mode 100644 index 09bb5734e..000000000 --- a/client/src/components/svg/BingJbIcon.tsx +++ /dev/null @@ -1,267 +0,0 @@ -import React from 'react'; - -export default function BingIcon() { - return ( - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ); -} diff --git a/client/src/components/svg/OGBingIcon.tsx b/client/src/components/svg/OGBingIcon.tsx deleted file mode 100644 index 896f5eec0..000000000 --- a/client/src/components/svg/OGBingIcon.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import React from 'react'; - -export default function OGBingIcon() { - return ( - - - - ); -} diff --git a/client/src/components/svg/index.ts b/client/src/components/svg/index.ts index d88a626a0..3a2929e64 100644 --- a/client/src/components/svg/index.ts +++ b/client/src/components/svg/index.ts @@ -33,7 +33,6 @@ export { default as MinimalPlugin } from './MinimalPlugin'; export { default as AzureMinimalIcon } from './AzureMinimalIcon'; export { default as OpenAIMinimalIcon } from './OpenAIMinimalIcon'; export { default as ChatGPTMinimalIcon } from './ChatGPTMinimalIcon'; -export { default as BingAIMinimalIcon } from './BingAIMinimalIcon'; export { default as PaLMinimalIcon } from './PaLMinimalIcon'; export { default as PaLMIcon } from './PaLMIcon'; export { default as CodeyIcon } from './CodeyIcon'; diff --git a/client/src/hooks/Chat/useChatHelpers.ts b/client/src/hooks/Chat/useChatHelpers.ts index 892a13219..a79b860c5 100644 --- a/client/src/hooks/Chat/useChatHelpers.ts +++ b/client/src/hooks/Chat/useChatHelpers.ts @@ -130,9 +130,6 @@ export default function useChatHelpers(index = 0, paramId?: string) { setSiblingIdx(0); }; - const [showBingToneSetting, setShowBingToneSetting] = useRecoilState( - store.showBingToneSettingFamily(index), - ); const [showPopover, setShowPopover] = useRecoilState(store.showPopoverFamily(index)); const [abortScroll, setAbortScroll] = useRecoilState(store.abortScrollFamily(index)); const [preset, setPreset] = useRecoilState(store.presetByIndex(index)); @@ -166,8 +163,6 @@ export default function useChatHelpers(index = 0, paramId?: string) { setShowPopover, abortScroll, setAbortScroll, - showBingToneSetting, - setShowBingToneSetting, preset, setPreset, optionSettings, diff --git a/client/src/hooks/Config/useClearStates.ts b/client/src/hooks/Config/useClearStates.ts index d832d08af..354b92e4e 100644 --- a/client/src/hooks/Config/useClearStates.ts +++ b/client/src/hooks/Config/useClearStates.ts @@ -29,7 +29,6 @@ export default function useClearStates() { reset(store.isSubmittingFamily(key)); reset(store.optionSettingsFamily(key)); reset(store.showAgentSettingsFamily(key)); - reset(store.showBingToneSettingFamily(key)); reset(store.showPopoverFamily(key)); reset(store.showMentionPopoverFamily(key)); reset(store.showPlusPopoverFamily(key)); diff --git a/client/src/hooks/Input/useTextarea.ts b/client/src/hooks/Input/useTextarea.ts index ab881d741..f9948b9db 100644 --- a/client/src/hooks/Input/useTextarea.ts +++ b/client/src/hooks/Input/useTextarea.ts @@ -1,7 +1,6 @@ import debounce from 'lodash/debounce'; import { useEffect, useRef, useCallback } from 'react'; import { useRecoilValue, useRecoilState } from 'recoil'; -import { Constants } from 'librechat-data-provider'; import type { TEndpointOption } from 'librechat-data-provider'; import type { KeyboardEvent } from 'react'; import { @@ -43,18 +42,11 @@ export default function useTextarea({ const checkHealth = useInteractionHealthCheck(); const enterToSend = useRecoilValue(store.enterToSend); - const { - index, - conversation, - isSubmitting, - filesLoading, - latestMessage, - setFilesLoading, - setShowBingToneSetting, - } = useChatContext(); + const { index, conversation, isSubmitting, filesLoading, latestMessage, setFilesLoading } = + useChatContext(); const [activePrompt, setActivePrompt] = useRecoilState(store.activePromptByIndex(index)); - const { conversationId, jailbreak = false, endpoint = '' } = conversation || {}; + const { endpoint = '' } = conversation || {}; const { entity, isAgent, isAssistant } = getEntity({ endpoint, agentsMap, @@ -78,33 +70,6 @@ export default function useTextarea({ } }, [activePrompt, setActivePrompt, textAreaRef]); - // auto focus to input, when enter a conversation. - useEffect(() => { - const convoId = conversationId ?? ''; - if (!convoId) { - return; - } - - // Prevents Settings from not showing on new conversation, also prevents showing toneStyle change without jailbreak - if (convoId === Constants.NEW_CONVO || !jailbreak) { - setShowBingToneSetting(false); - } - - if (convoId !== Constants.SEARCH) { - textAreaRef.current?.focus(); - } - // setShowBingToneSetting is a recoil setter, so it doesn't need to be in the dependency array - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [conversationId, jailbreak]); - - useEffect(() => { - const timeoutId = setTimeout(() => { - textAreaRef.current?.focus(); - }, 100); - - return () => clearTimeout(timeoutId); - }, [isSubmitting, textAreaRef]); - useEffect(() => { const currentValue = textAreaRef.current?.value ?? ''; if (currentValue) { diff --git a/client/src/hooks/useGenerationsByLatest.ts b/client/src/hooks/useGenerationsByLatest.ts index ceec50fe0..a70ffdd9c 100644 --- a/client/src/hooks/useGenerationsByLatest.ts +++ b/client/src/hooks/useGenerationsByLatest.ts @@ -53,7 +53,6 @@ export default function useGenerationsByLatest({ EModelEndpoint.bedrock, EModelEndpoint.chatGPTBrowser, EModelEndpoint.google, - EModelEndpoint.bingAI, EModelEndpoint.gptPlugins, EModelEndpoint.anthropic, ].find((e) => e === endpoint), diff --git a/client/src/hooks/useNewConvo.ts b/client/src/hooks/useNewConvo.ts index 2c02a84a6..de8b902fb 100644 --- a/client/src/hooks/useNewConvo.ts +++ b/client/src/hooks/useNewConvo.ts @@ -8,6 +8,7 @@ import { useNavigate } from 'react-router-dom'; import { Constants, FileSources, + EModelEndpoint, isParamEndpoint, LocalStorageKeys, isAssistantsEndpoint, @@ -70,6 +71,7 @@ const useNewConvo = (index = 0) => { buildDefault?: boolean, keepLatestMessage?: boolean, keepAddedConvos?: boolean, + disableFocus?: boolean, ) => { const modelsConfig = modelsData ?? modelsQuery.data; const { endpoint = null } = conversation; @@ -87,11 +89,15 @@ const useNewConvo = (index = 0) => { : preset; if (buildDefaultConversation) { - const defaultEndpoint = getDefaultEndpoint({ + let defaultEndpoint = getDefaultEndpoint({ convoSetup: activePreset ?? conversation, endpointsConfig, }); + if (!defaultEndpoint) { + defaultEndpoint = Object.keys(endpointsConfig ?? {})[0] as EModelEndpoint; + } + const endpointType = getEndpointField(endpointsConfig, defaultEndpoint, 'type'); if (!conversation.endpointType && endpointType) { conversation.endpointType = endpointType; @@ -161,6 +167,9 @@ const useNewConvo = (index = 0) => { } clearTimeout(timeoutIdRef.current); + if (disableFocus === true) { + return; + } timeoutIdRef.current = setTimeout(() => { const textarea = document.getElementById(mainTextareaId); if (textarea) { @@ -176,6 +185,7 @@ const useNewConvo = (index = 0) => { template: _template = {}, preset: _preset, modelsData, + disableFocus, buildDefault = true, keepLatestMessage = false, keepAddedConvos = false, @@ -184,6 +194,7 @@ const useNewConvo = (index = 0) => { preset?: Partial; modelsData?: TModelsConfig; buildDefault?: boolean; + disableFocus?: boolean; keepLatestMessage?: boolean; keepAddedConvos?: boolean; } = {}) { @@ -254,6 +265,7 @@ const useNewConvo = (index = 0) => { buildDefault, keepLatestMessage, keepAddedConvos, + disableFocus, ); }, [ diff --git a/client/src/store/endpoints.ts b/client/src/store/endpoints.ts index beda6f975..4d0199718 100644 --- a/client/src/store/endpoints.ts +++ b/client/src/store/endpoints.ts @@ -8,7 +8,6 @@ const defaultConfig: TEndpointsConfig = { [EModelEndpoint.assistants]: null, [EModelEndpoint.agents]: null, [EModelEndpoint.openAI]: null, - [EModelEndpoint.bingAI]: null, [EModelEndpoint.chatGPTBrowser]: null, [EModelEndpoint.gptPlugins]: null, [EModelEndpoint.google]: null, @@ -30,7 +29,7 @@ const plugins = selector({ key: 'plugins', get: ({ get }) => { const config = get(endpointsConfig) || {}; - return config?.gptPlugins?.plugins || {}; + return config.gptPlugins?.plugins || {}; }, }); diff --git a/client/src/store/families.ts b/client/src/store/families.ts index 47583ff65..786a415d4 100644 --- a/client/src/store/families.ts +++ b/client/src/store/families.ts @@ -184,11 +184,6 @@ const showAgentSettingsFamily = atomFamily({ default: false, }); -const showBingToneSettingFamily = atomFamily({ - key: 'showBingToneSettingByIndex', - default: false, -}); - const showPopoverFamily = atomFamily({ key: 'showPopoverByIndex', default: false, @@ -385,7 +380,6 @@ export default { isSubmittingFamily, optionSettingsFamily, showAgentSettingsFamily, - showBingToneSettingFamily, showPopoverFamily, latestMessageFamily, messagesSiblingIdxFamily, diff --git a/client/src/store/settings.ts b/client/src/store/settings.ts index 5e18c8984..7008d4026 100644 --- a/client/src/store/settings.ts +++ b/client/src/store/settings.ts @@ -14,7 +14,6 @@ const staticAtoms = { key: 'currentSettingsView', default: SettingsViews.default, }), - showBingToneSetting: atom({ key: 'showBingToneSetting', default: false }), showPopover: atom({ key: 'showPopover', default: false }), }; diff --git a/client/src/utils/convos.ts b/client/src/utils/convos.ts index 3f11bcbe7..e288d814e 100644 --- a/client/src/utils/convos.ts +++ b/client/src/utils/convos.ts @@ -256,18 +256,12 @@ export function storeEndpointSettings(conversation: TConversation | null) { if (!conversation) { return; } - const { endpoint, model, agentOptions, jailbreak, toneStyle } = conversation; + const { endpoint, model, agentOptions } = conversation; if (!endpoint) { return; } - if (endpoint === EModelEndpoint.bingAI) { - const settings = { jailbreak, toneStyle }; - localStorage.setItem(LocalStorageKeys.LAST_BING, JSON.stringify(settings)); - return; - } - const lastModel = JSON.parse(localStorage.getItem(LocalStorageKeys.LAST_MODEL) ?? '{}'); lastModel[endpoint] = model; diff --git a/client/src/utils/endpoints.spec.ts b/client/src/utils/endpoints.spec.ts index bd554828c..cab26324a 100644 --- a/client/src/utils/endpoints.spec.ts +++ b/client/src/utils/endpoints.spec.ts @@ -26,10 +26,6 @@ describe('getEndpointField', () => { expect(getEndpointField(mockEndpointsConfig, undefined, 'type')).toBeUndefined(); }); - it('returns undefined if the endpoint does not exist in endpointsConfig', () => { - expect(getEndpointField(mockEndpointsConfig, EModelEndpoint.bingAI, 'type')).toBeUndefined(); - }); - it('returns the correct value for a valid endpoint and property', () => { expect(getEndpointField(mockEndpointsConfig, EModelEndpoint.openAI, 'order')).toEqual(0); expect(getEndpointField(mockEndpointsConfig, EModelEndpoint.google, 'iconURL')).toEqual( diff --git a/client/src/utils/getDefaultEndpoint.ts b/client/src/utils/getDefaultEndpoint.ts index ef35f35d5..a9267b339 100644 --- a/client/src/utils/getDefaultEndpoint.ts +++ b/client/src/utils/getDefaultEndpoint.ts @@ -1,8 +1,8 @@ import type { - TConversation, TPreset, - TEndpointsConfig, + TConversation, EModelEndpoint, + TEndpointsConfig, } from 'librechat-data-provider'; import { getLocalStorageItems } from './localStorage'; import { mapEndpoints } from './endpoints'; @@ -14,11 +14,11 @@ type TDefaultEndpoint = { convoSetup: TConvoSetup; endpointsConfig: TEndpointsCo const getEndpointFromSetup = ( convoSetup: TConvoSetup | null, endpointsConfig: TEndpointsConfig, -) => { +): EModelEndpoint | null => { let { endpoint: targetEndpoint = '' } = convoSetup || {}; targetEndpoint = targetEndpoint ?? ''; if (targetEndpoint && endpointsConfig?.[targetEndpoint]) { - return targetEndpoint; + return targetEndpoint as EModelEndpoint; } else if (targetEndpoint) { console.warn(`Illegal target endpoint ${targetEndpoint} ${endpointsConfig}`); } @@ -54,9 +54,9 @@ const getDefinedEndpoint = (endpointsConfig: TEndpointsConfig) => { const getDefaultEndpoint = ({ convoSetup, endpointsConfig, -}: TDefaultEndpoint): EModelEndpoint | string | undefined => { +}: TDefaultEndpoint): EModelEndpoint | undefined => { return ( - (getEndpointFromSetup(convoSetup, endpointsConfig) ?? '') || + getEndpointFromSetup(convoSetup, endpointsConfig) || getEndpointFromLocalStorage(endpointsConfig) || getDefinedEndpoint(endpointsConfig) ); diff --git a/client/src/utils/index.ts b/client/src/utils/index.ts index 0d365d7be..ff13279ab 100644 --- a/client/src/utils/index.ts +++ b/client/src/utils/index.ts @@ -20,7 +20,6 @@ export { default as logger } from './logger'; export { default as buildTree } from './buildTree'; export { default as getLoginError } from './getLoginError'; export { default as cleanupPreset } from './cleanupPreset'; -export { default as validateIframe } from './validateIframe'; export { default as buildDefaultConvo } from './buildDefaultConvo'; export { default as getDefaultEndpoint } from './getDefaultEndpoint'; diff --git a/client/src/utils/presets.ts b/client/src/utils/presets.ts index 552977423..daa1327bf 100644 --- a/client/src/utils/presets.ts +++ b/client/src/utils/presets.ts @@ -12,11 +12,9 @@ export const getPresetTitle = (preset: TPreset, mention?: boolean) => { promptPrefix, chatGptLabel, modelLabel, - jailbreak, - toneStyle, } = preset; + const modelInfo = model ?? ''; let title = ''; - let modelInfo = model ?? ''; let label = ''; const usesChatGPTLabel: TEndpoints = [ @@ -30,11 +28,7 @@ export const getPresetTitle = (preset: TPreset, mention?: boolean) => { label = chatGptLabel ?? ''; } else if (endpoint != null && endpoint && usesModelLabel.includes(endpoint)) { label = modelLabel ?? ''; - } else if (endpoint === EModelEndpoint.bingAI) { - modelInfo = jailbreak === true ? 'Sydney' : modelInfo; - label = toneStyle != null && toneStyle ? `: ${toneStyle}` : ''; } - if ( label && presetTitle != null && diff --git a/client/src/utils/validateIframe.ts b/client/src/utils/validateIframe.ts deleted file mode 100644 index 412a8f027..000000000 --- a/client/src/utils/validateIframe.ts +++ /dev/null @@ -1,44 +0,0 @@ -export default function validateIframe(content: string): boolean { - const hasValidIframe = - content.includes('