Skip to content

Commit

Permalink
Revert "Move CHATBOTS to bots/index.ts"
Browse files Browse the repository at this point in the history
This reverts commit b378149.
  • Loading branch information
wong2 committed Dec 12, 2023
1 parent fb490a6 commit 81e25f7
Show file tree
Hide file tree
Showing 11 changed files with 104 additions and 101 deletions.
88 changes: 0 additions & 88 deletions src/app/bots/index.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
import claudeLogo from '~/assets/anthropic-logo.png'
import baichuanLogo from '~/assets/baichuan-logo.png'
import bardLogo from '~/assets/bard-logo.svg'
import bingLogo from '~/assets/bing-logo.svg'
import chatglmLogo from '~/assets/chatglm-logo.svg'
import chatgptLogo from '~/assets/chatgpt-logo.svg'
import falconLogo from '~/assets/falcon-logo.jpeg'
import grokLogo from '~/assets/grok-logo.png'
import llamaLogo from '~/assets/llama-logo.png'
import mistralLogo from '~/assets/mistral-logo.png'
import piLogo from '~/assets/pi-logo.png'
import pplxLogo from '~/assets/pplx-logo.jpg'
import qianwenLogo from '~/assets/qianwen-logo.png'
import vicunaLogo from '~/assets/vicuna-logo.jpg'
import wizardlmLogo from '~/assets/wizardlm-logo.png'
import xunfeiLogo from '~/assets/xunfei-logo.png'
import yiLogo from '~/assets/yi-logo.svg'
import { BaichuanWebBot } from './baichuan'
import { BardBot } from './bard'
import { BingWebBot } from './bing'
Expand Down Expand Up @@ -46,77 +29,6 @@ export type BotId =
| 'yi'
| 'grok'

export const CHATBOTS: Record<BotId, { name: string; avatar: string }> = {
chatgpt: {
name: 'ChatGPT',
avatar: chatgptLogo,
},
claude: {
name: 'Claude',
avatar: claudeLogo,
},
bard: {
name: 'Bard',
avatar: bardLogo,
},
bing: {
name: 'Bing',
avatar: bingLogo,
},
perplexity: {
name: 'Perplexity',
avatar: pplxLogo,
},
llama: {
name: 'Llama 2',
avatar: llamaLogo,
},
vicuna: {
name: 'Vicuna',
avatar: vicunaLogo,
},
falcon: {
name: 'Falcon',
avatar: falconLogo,
},
grok: {
name: 'Grok',
avatar: grokLogo,
},
mistral: {
name: 'Mistral',
avatar: mistralLogo,
},
pi: {
name: 'Pi',
avatar: piLogo,
},
wizardlm: {
name: 'WizardLM',
avatar: wizardlmLogo,
},
chatglm: {
name: 'ChatGLM2',
avatar: chatglmLogo,
},
xunfei: {
name: 'iFlytek Spark',
avatar: xunfeiLogo,
},
qianwen: {
name: 'Qianwen',
avatar: qianwenLogo,
},
baichuan: {
name: 'Baichuan',
avatar: baichuanLogo,
},
yi: {
name: 'Yi-Chat',
avatar: yiLogo,
},
}

