From fe9941eb014aff2949f2632d1fec8a37f88203a7 Mon Sep 17 00:00:00 2001 From: tristandostaler Date: Tue, 3 Sep 2024 09:50:41 -0300 Subject: [PATCH] Removed deprecated gpt-3.5 and miograted to 4o --- src/components/TokenCount/TokenCount.tsx | 2 +- src/constants/chat.ts | 12 +----------- src/constants/prompt.ts | 2 +- src/store/migrate.ts | 20 ++++++++++++++++++++ src/types/chat.ts | 4 ++++ 5 files changed, 27 insertions(+), 13 deletions(-) diff --git a/src/components/TokenCount/TokenCount.tsx b/src/components/TokenCount/TokenCount.tsx index 24075c590..857b41df8 100644 --- a/src/components/TokenCount/TokenCount.tsx +++ b/src/components/TokenCount/TokenCount.tsx @@ -13,7 +13,7 @@ const TokenCount = React.memo(() => { state.chats ? (state.chats[state.currentChatIndex] ? state.chats[state.currentChatIndex].messages : []) : [], shallow ); - var defaultModel = 'gpt-3.5-turbo' as keyof typeof modelCost; + var defaultModel = 'gpt-4o-mini' as keyof typeof modelCost; const model = useStore((state) => state.chats ? state.chats[state.currentChatIndex] ? state.chats[state.currentChatIndex].config ? state.chats[state.currentChatIndex].config.model diff --git a/src/constants/chat.ts b/src/constants/chat.ts index 431ecae17..3f2fa32aa 100644 --- a/src/constants/chat.ts +++ b/src/constants/chat.ts @@ -16,16 +16,6 @@ export const _defaultSystemMessage = '{{SystemPrompt}}'; export const modelCost = { - 'gpt-3.5-turbo-16k': { - prompt: { price: 0.003, unit: 1000 }, - completion: { price: 0.004, unit: 1000 }, - modelMaxToken: 16384, - }, - 'gpt-3.5-turbo': { - prompt: { price: 0.002, unit: 1000 }, - completion: { price: 0.002, unit: 1000 }, - modelMaxToken: 4096, - }, 'gpt-4': { prompt: { price: 0.03, unit: 1000 }, completion: { price: 0.06, unit: 1000 }, @@ -50,7 +40,7 @@ export const modelCost = { export const modelOptions: ModelOptions[] = Object.keys(modelCost) as ModelOptions[]; -export const defaultModel = 'gpt-3.5-turbo-16k'; +export const defaultModel = 'gpt-4o-mini'; export const minResponseSize = 500; diff --git a/src/constants/prompt.ts b/src/constants/prompt.ts index e9b183339..f8e38727f 100644 --- a/src/constants/prompt.ts +++ b/src/constants/prompt.ts @@ -40,7 +40,7 @@ Anything mention between [square brackets] in the features section is for you on # Features: - The main menu is on the left, on mobile it is always hidden and can be opened by clicking on the 3 lines icon. On desktop it can be closed or stay open (if closed it can be reopened like on mobile). This main menu has all the chats, and folders where chats can be organized. -- The chat menu is accessible on the top of the page when a chat is opened. This chat menu can modify settings for the opened chat. [There is no icon, all settings are accessible directly from the top of the page.] In this menu, we can modify: the model to use (like gpt-3.5-turbo and gpt-4), the organization to use, the max tokens, the temperature, the top-p, the presence penalty and the frequency penalty. +- The chat menu is accessible on the top of the page when a chat is opened. This chat menu can modify settings for the opened chat. [There is no icon, all settings are accessible directly from the top of the page.] In this menu, we can modify: the model to use (like gpt-4o-mini and gpt-4), the organization to use, the max tokens, the temperature, the top-p, the presence penalty and the frequency penalty. - Main menu settings: this setting is acessible in the bottom of the main menu. If it is not visible, we can open it by clicking on the arrow at the bottom of the main menu. Once the bottom panel opened, we can click on "Settings" to access the settings windows. In these settings we can: change the language, toggle between the light and dark mode, toggle the feature to auto generate the chat title, toggle the feature to submit a prompt with enter, enable text to speech, access the prompt library which will be detailed later, modify the default chat configs, start or stop syncing with AppWrite (prefered) or Google Drive. - Prompt library: The prompt library contains a collection of prompts that you can use to start a conversation. There are private prompts and synced / public prompts. You can also create your own prompts and save them to the private library for future use by clicking on the + icon after the private prompts section. The synced prompts are synced every 5 minutes. You can add new sync by filling the section "Add public prompts sync" and entering a name and a URL to a CSV containing the prompts. Please note that the CSV needs to be in a specific format to work. To remove a sync, go to the end of the modal window to see the synced prompts sources and click the X on the right of the synced prompt source to remove. You can also import to and export your private prompts. - In a chat, there is a button with the icon "/" on which you can click to access the name of the prompts, configured in the prompt library, in a modal window above the chat. When a prompt is selected, it will replace the content of the next chat message to be sent. You can also open this model window by typing "/" at the start of the next chat message to send. You can use the arrows on your keyboard to navigate, and press enter to select a prompt to use. diff --git a/src/store/migrate.ts b/src/store/migrate.ts index b1811c28d..9f02e9c16 100644 --- a/src/store/migrate.ts +++ b/src/store/migrate.ts @@ -156,6 +156,26 @@ export const migrateV14 = (persistedState: LocalStorageInterfaceV13ToV14) => { }); }; +export const migrateV15 = (persistedState: LocalStorageInterfaceV14ToV15) => { + persistedState.chats.forEach((chat) => { + if(chat.config.model.toString() == "gpt-3.5-turbo" || chat.config.model.toString() == "gpt-3.5-turbo-16k") { + chat.config.model = 'gpt-4o-mini'; + } + }); + if(persistedState.defaultChatConfig.model.toString() == "gpt-3.5-turbo" || persistedState.defaultChatConfig.model.toString() == "gpt-3.5-turbo-16k") { + persistedState.defaultChatConfig.model = 'gpt-4o-mini'; + } + persistedState.prompts.forEach((prompt) => { + prompt.prompt = prompt.prompt.replaceAll("~ Model: gpt-3.5-turbo-16k ~", "~ Model: gpt-4o-mini ~"); + prompt.prompt = prompt.prompt.replaceAll("~ Model: gpt-3.5-turbo ~", "~ Model: gpt-4o-mini ~"); + }); + + persistedState.publicPrompts.forEach((prompt) => { + prompt.source = prompt.source.replaceAll("~ Model: gpt-3.5-turbo-16k ~", "~ Model: gpt-4o-mini ~") + prompt.source = prompt.source.replaceAll("~ Model: gpt-3.5-turbo ~", "~ Model: gpt-4o-mini ~") + }); +}; + export const migrateState = (persistedState: any, version: number) => { switch (version) { case 0: diff --git a/src/types/chat.ts b/src/types/chat.ts index 98f714b87..a650105fa 100644 --- a/src/types/chat.ts +++ b/src/types/chat.ts @@ -164,4 +164,8 @@ export interface LocalStorageInterfaceV12ToV13 export interface LocalStorageInterfaceV13ToV14 extends LocalStorageInterfaceV12ToV13 { +} + +export interface LocalStorageInterfaceV14ToV15 + extends LocalStorageInterfaceV13ToV14 { } \ No newline at end of file