Skip to content

Commit c52b1c5

Browse files
committed
Remove some chatbots
1 parent 399b3fd commit c52b1c5

3 files changed

Lines changed: 31 additions & 55 deletions

File tree

src/app/bots/index.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,9 @@ export type BotId =
1515
| 'claude'
1616
| 'xunfei'
1717
| 'vicuna'
18-
| 'alpaca'
1918
| 'chatglm'
2019
| 'llama'
21-
| 'oasst'
22-
| 'rwkv'
2320
| 'pi'
24-
| 'guanaco'
2521
| 'wizardlm'
2622
| 'qianwen'
2723
| 'baichuan'
@@ -40,18 +36,10 @@ export function createBotInstance(botId: BotId) {
4036
return new XunfeiBot()
4137
case 'vicuna':
4238
return new LMSYSBot('vicuna-33b')
43-
case 'alpaca':
44-
return new LMSYSBot('alpaca-13b')
4539
case 'chatglm':
4640
return new LMSYSBot('chatglm2-6b')
4741
case 'llama':
4842
return new LMSYSBot('llama-2-70b-chat')
49-
case 'oasst':
50-
return new LMSYSBot('oasst-pythia-12b')
51-
case 'rwkv':
52-
return new LMSYSBot('RWKV-4-Raven-14B')
53-
case 'guanaco':
54-
return new LMSYSBot('guanaco-33b')
5543
case 'wizardlm':
5644
return new LMSYSBot('wizardlm-13b')
5745
case 'pi':

src/app/consts.ts

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
1-
import alpacaLogo from '~/assets/alpaca-logo.png'
21
import claudeLogo from '~/assets/anthropic-logo.png'
2+
import baichuanLogo from '~/assets/baichuan-logo.png'
33
import bardLogo from '~/assets/bard-logo.svg'
44
import bingLogo from '~/assets/bing-logo.svg'
55
import chatglmLogo from '~/assets/chatglm-logo.svg'
66
import chatgptLogo from '~/assets/chatgpt-logo.svg'
7-
import guanacoLogo from '~/assets/guanaco-logo.png'
87
import llamaLogo from '~/assets/llama-logo.png'
9-
import oasstLogo from '~/assets/oasst-logo.svg'
108
import piLogo from '~/assets/pi-logo.png'
11-
import rwkvLogo from '~/assets/rwkv-logo.png'
9+
import qianwenLogo from '~/assets/qianwen-logo.png'
1210
import vicunaLogo from '~/assets/vicuna-logo.jpg'
1311
import wizardlmLogo from '~/assets/wizardlm-logo.png'
1412
import xunfeiLogo from '~/assets/xunfei-logo.png'
15-
import qianwenLogo from '~/assets/qianwen-logo.png'
16-
import baichuanLogo from '~/assets/baichuan-logo.png'
1713
import { BotId } from './bots'
1814

1915
export const CHATBOTS: Record<BotId, { name: string; avatar: any }> = {
@@ -37,10 +33,6 @@ export const CHATBOTS: Record<BotId, { name: string; avatar: any }> = {
3733
name: 'Llama 2',
3834
avatar: llamaLogo,
3935
},
40-
alpaca: {
41-
name: 'Alpaca',
42-
avatar: alpacaLogo,
43-
},
4436
vicuna: {
4537
name: 'Vicuna',
4638
avatar: vicunaLogo,
@@ -49,6 +41,10 @@ export const CHATBOTS: Record<BotId, { name: string; avatar: any }> = {
4941
name: 'Pi',
5042
avatar: piLogo,
5143
},
44+
wizardlm: {
45+
name: 'WizardLM',
46+
avatar: wizardlmLogo,
47+
},
5248
chatglm: {
5349
name: 'ChatGLM2',
5450
avatar: chatglmLogo,
@@ -57,22 +53,6 @@ export const CHATBOTS: Record<BotId, { name: string; avatar: any }> = {
5753
name: 'iFlytek Spark',
5854
avatar: xunfeiLogo,
5955
},
60-
oasst: {
61-
name: 'OpenAssistant',
62-
avatar: oasstLogo,
63-
},
64-
rwkv: {
65-
name: 'ChatRWKV',
66-
avatar: rwkvLogo,
67-
},
68-
guanaco: {
69-
name: 'Guanaco',
70-
avatar: guanacoLogo,
71-
},
72-
wizardlm: {
73-
name: 'WizardLM',
74-
avatar: wizardlmLogo,
75-
},
7656
qianwen: {
7757
name: 'Qianwen',
7858
avatar: qianwenLogo,

src/app/pages/MultiBotChatPanel.tsx

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,36 @@
11
import { useAtom, useAtomValue, useSetAtom } from 'jotai'
22
import { atomWithStorage } from 'jotai/utils'
3-
import { uniqBy } from 'lodash-es'
3+
import { sample, uniqBy } from 'lodash-es'
44
import { FC, Suspense, useCallback, useEffect, useMemo } from 'react'
55
import { useTranslation } from 'react-i18next'
66
import { cx } from '~/utils'
77
import Button from '~app/components/Button'
88
import ChatMessageInput from '~app/components/Chat/ChatMessageInput'
99
import LayoutSwitch from '~app/components/Chat/LayoutSwitch'
10-
import { Layout } from '~app/consts'
10+
import { CHATBOTS, Layout } from '~app/consts'
1111
import { useChat } from '~app/hooks/use-chat'
1212
import { usePremium } from '~app/hooks/use-premium'
1313
import { trackEvent } from '~app/plausible'
1414
import { showPremiumModalAtom } from '~app/state'
1515
import { BotId } from '../bots'
1616
import ConversationPanel from '../components/Chat/ConversationPanel'
1717

18+
const DEFAULT_BOTS: BotId[] = ['chatgpt', 'claude', 'bard', 'bing', 'llama', 'pi']
19+
1820
const layoutAtom = atomWithStorage<Layout>('multiPanelLayout', 2, undefined, { unstable_getOnInit: true })
19-
const twoPanelBotsAtom = atomWithStorage<BotId[]>('multiPanelBots:2', ['chatgpt', 'claude'])
20-
const threePanelBotsAtom = atomWithStorage<BotId[]>('multiPanelBots:3', ['chatgpt', 'claude', 'bard'])
21-
const fourPanelBotsAtom = atomWithStorage<BotId[]>('multiPanelBots:4', ['chatgpt', 'claude', 'bard', 'bing'])
22-
const sixPanelBotsAtom = atomWithStorage<BotId[]>('multiPanelBots:6', [
23-
'chatgpt',
24-
'claude',
25-
'bard',
26-
'bing',
27-
'pi',
28-
'llama',
29-
])
21+
const twoPanelBotsAtom = atomWithStorage<BotId[]>('multiPanelBots:2', DEFAULT_BOTS.slice(0, 2))
22+
const threePanelBotsAtom = atomWithStorage<BotId[]>('multiPanelBots:3', DEFAULT_BOTS.slice(0, 3))
23+
const fourPanelBotsAtom = atomWithStorage<BotId[]>('multiPanelBots:4', DEFAULT_BOTS.slice(0, 4))
24+
const sixPanelBotsAtom = atomWithStorage<BotId[]>('multiPanelBots:6', DEFAULT_BOTS.slice(0, 6))
25+
26+
function replaceDeprecatedBots(bots: BotId[]): BotId[] {
27+
return bots.map((bot) => {
28+
if (CHATBOTS[bot]) {
29+
return bot
30+
}
31+
return sample(DEFAULT_BOTS)!
32+
})
33+
}
3034

3135
const GeneralChatPanel: FC<{
3236
chats: ReturnType<typeof useChat>[]
@@ -131,15 +135,17 @@ const GeneralChatPanel: FC<{
131135
}
132136

133137
const TwoBotChatPanel = () => {
134-
const [multiPanelBotIds, setBots] = useAtom(twoPanelBotsAtom)
138+
const [bots, setBots] = useAtom(twoPanelBotsAtom)
139+
const multiPanelBotIds = useMemo(() => replaceDeprecatedBots(bots), [bots])
135140
const chat1 = useChat(multiPanelBotIds[0])
136141
const chat2 = useChat(multiPanelBotIds[1])
137142
const chats = useMemo(() => [chat1, chat2], [chat1, chat2])
138143
return <GeneralChatPanel chats={chats} setBots={setBots} />
139144
}
140145

141146
const ThreeBotChatPanel = () => {
142-
const [multiPanelBotIds, setBots] = useAtom(threePanelBotsAtom)
147+
const [bots, setBots] = useAtom(threePanelBotsAtom)
148+
const multiPanelBotIds = useMemo(() => replaceDeprecatedBots(bots), [bots])
143149
const chat1 = useChat(multiPanelBotIds[0])
144150
const chat2 = useChat(multiPanelBotIds[1])
145151
const chat3 = useChat(multiPanelBotIds[2])
@@ -148,7 +154,8 @@ const ThreeBotChatPanel = () => {
148154
}
149155

150156
const FourBotChatPanel = () => {
151-
const [multiPanelBotIds, setBots] = useAtom(fourPanelBotsAtom)
157+
const [bots, setBots] = useAtom(fourPanelBotsAtom)
158+
const multiPanelBotIds = useMemo(() => replaceDeprecatedBots(bots), [bots])
152159
const chat1 = useChat(multiPanelBotIds[0])
153160
const chat2 = useChat(multiPanelBotIds[1])
154161
const chat3 = useChat(multiPanelBotIds[2])
@@ -158,7 +165,8 @@ const FourBotChatPanel = () => {
158165
}
159166

160167
const SixBotChatPanel = () => {
161-
const [multiPanelBotIds, setBots] = useAtom(sixPanelBotsAtom)
168+
const [bots, setBots] = useAtom(sixPanelBotsAtom)
169+
const multiPanelBotIds = useMemo(() => replaceDeprecatedBots(bots), [bots])
162170
const chat1 = useChat(multiPanelBotIds[0])
163171
const chat2 = useChat(multiPanelBotIds[1])
164172
const chat3 = useChat(multiPanelBotIds[2])

0 commit comments

Comments
 (0)