export function createBotInstance(botId: BotId) {
switch (botId) {
case 'chatgpt':
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/Chat/ConversationPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import clearIcon from '~/assets/icons/clear.svg'
import historyIcon from '~/assets/icons/history.svg'
import shareIcon from '~/assets/icons/share.svg'
import { cx } from '~/utils'
import { CHATBOTS } from '~app/bots'
import { CHATBOTS } from '~app/consts'
import { ConversationContext, ConversationContextValue } from '~app/context'
import { trackEvent } from '~app/plausible'
import { ChatMessageModel } from '~types'
Expand Down
4 changes: 2 additions & 2 deletions src/app/components/History/ChatMessage.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { cx } from '~/utils'
import { FC, memo, useCallback } from 'react'
import { FiTrash2 } from 'react-icons/fi'
import { useSWRConfig } from 'swr'
import { CHATBOTS } from '~/app/bots'
import { cx } from '~/utils'
import { CHATBOTS } from '~/app/consts'
import { BotId } from '~app/bots'
import { deleteHistoryMessage } from '~services/chat-history'
import { ChatMessageModel } from '~types'
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/History/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next'
import { FiSearch } from 'react-icons/fi'
import { VscClearAll } from 'react-icons/vsc'
import { BotId } from '~app/bots'
import { CHATBOTS } from '~app/bots'
import { CHATBOTS } from '~app/consts'
import { usePremium } from '~app/hooks/use-premium'
import { clearHistoryMessages } from '~services/chat-history'
import Dialog from '../Dialog'
Expand Down
3 changes: 2 additions & 1 deletion src/app/components/Settings/EnabledBotsSettings.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { FC, useCallback } from 'react'
import { BotId, CHATBOTS } from '~app/bots'
import { BotId } from '~app/bots'
import { CHATBOTS } from '~app/consts'
import { UserConfig } from '~services/user-config'

interface Props {
Expand Down
90 changes: 90 additions & 0 deletions src/app/consts.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,93 @@
import claudeLogo from '~/assets/anthropic-logo.png'
import baichuanLogo from '~/assets/baichuan-logo.png'
import bardLogo from '~/assets/bard-logo.svg'
import bingLogo from '~/assets/bing-logo.svg'
import chatglmLogo from '~/assets/chatglm-logo.svg'
import chatgptLogo from '~/assets/chatgpt-logo.svg'
import falconLogo from '~/assets/falcon-logo.jpeg'
import llamaLogo from '~/assets/llama-logo.png'
import mistralLogo from '~/assets/mistral-logo.png'
import piLogo from '~/assets/pi-logo.png'
import qianwenLogo from '~/assets/qianwen-logo.png'
import vicunaLogo from '~/assets/vicuna-logo.jpg'
import wizardlmLogo from '~/assets/wizardlm-logo.png'
import xunfeiLogo from '~/assets/xunfei-logo.png'
import pplxLogo from '~/assets/pplx-logo.jpg'
import yiLogo from '~/assets/yi-logo.svg'
import grokLogo from '~/assets/grok-logo.png'
import { BotId } from './bots'

export const CHATBOTS: Record<BotId, { name: string; avatar: string }> = {
chatgpt: {
name: 'ChatGPT',
avatar: chatgptLogo,
},
claude: {
name: 'Claude',
avatar: claudeLogo,
},
bard: {
name: 'Bard',
avatar: bardLogo,
},
bing: {
name: 'Bing',
avatar: bingLogo,
},
perplexity: {
name: 'Perplexity',
avatar: pplxLogo,
},
llama: {
name: 'Llama 2',
avatar: llamaLogo,
},
vicuna: {
name: 'Vicuna',
avatar: vicunaLogo,
},
falcon: {
name: 'Falcon',
avatar: falconLogo,
},
grok: {
name: 'Grok',
avatar: grokLogo,
},
mistral: {
name: 'Mistral',
avatar: mistralLogo,
},
pi: {
name: 'Pi',
avatar: piLogo,
},
wizardlm: {
name: 'WizardLM',
avatar: wizardlmLogo,
},
chatglm: {
name: 'ChatGLM2',
avatar: chatglmLogo,
},
xunfei: {
name: 'iFlytek Spark',
avatar: xunfeiLogo,
},
qianwen: {
name: 'Qianwen',
avatar: qianwenLogo,
},
baichuan: {
name: 'Baichuan',
avatar: baichuanLogo,
},
yi: {
name: 'Yi-Chat',
avatar: yiLogo,
},
}

export const CHATGPT_HOME_URL = 'https://chat.openai.com'
export const CHATGPT_API_MODELS = ['gpt-3.5-turbo', 'gpt-4', 'gpt-4-turbo'] as const
export const ALL_IN_ONE_PAGE_ID = 'all'
Expand Down
3 changes: 2 additions & 1 deletion src/app/hooks/use-enabled-bots.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import useSWR from 'swr/immutable'
import { BotId, CHATBOTS } from '~app/bots'
import { BotId } from '~app/bots'
import { CHATBOTS } from '~app/consts'
import { getUserConfig } from '~services/user-config'

export function useEnabledBots() {
Expand Down
4 changes: 2 additions & 2 deletions src/app/pages/MultiBotChatPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import { cx } from '~/utils'
import Button from '~app/components/Button'
import ChatMessageInput from '~app/components/Chat/ChatMessageInput'
import LayoutSwitch from '~app/components/Chat/LayoutSwitch'
import { Layout } from '~app/consts'
import { CHATBOTS, Layout } from '~app/consts'
import { useChat } from '~app/hooks/use-chat'
import { usePremium } from '~app/hooks/use-premium'
import { trackEvent } from '~app/plausible'
import { showPremiumModalAtom } from '~app/state'
import { BotId, CHATBOTS } from '../bots'
import { BotId } from '../bots'
import ConversationPanel from '../components/Chat/ConversationPanel'

const DEFAULT_BOTS: BotId[] = Object.keys(CHATBOTS).slice(0, 6) as BotId[]
Expand Down
3 changes: 1 addition & 2 deletions src/app/pages/SettingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import toast, { Toaster } from 'react-hot-toast'
import { useTranslation } from 'react-i18next'
import { BiExport, BiImport } from 'react-icons/bi'
import Browser from 'webextension-polyfill'
import { CHATBOTS } from '~app/bots'
import Button, { MotionButton } from '~app/components/Button'
import RadioGroup from '~app/components/RadioGroup'
import Select from '~app/components/Select'
Expand All @@ -19,7 +18,7 @@ import ClaudeWebappSettings from '~app/components/Settings/ClaudeWebappSettings'
import EnabledBotsSettings from '~app/components/Settings/EnabledBotsSettings'
import KDB from '~app/components/Settings/KDB'
import PerplexityAPISettings from '~app/components/Settings/PerplexityAPISettings'
import { ALL_IN_ONE_PAGE_ID } from '~app/consts'
import { ALL_IN_ONE_PAGE_ID, CHATBOTS } from '~app/consts'
import { exportData, importData } from '~app/utils/export'
import {
BingConversationStyle,
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/SidePanelPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { useCallback, useMemo } from 'react'
import { useTranslation } from 'react-i18next'
import clearIcon from '~/assets/icons/clear.svg'
import { cx } from '~/utils'
import { CHATBOTS } from '~app/bots'
import Button from '~app/components/Button'
import ChatMessageInput from '~app/components/Chat/ChatMessageInput'
import ChatMessageList from '~app/components/Chat/ChatMessageList'
import ChatbotName from '~app/components/Chat/ChatbotName'
import { CHATBOTS } from '~app/consts'
import { ConversationContext, ConversationContextValue } from '~app/context'
import { useChat } from '~app/hooks/use-chat'
import { sidePanelBotAtom } from '~app/state'
Expand Down
4 changes: 2 additions & 2 deletions src/services/user-config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { defaults } from 'lodash-es'
import Browser from 'webextension-polyfill'
import { BotId, CHATBOTS } from '~app/bots'
import { ALL_IN_ONE_PAGE_ID, CHATGPT_API_MODELS, DEFAULT_CHATGPT_SYSTEM_MESSAGE } from '~app/consts'
import { BotId } from '~app/bots'
import { ALL_IN_ONE_PAGE_ID, CHATBOTS, CHATGPT_API_MODELS, DEFAULT_CHATGPT_SYSTEM_MESSAGE } from '~app/consts'

export enum BingConversationStyle {
Creative = 'creative',
Expand Down

0 comments on commit 81e25f7

Please sign in to comment.