🧹 chore: Remove Deprecated BingAI Code & Address Mobile Focus (#5565)

* chore: remove all bing code

* chore: remove bing code and auto-focus effects

* chore: add back escapeRegExp helper function for regex special character handling

* chore: remove deprecated fields from settings and conversation schema

* fix: ensure default endpoint is set correctly in conversation setup

* feat: add disableFocus option to newConversation for improved search behavior
This commit is contained in:
Danny Avila 2025-01-30 17:22:29 -05:00 committed by GitHub
parent 1226f56d0c
commit 19fa4d9f54
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
52 changed files with 52 additions and 1384 deletions

View file

@ -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 (
<>
<Menu
title="Mode"
value={jailbreak ? 'Sydney' : 'BingAI'}
data-testid="bing-select-dropdown"
setValue={(value) => 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' : '',
)}
/>
<Tabs
value={toneStyle ?? 'creative'}
className={cn(
cardStyle,
'z-50 flex h-[40px] flex-none items-center justify-center px-0 hover:bg-gray-50 dark:hover:bg-gray-700',
)}
onValueChange={(value) => setOption('toneStyle')(value.toLowerCase())}
>
<TabsList className="bg-white/[.60] dark:bg-gray-700">
<TabsTrigger
value="creative"
className={`${toneStyle === 'creative' ? selectedClass('creative') : defaultClasses}`}
>
{'Creative'}
</TabsTrigger>
<TabsTrigger
value="fast"
className={`${toneStyle === 'fast' ? selectedClass('fast') : defaultClasses}`}
>
{'Fast'}
</TabsTrigger>
<TabsTrigger
value="balanced"
className={`${toneStyle === 'balanced' ? selectedClass('balanced') : defaultClasses}`}
>
{'Balanced'}
</TabsTrigger>
<TabsTrigger
value="precise"
className={`${toneStyle === 'precise' ? selectedClass('precise') : defaultClasses}`}
>
{'Precise'}
</TabsTrigger>
</TabsList>
</Tabs>
</>
);
}

View file

@ -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<TModelSelectProps> } = {
[EModelEndpoint.custom]: OpenAI,
[EModelEndpoint.bedrock]: OpenAI,
[EModelEndpoint.azureOpenAI]: OpenAI,
[EModelEndpoint.bingAI]: BingAI,
[EModelEndpoint.google]: Google,
[EModelEndpoint.anthropic]: Anthropic,
[EModelEndpoint.chatGPTBrowser]: ChatGPT,

View file

@ -5,30 +5,6 @@ import { useLocalize } from '~/hooks';
function HelpText({ endpoint }: { endpoint: string }) {
const localize = useLocalize();
const textMap = {
[EModelEndpoint.bingAI]: (
<small className="break-all text-gray-500">
{localize('com_endpoint_config_key_get_edge_key')}{' '}
<a
target="_blank"
href="https://www.bing.com"
rel="noreferrer"
className="text-blue-600 underline"
>
https://www.bing.com
</a>
{'. '}
{localize('com_endpoint_config_key_get_edge_key_dev_tool')}{' '}
<a
target="_blank"
href="https://github.com/waylaidwanderer/node-chatgpt-api/issues/378#issuecomment-1559868368"
rel="noreferrer"
className="text-blue-600 underline"
>
{localize('com_endpoint_config_key_edge_instructions')}
</a>{' '}
{localize('com_endpoint_config_key_edge_full_token_string')}
</small>
),
[EModelEndpoint.chatGPTBrowser]: (
<small className="break-all text-gray-500">
{localize('com_endpoint_config_key_chatgpt')}{' '}